aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/com
diff options
context:
space:
mode:
authorsg215889 <[email protected]>2009-07-24 07:29:28 -0700
committersg215889 <[email protected]>2009-07-24 07:29:28 -0700
commit0906140a18690a9dced8dec12dfdd8cf4c95a4df (patch)
tree52f67514b575a61aeba975fad00fd5ab60a52435 /src/nativewindow/classes/com
parent1f65dedf406455731fb682404a01c96aa85d5ae1 (diff)
Add: Extended support for CVM crosscompile:
- Clean up X11 dependency - NativeWindow: - Seperate X11 out of core. - Add nativewindow.x11.jar and nativewindow.x11.cdc.jar - Newt: - Seperate X11,win,osx out of core. - Add newt.x11.jar, newt.win.jar, newt.osx.jar and the CDC variants Fix: External Context & Drawable (X11 and Windows) - Properly fetch current context values (ctx, display, drawable, ..) - Create GraphicsConfiguration based on the given pixelformat/FBConfig Fix: Java2D OpenGL Usage - Using the external context as shared for the external drawable - JAWTUtil: Skip locking in case of OGL-Flush-Queue - TODO: Windows FBO still does not work .. (X11 is fine)
Diffstat (limited to 'src/nativewindow/classes/com')
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java9
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java44
2 files changed, 49 insertions, 4 deletions
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
index 46128b227..c7d2acec0 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
@@ -44,7 +44,6 @@ public class NullWindow implements NativeWindow {
protected long surfaceHandle, displayHandle;
protected AbstractGraphicsConfiguration config;
-
public NullWindow(AbstractGraphicsConfiguration cfg) {
invalidate();
config = cfg;
@@ -128,4 +127,12 @@ public class NullWindow implements NativeWindow {
public int getHeight() {
return height;
}
+
+ public String toString() {
+ return "NullWindow[config "+config+
+ ", displayHandle 0x"+Long.toHexString(getDisplayHandle())+
+ ", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+
+ ", size "+getWidth()+"x"+getHeight()+"]";
+ }
+
}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java
index af93b8c31..aac01e990 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java
@@ -41,19 +41,39 @@ import com.sun.nativewindow.impl.*;
import javax.media.nativewindow.*;
import java.awt.GraphicsEnvironment;
+import java.lang.reflect.*;
public class JAWTUtil {
+ // See whether we're running in headless mode
+ private static final boolean headlessMode;
+
+ // Java2D magic ..
+ private static final Class j2dClazz;
+ private static final Method isQueueFlusherThread;
+ private static final boolean j2dExist;
+
static {
JAWTNativeLibLoader.loadAWTImpl();
JAWTNativeLibLoader.loadNativeWindow("awt");
lockedStack = null;
headlessMode = GraphicsEnvironment.isHeadless();
- }
- // See whether we're running in headless mode
- private static final boolean headlessMode;
+ boolean ok=false;
+ Class jC=null;
+ Method m=null;
+ if(!headlessMode) {
+ try {
+ jC = Class.forName("com.sun.opengl.impl.awt.Java2D");
+ m = jC.getMethod("isQueueFlusherThread", null);
+ ok = true;
+ } catch (Exception e) {}
+ }
+ j2dClazz = jC;
+ isQueueFlusherThread = m;
+ j2dExist = ok;
+ }
private static Exception lockedStack;
@@ -61,11 +81,27 @@ public class JAWTUtil {
// ie loading the native libraries ..
public static void init() { }
+ public static final boolean hasJava2D() {
+ return j2dExist;
+ }
+
+ public static final boolean isJava2DQueueFlusherThread() {
+ boolean b = false;
+ if(j2dExist) {
+ try {
+ b = ((Boolean)isQueueFlusherThread.invoke(null, null)).booleanValue();
+ } catch (Exception e) {}
+ }
+ return b;
+ }
+
public static boolean isHeadlessMode() {
return headlessMode;
}
public static synchronized void lockToolkit() throws NativeWindowException {
+ if (isJava2DQueueFlusherThread()) return;
+
if (null!=lockedStack) {
lockedStack.printStackTrace();
throw new NativeWindowException("JAWT Toolkit already locked - "+Thread.currentThread().getName());
@@ -83,6 +119,8 @@ public class JAWTUtil {
}
public static synchronized void unlockToolkit() {
+ if (isJava2DQueueFlusherThread()) return;
+
if (null!=lockedStack) {
lockedStack = null;
if (headlessMode) {