diff options
author | Sven Gothel <[email protected]> | 2011-12-24 06:54:08 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-24 06:54:08 +0100 |
commit | 024b0f630e7392d2cdf586b4db42f2111a50a00c (patch) | |
tree | 6143e88266cfe30c1444880e7503808810a0868d /src | |
parent | f0159e479d386e5ae7d1e5acfb44eb7a534cb24c (diff) |
ScreenImpl.ScreenMode: getOrAdd current ScreenMode.
On Gnome it happend that the current mode was not 'scanned' by RandR,
hence adding it if not existing helps stability.
Diffstat (limited to 'src')
-rw-r--r-- | src/newt/classes/jogamp/newt/ScreenImpl.java | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 98e851937..575de6112 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -34,6 +34,21 @@ package jogamp.newt; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.media.nativewindow.AbstractGraphicsScreen; +import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.nativewindow.util.Dimension; +import javax.media.nativewindow.util.DimensionImmutable; +import javax.media.nativewindow.util.Point; +import javax.media.nativewindow.util.SurfaceSize; + import com.jogamp.common.util.ArrayHashSet; import com.jogamp.common.util.IntIntHashMap; import com.jogamp.newt.Display; @@ -44,16 +59,6 @@ import com.jogamp.newt.event.ScreenModeListener; import com.jogamp.newt.util.MonitorMode; import com.jogamp.newt.util.ScreenModeUtil; -import javax.media.nativewindow.*; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.DimensionImmutable; -import javax.media.nativewindow.util.Point; -import javax.media.nativewindow.util.SurfaceSize; - -import java.security.*; -import java.util.ArrayList; -import java.util.List; - public abstract class ScreenImpl extends Screen implements ScreenModeListener { protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true); @@ -519,11 +524,12 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { } ArrayHashSet<ScreenMode> screenModes = collectNativeScreenModes(screenModesIdx2NativeIdx); - if(screenModes.size()==0) { - if(DEBUG) { - System.err.println("ScreenImpl.initScreenModeStatus: added current (last resort, collect failed): "+currentSM); + screenModes.getOrAdd(currentSM); + if(DEBUG) { + int i=0; + for(Iterator<ScreenMode> iter=screenModes.iterator(); iter.hasNext(); i++) { + System.err.println(i+": "+iter.next()); } - screenModes.getOrAdd(currentSM); } sms = new ScreenModeStatus(screenModes, screenModesIdx2NativeIdx); |