From 85f60adb5ae675af4bf81c0a7e69ec836aa50a4b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 16 Sep 2011 10:57:08 +0200 Subject: waitForPosSize/createWindow: exclude 0/0, at creation wait for size as well - 0/0 may result in -1/-1, which is impl. specific (X11), might get deleted if causes more harm than ham - waiting for size after creation is actually a good thing todo --- src/newt/classes/jogamp/newt/WindowImpl.java | 46 ++++++---------------------- 1 file changed, 9 insertions(+), 37 deletions(-) (limited to 'src/newt') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 8bc6d01ac..dd8752613 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -258,14 +258,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private boolean createNative() { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.createNative() START ("+getThreadName()+", "+this+")"); - } - final boolean userPos = 0<=x && 0<=y; // user has specified a position - + } if( null != parentWindow && NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindow.lockSurface() ) { throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow); } - if( !userPos && ( isUndecorated() || null != parentWindow ) ) { + if( ( 0>x || 0>y ) && ( isUndecorated() || null != parentWindow ) ) { // default child/undecorated window position is 0/0, if not set by user x = 0; y = 0; } @@ -282,15 +280,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer screen.addScreenModeListener(screenModeListenerImpl); setTitleImpl(title); 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); - } + // 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); @@ -2213,8 +2207,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private boolean waitForPosSize(int x, int y, int w, int h, boolean failFast, long timeOut) { DisplayImpl display = (DisplayImpl) screen.getDisplay(); - final boolean wpos = x>=0 && y>=0; - final boolean wsiz = w>0 && h>0; + final boolean wpos = 0