aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-29 15:14:21 +0200
committerSven Gothel <[email protected]>2011-10-29 15:14:21 +0200
commit34ef2815dd0f4dc84f35fe5bf72ea876d4b9e882 (patch)
treeb79694f3104319ff7be9329511bf9fdbd9caf25d /src
parent6a770d1ec80a656db62feb8100e3fe58800e79af (diff)
parent48bc1b090b57eb8ec3cb2f9ff33b69c9d99704d7 (diff)
Merge branch 'master' into osx_jawt_calayers
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java2
-rw-r--r--src/nativewindow/native/macosx/OSXmisc.m10
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java49
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java8
5 files changed, 67 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index b7941c3bb..cd22127a3 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -204,7 +204,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
if ( isVendorATI() ) {
- final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), ".");
+ final VersionNumber winVersion = Platform.getOSVersionNumber();
final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
if(DEBUG) {
System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index af71b4a0a..e19d5ecf7 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -112,15 +112,19 @@ JNIEXPORT jobject JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetLocationOnS
}
NSScreen* screen = [win screen];
NSRect screenRect = [screen frame];
-
- NSRect viewFrame = [view frame];
+ NSRect winFrame = [win frame];
r.origin.x = src_x;
- r.origin.y = viewFrame.size.height - src_y; // y-flip for 0/0 top-left
+ r.origin.y = winFrame.size.height - src_y; // y-flip for 0/0 top-left
r.size.width = 0;
r.size.height = 0;
// NSRect rS = [win convertRectToScreen: r]; // 10.7
NSPoint oS = [win convertBaseToScreen: r.origin];
+ /**
+ NSLog(@"LOS.1: (bottom-left) %d/%d, screen-y[0: %d, h: %d], (top-left) %d/%d\n",
+ (int)oS.x, (int)oS.y, (int)screenRect.origin.y, (int) screenRect.size.height,
+ (int)oS.x, (int)(screenRect.origin.y + screenRect.size.height - oS.y)); */
+
dest_x = (int) oS.x;
dest_y = (int) screenRect.origin.y + screenRect.size.height - oS.y;
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index 38a3d952d..2e86cb512 100755
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -1,7 +1,9 @@
package com.jogamp.newt.awt.applet;
import java.applet.*;
+import java.awt.Component;
import java.awt.Container;
+import java.awt.Label;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.KeyListener;
@@ -12,6 +14,8 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import java.awt.BorderLayout;
+import jogamp.newt.Debug;
+
/**
* Simple GLEventListener deployment as an applet using JOGL. This demo must be
* referenced from a web page via an &lt;applet&gt; tag.
@@ -58,6 +62,8 @@ import java.awt.BorderLayout;
*/
@SuppressWarnings("serial")
public class JOGLNewtApplet1Run extends Applet {
+ public static final boolean DEBUG = Debug.debug("Applet");
+
GLWindow glWindow;
NewtCanvasAWT newtCanvasAWT;
JOGLNewtAppletBase base;
@@ -69,7 +75,7 @@ public class JOGLNewtApplet1Run extends Applet {
if(!(this instanceof Container)) {
throw new RuntimeException("This Applet is not a AWT Container");
}
- Container container = (Container) this; // have to think about that, we may use a Container
+ Container container = (Container) this;
String glEventListenerClazzName=null;
String glProfileName=null;
@@ -105,6 +111,24 @@ public class JOGLNewtApplet1Run extends Applet {
throw new RuntimeException("No applet parameter 'gl_event_listener_class'");
}
glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight;
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run Configuration:");
+ System.err.println("glStandalone: "+glStandalone);
+ if(glStandalone) {
+ System.err.println("pos-size: "+glXd+"/"+glYd+" "+glWidth+"x"+glHeight);
+ }
+ System.err.println("glEventListenerClazzName: "+glEventListenerClazzName);
+ System.err.println("glProfileName: "+glProfileName);
+ System.err.println("glSwapInterval: "+glSwapInterval);
+ System.err.println("glDebug: "+glDebug);
+ System.err.println("glTrace: "+glTrace);
+ System.err.println("glUndecorated: "+glUndecorated);
+ System.err.println("glAlwaysOnTop: "+glAlwaysOnTop);
+ System.err.println("glOpaque: "+glOpaque);
+ System.err.println("glAlphaBits: "+glAlphaBits);
+ System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer);
+ System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener);
+ }
base = new JOGLNewtAppletBase(glEventListenerClazzName,
glSwapInterval,
@@ -132,6 +156,12 @@ public class JOGLNewtApplet1Run extends Applet {
container.setLayout(new BorderLayout());
container.add(newtCanvasAWT, BorderLayout.CENTER);
}
+ if(DEBUG) {
+ container.add(new Label("North"), BorderLayout.NORTH);
+ container.add(new Label("South"), BorderLayout.SOUTH);
+ container.add(new Label("East"), BorderLayout.EAST);
+ container.add(new Label("West"), BorderLayout.WEST);
+ }
base.init(glWindow);
if(base.isValid()) {
GLEventListener glEventListener = base.getGLEventListener();
@@ -152,11 +182,26 @@ public class JOGLNewtApplet1Run extends Applet {
}
public void start() {
+ this.validate();
+ this.setVisible(true);
+
+ final java.awt.Point p0 = this.getLocationOnScreen();
if(glStandalone) {
glWindow.setSize(glWidth, glHeight);
- final java.awt.Point p0 = this.getLocationOnScreen();
glWindow.setPosition(p0.x+glXd, p0.y+glYd);
}
+ if(DEBUG) {
+ Component topC = this;
+ while (null != topC.getParent()) {
+ topC = topC.getParent();
+ }
+ System.err.println("TopComponent: "+topC.getLocation()+" rel, "+topC.getLocationOnScreen()+" screen, visible "+topC.isVisible()+", "+topC);
+ System.err.println("Applet Pos: "+this.getLocation()+" rel, "+p0+" screen, visible "+this.isVisible()+", "+this);
+ if(null != newtCanvasAWT) {
+ System.err.println("NewtCanvasAWT Pos: "+newtCanvasAWT.getLocation()+" rel, "+newtCanvasAWT.getLocationOnScreen()+" screen, visible "+newtCanvasAWT.isVisible()+", "+newtCanvasAWT);
+ }
+ System.err.println("GLWindow Pos: "+glWindow.getX()+"/"+glWindow.getY()+" rel, "+glWindow.getLocationOnScreen(null)+" screen");
+ }
base.start();
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index c6240d1f9..b1061dd14 100755
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -7,6 +7,8 @@ import java.security.PrivilegedAction;
import javax.media.nativewindow.NativeWindow;
import javax.media.opengl.*;
+import jogamp.newt.Debug;
+
import com.jogamp.opengl.util.*;
import com.jogamp.newt.event.*;
@@ -16,6 +18,8 @@ import com.jogamp.newt.opengl.GLWindow;
referenced from a web page via an &lt;applet&gt; tag. */
public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
+ public static final boolean DEBUG = Debug.debug("Applet");
+
String glEventListenerClazzName;
int glSwapInterval;
boolean noDefaultKeyListener;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
index 780b1690e..aded8f163 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
@@ -103,6 +103,10 @@ public class TestParenting03AWT extends UITestCase {
final Container cont1 = new Container();
cont1.setLayout(new BorderLayout());
+ cont1.add(new Label("iNORTH"), BorderLayout.NORTH);
+ cont1.add(new Label("iSOUTH"), BorderLayout.SOUTH);
+ cont1.add(new Label("iEAST"), BorderLayout.EAST);
+ cont1.add(new Label("iWEST"), BorderLayout.WEST);
cont1.add(newtCanvasAWT1, BorderLayout.CENTER);
System.err.println("******* Cont1 setVisible");
cont1.setVisible(true);
@@ -110,6 +114,10 @@ public class TestParenting03AWT extends UITestCase {
final Container cont2 = new Container();
cont2.setLayout(new BorderLayout());
if(use2nd) {
+ cont2.add(new Label("iNORTH"), BorderLayout.NORTH);
+ cont2.add(new Label("iSOUTH"), BorderLayout.SOUTH);
+ cont2.add(new Label("iEAST"), BorderLayout.EAST);
+ cont2.add(new Label("iWEST"), BorderLayout.WEST);
cont2.add(newtCanvasAWT2, BorderLayout.CENTER);
}
System.err.println("******* Cont2 setVisible");