From bd79528f54cea5b20b1c22e7662c3e064be3f079 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 31 Jan 2014 11:00:35 +0100 Subject: Adapt to new plugin3 / Use browser window's location on screen for top-level window. --- .../newt/util/applet/JOGLNewtApplet3Run.java | 64 ++++++++++++++-------- .../jogamp/newt/util/applet/VersionApplet3.java | 16 +++++- 2 files changed, 56 insertions(+), 24 deletions(-) (limited to 'src/newt/classes/com/jogamp') diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java index 465ee4df5..b8b69f631 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java @@ -39,11 +39,12 @@ import javax.media.nativewindow.AbstractGraphicsScreen; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowFactory; import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; +import javax.media.nativewindow.util.PointImmutable; import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; -import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; +import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSizePos; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Window; import com.jogamp.newt.opengl.GLWindow; @@ -102,6 +103,9 @@ public class JOGLNewtApplet3Run implements Applet3 { int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE; Applet3Context ctx; boolean glStandalone = false; + UpstreamSurfaceHookMutableSizePos upstreamSizePosHook; + PointImmutable upstreamLocOnScreen; + NativeWindow browserWin; final String getParameter(String name) { return ctx.getParameter(name); @@ -132,38 +136,43 @@ public class JOGLNewtApplet3Run implements Applet3 { e.printStackTrace(); } glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight; + final GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); + caps.setAlphaBits(glAlphaBits); + if(0glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight; if(DEBUG) { System.err.println("JOGLNewtApplet1Run Configuration:"); System.err.println("glEventListenerClazzName: "+glEventListenerClazzName); @@ -283,7 +299,7 @@ public class JOGLNewtApplet3Run implements Applet3 { } if( glStandalone ) { glWindow.setSize(glWidth, glHeight); - glWindow.setPosition(glXd, glYd); + glWindow.setPosition(upstreamLocOnScreen.getX()+glXd, upstreamLocOnScreen.getY()+glYd); glWindow.setVisible(true); glWindow.requestFocus(); } @@ -318,6 +334,8 @@ public class JOGLNewtApplet3Run implements Applet3 { base.destroy(); // destroy glWindow unrecoverable base=null; glWindow=null; + browserWin.destroy(); // make sure the open display connection gets closed! + browserWin = null; if(DEBUG) { System.err.println("JOGLNewtApplet1Run.destroy() END - "+currentThreadName()); } diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java index 90c8c3572..db0e8fc45 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java @@ -53,7 +53,14 @@ public class VersionApplet3 implements Applet3 { public void notifySurfaceUpdated(NativeWindowDownstream swappedWin) { // NOP } - + @Override + public int getX() { + return 0; + } + @Override + public int getY() { + return 0; + } }); va.init(null); va.start(); @@ -120,6 +127,13 @@ public class VersionApplet3 implements Applet3 { canvas.display(); } } + + @Override + public void notifyPositionChanged(NativeWindowUpstream nw) { + if( null != canvas ) { + canvas.setPosition(nw.getX(), nw.getY()); + } + } }; } -- cgit v1.2.3