diff options
author | Sven Gothel <[email protected]> | 2011-09-09 17:53:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-09 17:53:25 +0200 |
commit | de9a419a315d16edee2c5da74bbf7ea1f89bef30 (patch) | |
tree | 9f5536fd5e0b273fbd3bd630894be0a854a6ebcf /src/newt/classes/jogamp | |
parent | a59026f8956c9291e6e3c8b9defd618586edd742 (diff) |
NEWT/Window: CreateWindow - Wait for user req. position: Fix about window-decoration/insets size
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 75c3510b7..6c71e6082 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -274,18 +274,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new InternalError("XXX"); } if(canCreateNativeImpl()) { - final int _x = x, _y = y; // orig req pos + int _x = x, _y = y; // orig req pos screen.addReference(); screenReferenceAdded = true; createNativeImpl(); screen.addScreenModeListener(screenModeListenerImpl); setTitleImpl(title); - waitForVisible(true, false); - if(userPos) { - // wait for user req position - waitForPosSize(_x, _y, -1, -1, false, TIMEOUT_NATIVEWINDOW); - } else { - waitForAnyPos(false, TIMEOUT_NATIVEWINDOW); + if(waitForVisible(true, false)) { + if(userPos) { + // fix req position about window decoration + _x = Math.max(_x, insets.getLeftWidth()); + _y = Math.max(_y, insets.getTopHeight()); + // wait for user req position + waitForPosSize(_x, _y, -1, -1, false, TIMEOUT_NATIVEWINDOW); + } else { + waitForAnyPos(false, TIMEOUT_NATIVEWINDOW); + } } } // always flag visible, @@ -387,8 +391,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** * The native implementation must set the native windowHandle.<br> * + * <p> * The implementation should invoke the referenced java state callbacks - * to notify this Java object of state changes. + * to notify this Java object of state changes.</p> + * + * <p> + * In case the implementation supports a deterministic size/pos mechanism, + * i.e. is able to determine the correct size/pos, + * it shall invalidate such values via the callbacks allowing the caller + * to wait until the values are reached - notified by the WM.<br> + * This is currently implemented for X11 and Windows.</p> * * @see #windowDestroyNotify() * @see #focusChanged(boolean) |