diff options
author | Sven Gothel <[email protected]> | 2013-12-19 12:59:05 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-12-19 12:59:05 +0100 |
commit | 0f1ddc82329835b903e31e301fcf134d1d7337be (patch) | |
tree | 13009c126828523cf3758fafa0253078ded94c93 | |
parent | e217858a83f947ffdd7e4ce3395073584e57108a (diff) |
Bug 924: More robost Fullscreen Exit
- 'tempInvisible' shall be also performed for top windows, solves Unity-WM background refresh issue
- Rename local field 'fullscreen' -> '_fullscreen' to avoid confusion
- Proper insets handling: Set 'WindowImpl.this.fullscreen = _fullscreen' only before reconfiguring,
otherwise wrong position maybe used due to wrong insets value.
Tested w/ WMs: KWin + Unity
-rw-r--r-- | make/scripts/tests.sh | 7 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 50 |
2 files changed, 30 insertions, 27 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 746985d83..b680d2b25 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -93,6 +93,7 @@ function jrun() { #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + D_ARGS="-Dnativewindow.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock" #D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG" @@ -192,7 +193,7 @@ function jrun() { #D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen" - D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window" + #D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window" #D_ARGS="-Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent" #D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent" @@ -320,7 +321,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $* -#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* +testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* @@ -506,7 +507,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $* ##testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $* -testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT $* +#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $* diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index aa2d264af..437179f12 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2018,27 +2018,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } private class FullScreenAction implements Runnable { - boolean fullscreen; + boolean _fullscreen; private boolean init(boolean fullscreen) { if(isNativeValid()) { - this.fullscreen = fullscreen; + this._fullscreen = fullscreen; return isFullscreen() != fullscreen; } else { WindowImpl.this.fullscreen = fullscreen; // set current state for createNative(..) return false; } } - public boolean fsOn() { return fullscreen; } + public boolean fsOn() { return _fullscreen; } @Override public final void run() { final RecursiveLock _lock = windowLock; _lock.lock(); try { - // set current state - WindowImpl.this.fullscreen = fullscreen; - final int oldX = getX(); final int oldY = getY(); final int oldWidth = getWidth(); @@ -2050,7 +2047,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final RectangleImmutable viewport; final int fs_span_flag; final boolean alwaysOnTopChange; - if(fullscreen) { + if(_fullscreen) { if( null == fullscreenMonitors ) { if( fullscreenUseMainMonitor ) { fullscreenMonitors = new ArrayList<MonitorDevice>(); @@ -2103,30 +2100,33 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } + + final DisplayImpl display = (DisplayImpl) screen.getDisplay(); + display.dispatchMessagesNative(); // status up2date + final boolean wasVisible = isVisible(); + final boolean tempInvisible = !_fullscreen && wasVisible && NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true); + if(DEBUG_IMPLEMENTATION) { - System.err.println("Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+isUndecorated()+ + System.err.println("Window fs: "+_fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+isUndecorated()+ ", virtl-screenSize: "+sviewport+", monitorsViewport "+viewport+ ", spanning "+(0!=fs_span_flag)+ ", alwaysOnTop "+alwaysOnTop+(alwaysOnTopChange?"*":"")+ + ", wasVisible "+wasVisible+", tempInvisible "+tempInvisible+ + ", hasParent "+(null!=parentWindow)+ " @ "+Thread.currentThread().getName()); } - final DisplayImpl display = (DisplayImpl) screen.getDisplay(); - display.dispatchMessagesNative(); // status up2date - final boolean wasVisible = isVisible(); + // fullscreen off: !visible first (fixes X11 unsuccessful return to parent window _and_ wrong window size propagation) + if( tempInvisible ) { + setVisibleImpl(false, oldX, oldY, oldWidth, oldHeight); + WindowImpl.this.waitForVisible(false, false); + try { Thread.sleep(100); } catch (InterruptedException e) { } + display.dispatchMessagesNative(); // status up2date + } // Lock parentWindow only during reparenting (attempt) final NativeWindow parentWindowLocked; if( null != parentWindow ) { - // fullscreen off: !visible first (fixes X11 unsuccessful return to parent window) - if( !fullscreen && wasVisible && NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) { - setVisibleImpl(false, oldX, oldY, oldWidth, oldHeight); - WindowImpl.this.waitForVisible(false, false); - // FIXME: Some composite WM behave slacky .. give 'em chance to change state -> invisible, - // even though we do exactly that (KDE+Composite) - try { Thread.sleep(100); } catch (InterruptedException e) { } - display.dispatchMessagesNative(); // status up2date - } parentWindowLocked = parentWindow; if( NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindowLocked.lockSurface() ) { throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow); @@ -2135,14 +2135,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer parentWindowLocked = null; } try { - if(alwaysOnTopChange && fullscreen) { + if(alwaysOnTopChange && _fullscreen) { // Enter fullscreen - Disable alwaysOnTop - reconfigureWindowImpl(nfs_x, nfs_y, nfs_width, nfs_height, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible())); + reconfigureWindowImpl(oldX, oldY, oldWidth, oldHeight, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible())); } + + WindowImpl.this.fullscreen = _fullscreen; reconfigureWindowImpl(x, y, w, h, getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) | fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) ); - if(alwaysOnTopChange && !fullscreen) { + if(alwaysOnTopChange && !_fullscreen) { // Leave fullscreen - Restore alwaysOnTop reconfigureWindowImpl(x, y, w, h, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible())); } @@ -2164,7 +2166,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW); } if(ok) { - requestFocusInt(fullscreen /* skipFocusAction if fullscreen */); + requestFocusInt(_fullscreen /* skipFocusAction if fullscreen */); display.dispatchMessagesNative(); // status up2date } if(DEBUG_IMPLEMENTATION) { |