aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-31 19:32:02 +0200
committerSven Gothel <[email protected]>2011-07-31 19:32:02 +0200
commit2ce5d42eba3f1941141ad687498fd3955be942a5 (patch)
tree3d74bff8d0b0dd06c53569c9526a6336752bab2f /src/newt
parent8998ed04a1c0aa0f96ab463dba40e4087732cdb8 (diff)
NEWT ScreenModes: Add current ScreenMode if none could be collected.
On Linux/ARMv7 (Ubuntu 11.04) it appears that the native RnR methods could not collect ScreenModes. In such case, at least we add the current mode as a fallback. This allows using the current mode information.
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 065cd88eb..39f6b8a0f 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -432,8 +432,19 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
IntIntHashMap screenModesIdx2NativeIdx = new IntIntHashMap();
ArrayHashSet screenModes = collectNativeScreenModes(screenModesIdx2NativeIdx);
+ if(screenModes.size()==0) {
+ ScreenMode sm0 = ( DEBUG_TEST_SCREENMODE_DISABLED ) ? null : getCurrentScreenModeImpl();
+ if(null != sm0) {
+ if(DEBUG) {
+ System.err.println("ScreenImpl.initScreenModeStatus: added current (last resort, collect failed): "+sm0);
+ }
+ screenModes.getOrAdd(sm0);
+ } else if(DEBUG) {
+ System.err.println("ScreenImpl.initScreenModeStatus: Warning: No screen modes added!");
+ }
+ }
sms = new ScreenModeStatus(screenModes, screenModesIdx2NativeIdx);
- if(null!=screenModes && screenModes.size()>0) {
+ if(screenModes.size()>0) {
ScreenMode originalScreenMode = ( DEBUG_TEST_SCREENMODE_DISABLED ) ? null : getCurrentScreenModeImpl();
if(null != originalScreenMode) {
ScreenMode originalScreenMode0 = (ScreenMode) screenModes.get(originalScreenMode); // unify via value hash