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 /src/newt/classes/jogamp | |
parent | 061ce19983556a751471459a964d886e4d7e3908 (diff) |
NEWT Multiple Monitor Mode: Fix monitorModeChanged(..) event id, WindowImpl.monitorModeChanged(): Resize/position if not fitting into virtual screen viewport.
Diffstat (limited to 'src/newt/classes/jogamp')
-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 |
3 files changed, 11 insertions, 9 deletions
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)) { |