From 2aa8d4bbaf93c6bdf9188d9a88b5a28af43b112e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 31 Jan 2014 15:12:01 +0100 Subject: NEWT WindowImpl: Don't waitForPosition(..) if child window - issues w/ different toolkits! With Applet3 plugin (firefox - using GTK), our child window seems to receives the absolute position, or 'arbitrary' values (?). Will need to figure out how to properly determine these cases. In the meantime, simply turn off waitForPosition(..) for child windows, which shall not harm NEWT. Impacts following actions as child window: - createNativeWindow - reparent - fullscreen --- src/newt/classes/jogamp/newt/WindowImpl.java | 21 +++++++++++++-------- 1 file changed, 13 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 260ae4dd8..1e2291c8f 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -414,8 +414,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow); } + final boolean hasParent = null != parentWindow || 0 != this.parentWindowHandle; + // child window: position defaults to 0/0, no auto position, no negative position - if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) { + if( hasParent && ( autoPosition || 0>getX() || 0>getY() ) ) { definePosition(0, 0); } boolean postParentlockFocus = false; @@ -453,7 +455,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer fullScreenAction.init(true); fullScreenAction.run(); } - } else { + } else if ( !hasParent ) { // Wait until position is reached within tolerances, either auto-position or custom position. waitForPosition(usePosition, wX, wY, Window.TIMEOUT_NATIVEWINDOW); } @@ -1445,8 +1447,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer ok = WindowImpl.this.waitForSize(width, height, false, TIMEOUT_NATIVEWINDOW); } if(ok) { - // Position mismatch shall not lead to reparent failure - WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW); + if( 0 == parentWindowHandle ) { + // Position mismatch shall not lead to reparent failure + WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW); + } requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */); display.dispatchMessagesNative(); // status up2date @@ -2087,9 +2091,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(isNativeValid()) { // this.x/this.y will be set by sizeChanged, triggered by windowing event system reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible())); - - // Wait until custom position is reached within tolerances - waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW); + if( null == parentWindow ) { + // Wait until custom position is reached within tolerances + waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW); + } } else { definePosition(x, y); // set pos for createNative(..) } @@ -2261,7 +2266,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(ok) { ok = WindowImpl.this.waitForSize(w, h, false, TIMEOUT_NATIVEWINDOW); } - if(ok && !_fullscreen) { + if(ok && !_fullscreen && null == parentWindow) { // Position mismatch shall not lead to fullscreen failure WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW); } -- cgit v1.2.3