Skip to content

Commit

Permalink
NEWT Reparent/Fullscreen: Add 'waitForPosition(..)' when reparenting …
Browse files Browse the repository at this point in the history
…or back from fullscreen; JOGLNewtAppletBase: Reparent to pos 32/32, trying to avoid browser window focus/top stealing on X11.
  • Loading branch information
sgothel committed Oct 9, 2013
1 parent 364af76 commit e96b2d6
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 29 deletions.
1 change: 1 addition & 0 deletions make/scripts/make.jogl.all.macosx-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ -e /opt-share/etc/profile.ant ] ; then
fi

JAVA_HOME=`/usr/libexec/java_home -version 1.7`
#JAVA_HOME=`/usr/libexec/java_home -version 1.6`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH

Expand Down
22 changes: 0 additions & 22 deletions make/scripts/make.jogl.all.macosx-java7.sh

This file was deleted.

1 change: 1 addition & 0 deletions make/scripts/make.jogl.all.macosx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ -e /opt-share/etc/profile.ant ] ; then
fi

JAVA_HOME=`/usr/libexec/java_home -version 1.7`
#JAVA_HOME=`/usr/libexec/java_home -version 1.6`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH

Expand Down
4 changes: 2 additions & 2 deletions make/scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
Expand Down Expand Up @@ -456,7 +456,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos01AWT $*
testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cAWT $*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.opengl.FPSCounter;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
Expand Down Expand Up @@ -301,7 +302,17 @@ public void keyPressed(KeyEvent e) {
if(null == glWindow.getParent()) {
glWindow.reparentWindow(awtParent);
} else {
glWindow.reparentWindow(null);
final InsetsImmutable insets = glWindow.getInsets();
final int x, y;
if ( 0 >= insets.getTopHeight() ) {
// fail safe ..
x = 32;
y = 32;
} else {
x = insets.getLeftWidth();
y = insets.getTopHeight();
}
glWindow.reparentWindow(null, x, y, false /* forceDestroyCreate */);
glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE );
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/newt/classes/jogamp/newt/WindowImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,9 @@ private void reparent() {
if(ok) {
ok = WindowImpl.this.waitForSize(width, height, false, TIMEOUT_NATIVEWINDOW);
}
if(ok) {
ok = WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW);
}
if(ok) {
requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
display.dispatchMessagesNative(); // status up2date
Expand Down Expand Up @@ -1375,7 +1378,7 @@ private void reparent() {
}

if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparentWindow: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
} finally {
if(null!=lifecycleHook) {
Expand All @@ -1399,7 +1402,7 @@ private void reparent() {
}
}
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparentWindow: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
}
}
Expand All @@ -1410,7 +1413,7 @@ public final void run() {
_lock.lock();
try {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparentWindow: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCodeNullSafe(parentWindow));
System.err.println("Window.reparent: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCodeNullSafe(parentWindow));
}
setVisibleActionImpl(true); // native creation
requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
Expand Down Expand Up @@ -2020,6 +2023,9 @@ public final void run() {
if(ok) {
ok = WindowImpl.this.waitForSize(w, h, false, TIMEOUT_NATIVEWINDOW);
}
if(ok && !fullscreen) {
ok = WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW);
}
if(ok) {
requestFocusInt(fullscreen /* skipFocusAction if fullscreen */);
display.dispatchMessagesNative(); // status up2date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Button;

import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLCapabilities;
Expand Down

0 comments on commit e96b2d6

Please sign in to comment.