diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 27 | ||||
-rw-r--r-- | src/newt/native/WindowsWindow.c | 4 | ||||
-rw-r--r-- | src/newt/native/X11Window.c | 4 | ||||
-rw-r--r-- | src/test/com/jogamp/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.</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) * @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 = 0<x && 0<y ; // 0/0 maybe be -1/-1 (at least X11) - final boolean wsiz = 0<w && 0<h; boolean reached = false; for(long sleep = timeOut; !reached && 0<sleep; sleep-=10 ) { - if( ( wpos && x==getX() && y==getY() || !wpos ) && - ( wsiz && w==getWidth() && h==getHeight() || !wsiz ) ) { + if( w==getWidth() && h==getHeight() ) { // reached pos/size reached = true; } else { @@ -2218,11 +2202,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(!reached) { - final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+x+"/"+y+" "+w+"x"+h+", is "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight(); + final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getWidth()+"x"+getHeight(); if(failFast) { throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { System.err.println(msg); + Thread.dumpStack(); } } return reached; diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 43a5e8459..8402373b3 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -1411,10 +1411,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowsWindow_CreateWind height += insets->top + 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); |