diff options
author | Sven Gothel <[email protected]> | 2010-10-27 02:16:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-27 02:16:28 +0200 |
commit | aed479890410e10031d96077a72a4cbdd621e6aa (patch) | |
tree | 2a7809d0fefb5b0a161f9affb3364e0051d52c1e | |
parent | b62cc2479c49d2a9913a297bcd0375e2351f7cba (diff) |
Minor: fix imports, JAWTUtil: query headless 1st (faster), NativeWindowFactory added nonAWT ToolkitLock create method
4 files changed, 17 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java index 99791b43e..225dc25a4 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java @@ -32,7 +32,6 @@ package com.jogamp.opengl.impl.x11.glx.awt; -import com.jogamp.nativewindow.impl.jawt.JAWTUtil; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import javax.media.nativewindow.*; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java index ff62c9521..9f120e9ab 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java @@ -40,7 +40,6 @@ import com.jogamp.nativewindow.impl.*; import javax.media.nativewindow.*; -import com.jogamp.common.util.locks.RecursiveLock; import java.awt.GraphicsEnvironment; import java.lang.reflect.*; @@ -178,13 +177,13 @@ public class JAWTUtil { } public static void lockToolkit() throws NativeWindowException { - if(!isJava2DQueueFlusherThread() && !headlessMode) { + if(!headlessMode && !isJava2DQueueFlusherThread()) { awtLock(); } } public static void unlockToolkit() { - if(!isJava2DQueueFlusherThread() && !headlessMode) { + if(!headlessMode && !isJava2DQueueFlusherThread()) { awtUnlock(); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index a269051b1..49b398b6f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -323,6 +323,18 @@ public abstract class NativeWindowFactory { return NativeWindowFactoryImpl.getNullToolkitLock(); } + public static ToolkitLock createDefaultToolkitLockNoAWT(String type, long deviceHandle) { + if( TYPE_X11 == type ) { + if( 0== deviceHandle ) { + throw new RuntimeException("JAWTUtil.createDefaultToolkitLockNoAWT() called with NULL device but on X11"); + } + if( !isFirstUIActionOnProcess() ) { + return createX11ToolkitLock(deviceHandle); + } + } + return NativeWindowFactoryImpl.getNullToolkitLock(); + } + protected static ToolkitLock createX11AWTToolkitLock(long deviceHandle) { try { return (ToolkitLock) x11JAWTToolkitLockConstructor.newInstance(new Object[]{new Long(deviceHandle)}); diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java index 7f315d785..a24d0953e 100644 --- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java +++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java @@ -35,7 +35,6 @@ package com.jogamp.newt.impl.x11; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; -import com.jogamp.newt.*; import com.jogamp.newt.impl.*; import com.jogamp.nativewindow.impl.x11.X11Util; @@ -77,6 +76,9 @@ public class X11Display extends DisplayImpl { throw e; } aDevice = new X11GraphicsDevice(handle, NativeWindowFactory.getNullToolkitLock()); + // aDevice = new X11GraphicsDevice(handle, NativeWindowFactory.createDefaultToolkitLockNoAWT(NativeWindowFactory.TYPE_X11, handle)); + // aDevice = new X11GraphicsDevice(handle); + } protected void closeNativeImpl() { |