diff options
author | Sven Gothel <[email protected]> | 2011-11-10 05:18:57 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-10 05:18:57 +0100 |
commit | af083029321b3ff57c37f9426ecf5eb526b5e7ae (patch) | |
tree | dc0c6ca26e1c04638d6ce5fd999131ba08aad76d /src/newt/classes/jogamp | |
parent | 3e7818ad09a3339d8cf056729533e611a63b1965 (diff) |
NEWT/WindowImpl: Fix minor regression offscreen recreate @ setSize() (commit 51ad6992e068f25d86d2c9e085bd7ec6f49d2432)
Even though this is not a bug, but it changes the expected EDT lifecycle and hence
would require to change our test cases.
Only flip screen's reference count (which may lead to create/destroy of the EDT)
in the recreate case, where it's needed.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 2d32414fc..180cd568e 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -773,18 +773,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } final void setSizeActionImpl(int width, int height) { + boolean recreate = false; windowLock.lock(); - screen.addReference(); // recreate case try { int visibleAction = 0; // 1 invisible, 2 visible (create) if ( !fullscreen && ( width != WindowImpl.this.width || WindowImpl.this.height != height ) ) { - final boolean recreate = isNativeValid() && !getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); + recreate = isNativeValid() && !getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window setSize: START "+WindowImpl.this.width+"x"+WindowImpl.this.height+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible+", recreate "+recreate); } if(recreate) { // will trigger visibleAction:=2 -> create if wasVisible final boolean wasVisible = WindowImpl.this.visible; + screen.addReference(); // retain screen destroyAction.run(); WindowImpl.this.visible = wasVisible; } @@ -812,7 +813,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } finally { - screen.removeReference(); // recreate case + if(recreate) { + screen.removeReference(); // bring back ref-count + } windowLock.unlock(); } } |