From de9a419a315d16edee2c5da74bbf7ea1f89bef30 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 9 Sep 2011 17:53:25 +0200 Subject: NEWT/Window: CreateWindow - Wait for user req. position: Fix about window-decoration/insets size --- src/newt/classes/jogamp/newt/WindowImpl.java | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/newt/classes') 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.
* + *

* 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.

+ * + *

+ * 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.
+ * This is currently implemented for X11 and Windows.

* * @see #windowDestroyNotify() * @see #focusChanged(boolean) -- cgit v1.2.3