diff options
author | Sven Gothel <[email protected]> | 2011-12-20 20:43:56 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-20 20:43:56 +0100 |
commit | baca92ef4cead762663efa61e81584c8a8ece7b4 (patch) | |
tree | 0edab2eb86cba79ececdbb150a6f38dc828a3d5b | |
parent | 734a9dbc4b8eaedf0e0bb698b8692ebd31ff8707 (diff) |
NEWT initScreenModeStatus(): Issue setScreenSize() to update screen size based on native RANDR (more correct)
Clarify Screen's getWidth(), getHeight() values (-> rotated)
Also add DEBUG output for collected native modes and nativeIdx mapping.
-rw-r--r-- | src/newt/classes/com/jogamp/newt/Screen.java | 4 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/ScreenImpl.java | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index d25d3e7ac..b6d863965 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -120,12 +120,12 @@ public abstract class Screen { public abstract int getIndex(); /** - * @return the current screen width + * @return the current screen width, reflecting {@link ScreenMode} rotation */ public abstract int getWidth(); /** - * @return the current screen height + * @return the current screen height, reflecting {@link ScreenMode} rotation */ public abstract int getHeight(); diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 6ea9aff38..c520d0d63 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -499,6 +499,8 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { if(null == currentSM) { throw new InternalError("getCurrentScreenModeImpl() == null"); } + // Update rotated Screen size, since native RandR impl. is more correct. + setScreenSize(currentSM.getRotatedWidth(), currentSM.getRotatedHeight()); ArrayHashSet<ScreenMode> screenModes = collectNativeScreenModes(screenModesIdx2NativeIdx); if(screenModes.size()==0) { @@ -549,9 +551,18 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { int nativeId = smProps[0]; int screenModeIdx = ScreenModeUtil.streamIn(resolutionPool, surfaceSizePool, screenSizeMMPool, monitorModePool, screenModePool, smProps, 1); + if(DEBUG) { + System.err.println("ScreenImpl.collectNativeScreenModes: #"+num+": idx: "+nativeId+" native -> "+screenModeIdx+" newt"); + } + if(screenModeIdx >= 0) { screenModesIdx2NativeId.put(screenModeIdx, nativeId); } + } else if(DEBUG) { + System.err.println("ScreenImpl.collectNativeScreenModes: #"+num+": smProps: "+(null!=smProps)+ + ", len: "+(null != smProps ? smProps.length : 0)+ + ", bpp: "+(null != smProps && 0 < smProps.length ? smProps[idxBpp] : 0)+ + " - DROPPING"); } num++; } while ( null != smProps && 0 < smProps.length ); |