summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java46
1 files changed, 9 insertions, 37 deletions
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<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 ) &&
@@ -2237,28 +2231,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return reached;
}
- private boolean waitForAnyPos(boolean failFast, long timeOut) {
- DisplayImpl display = (DisplayImpl) screen.getDisplay();
- boolean reached = false;
- for(long sleep = timeOut; !reached && 0<sleep; sleep-=10 ) {
- if( 0<=getX() && 0<=getY() ) {
- reached = true;
- } else {
- display.dispatchMessagesNative(); // status up2date
- try { Thread.sleep(10); } catch (InterruptedException ie) {}
- }
- }
- if(!reached) {
- final String msg = "Any Pos not reached as requested within "+timeOut+"ms : is "+getX()+"/"+getY();
- if(failFast) {
- throw new NativeWindowException(msg);
- } else if (DEBUG_IMPLEMENTATION) {
- System.err.println(msg);
- }
- }
- return reached;
- }
-
/** Triggered by implementation's WM events to update the position. */
protected void positionChanged(int newX, int newY) {
if ( x != newX || y != newY ) {