From edbee9a1f34929e9bd3119bac88ab1c759c569a3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 16 Sep 2011 13:15:34 +0200 Subject: NEWT/WindowImpl: Remove wait for position (keep waitForSize for reparent/fullscreen) Window position is not deterministic enough and slows down processing while sync on it --- src/newt/classes/jogamp/newt/WindowImpl.java | 27 +++++----------------- src/newt/native/WindowsWindow.c | 4 ---- src/newt/native/X11Window.c | 4 ---- .../opengl/test/junit/newt/TestWindows01NEWT.java | 5 ++-- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 420e9d1fa..9d54954b0 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -273,18 +273,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new InternalError("XXX"); } if(canCreateNativeImpl()) { - int _x = x, _y = y; // orig req pos screen.addReference(); screenReferenceAdded = true; createNativeImpl(); screen.addScreenModeListener(screenModeListenerImpl); setTitleImpl(title); if(waitForVisible(true, false)) { - // 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, width, height, false, TIMEOUT_NATIVEWINDOW); if(isFullscreen()) { fullscreen = false; FullScreenActionImpl fsa = new FullScreenActionImpl(true); @@ -400,13 +394,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * The implementation should invoke the referenced java state callbacks * 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) * @see #visibleChanged(boolean) @@ -1127,7 +1114,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer ok = WindowImpl.this.waitForVisible(true, false); display.dispatchMessagesNative(); // status up2date if(ok) { - ok = WindowImpl.this.waitForPosSize(-1, -1, width, height, false, TIMEOUT_NATIVEWINDOW); + ok = WindowImpl.this.waitForSize(width, height, false, TIMEOUT_NATIVEWINDOW); } if(ok) { requestFocusImpl(true); @@ -1625,7 +1612,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer setVisibleImpl(true, x, y, w, h); WindowImpl.this.waitForVisible(true, false); display.dispatchMessagesNative(); // status up2date - WindowImpl.this.waitForPosSize(-1, -1, w, h, false, TIMEOUT_NATIVEWINDOW); + WindowImpl.this.waitForSize(w, h, false, TIMEOUT_NATIVEWINDOW); display.dispatchMessagesNative(); // status up2date requestFocusImpl(true); display.dispatchMessagesNative(); // status up2date @@ -2202,14 +2189,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - private boolean waitForPosSize(int x, int y, int w, int h, boolean failFast, long timeOut) { + private boolean waitForSize(int w, int h, boolean failFast, long timeOut) { DisplayImpl display = (DisplayImpl) screen.getDisplay(); - final boolean wpos = 0top + insets->bottom; // top-level DBG_PRINT("*** WindowsWindow: CreateWindow top-level %d/%d %dx%d\n", x, y, width, height); - if(userPos) { - // mark pos as undef, which cases java to wait for WM reported pos - (*env)->CallVoidMethod(env, wud->jinstance, positionChangedID, -1, -1); - } NewtWindow_setVisiblePosSize(window, TST_FLAG_IS_ALWAYSONTOP(flags), TRUE, x, y, width, height); } } diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 199caafad..30ff7f6f3 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -1664,10 +1664,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_X11Window_CreateWindow0 if(0>x) { x = 0; } if(0>y) { y = 0; } DBG_PRINT("X11: [CreateWindow]: top-level: %d/%d\n", x, y); - if(userPos) { - // mark pos as undef, which cases java to wait for WM reported pos - (*env)->CallVoidMethod(env, jwindow, positionChangedID, -1, -1); - } NewtWindows_setPosSize(dpy, window, x, y, width, height); if( TST_FLAG_IS_ALWAYSONTOP(flags) ) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java index 979f640e6..827dd09fb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java @@ -80,14 +80,15 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(width, window.getWidth()); Assert.assertEquals(height, window.getHeight()); - + + /** we don't sync on position - unreliable test Point p0 = window.getLocationOnScreen(null); Assert.assertEquals(p0.getX(), window.getX()); Assert.assertEquals(p0.getY(), window.getY()); if(userPos) { Assert.assertEquals(x, window.getX()); Assert.assertEquals(y, window.getY()); - } + } */ CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); Assert.assertNotNull(chosenCapabilities); -- cgit v1.2.3