From baca92ef4cead762663efa61e81584c8a8ece7b4 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 20 Dec 2011 20:43:56 +0100 Subject: 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. --- src/newt/classes/com/jogamp/newt/Screen.java | 4 ++-- src/newt/classes/jogamp/newt/ScreenImpl.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/newt/classes') 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 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 ); -- cgit v1.2.3