From 2ce5d42eba3f1941141ad687498fd3955be942a5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 31 Jul 2011 19:32:02 +0200 Subject: 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. --- src/newt/classes/jogamp/newt/ScreenImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3