diff options
author | Sven Gothel <[email protected]> | 2013-05-07 12:51:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-07 12:51:18 +0200 |
commit | 081177f2433be50e3b5d46385c2f0f3f96311ed8 (patch) | |
tree | 585b127d4be857ebfd06bdb7dfade34876e78725 | |
parent | 061ce19983556a751471459a964d886e4d7e3908 (diff) |
NEWT Multiple Monitor Mode: Fix monitorModeChanged(..) event id, WindowImpl.monitorModeChanged(): Resize/position if not fitting into virtual screen viewport.
-rwxr-xr-x | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/ScreenMonitorState.java | 2 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 15 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java | 3 |
4 files changed, 13 insertions, 11 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 2152aabac..8221f1da8 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -294,7 +294,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWTAnalyzeBug455 $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWTBug450 $* -testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper $* +#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestTeapotNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl3.newt.TestGeomShader01TextureGL3NEWT $* @@ -385,7 +385,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT #testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode00NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode00bNEWT -#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01NEWT +testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01NEWT #testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01aNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01bNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01cNEWT $* diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java index 7cda18521..66e75be16 100644 --- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java +++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java @@ -176,7 +176,7 @@ public class ScreenMonitorState { lock(); try { validateMonitor(monitor); - final MonitorEvent me = new MonitorEvent(MonitorEvent.EVENT_MONITOR_MODE_CHANGE_NOTIFY, monitor, System.currentTimeMillis(), currentMode); + final MonitorEvent me = new MonitorEvent(MonitorEvent.EVENT_MONITOR_MODE_CHANGED, monitor, System.currentTimeMillis(), currentMode); for(int i=0; i<listener.size(); i++) { listener.get(i).monitorModeChanged(me, success); } diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 578dbec7b..9ed4f9ad7 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1986,16 +1986,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer animatorPaused = lifecycleHook.pauseRenderingAction(); } if( !fullscreen ) { - // FIXME: Need to take all covered monitors into account - final MonitorDevice mainMonitor = getMainMonitor(); - final MonitorDevice eventMonitor = me.getMonitor(); - if( mainMonitor == eventMonitor ) { + // Simply move/resize window to fit in virtual screen if required + final RectangleImmutable viewport = screen.getViewport(); + if( viewport.getWidth() > 0 && viewport.getHeight() > 0 ) { // failsafe final RectangleImmutable rect = new Rectangle(getX(), getY(), getWidth(), getHeight()); - final RectangleImmutable viewport = mainMonitor.getViewport(); final RectangleImmutable isect = viewport.intersection(rect); if ( getHeight() > isect.getHeight() || getWidth() > isect.getWidth() ) { - setSize(isect.getWidth(), isect.getHeight()); + if(DEBUG_IMPLEMENTATION) { + System.err.println("Window.monitorModeChanged: fit window "+rect+" into screen viewport "+viewport+ + ", due to minimal intersection "+isect); + } + setPosition(viewport.getX(), viewport.getY()); + setSize(viewport.getWidth(), viewport.getHeight()); } } } diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 666d0cb5b..fcc5b2148 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -135,8 +135,7 @@ public class WindowDriver extends WindowImpl { protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { if(DEBUG_IMPLEMENTATION) { - System.err.println("X11Window reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ - getReconfigureFlagsAsString(null, flags)); + System.err.println("X11Window reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ getReconfigureFlagsAsString(null, flags)); } final int _x, _y; if(0 == ( FLAG_IS_UNDECORATED & flags)) { |