diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java | 9 | ||||
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java | 39 |
2 files changed, 27 insertions, 21 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java index 83f671cb4..7b59a8d56 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java @@ -288,10 +288,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // FBConfig - // sgothel: The synchronized was added, due to bugs within the GLX implementation on my platform - // in regards to multithreading (FIXME). - - public synchronized static GLCapabilities GLXFBConfig2GLCapabilities(GLProfile glp, long display, long fbcfg, boolean isMultisampleEnabled) { + public static GLCapabilities GLXFBConfig2GLCapabilities(GLProfile glp, long display, long fbcfg, boolean isMultisampleEnabled) { int[] tmp = new int[1]; int val; val = glXGetFBConfig(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp, 0); @@ -336,7 +333,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - private synchronized static String glXGetFBConfigErrorCode(int err) { + private static String glXGetFBConfigErrorCode(int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; @@ -344,7 +341,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - public synchronized static int glXGetFBConfig(long display, long cfg, int attrib, int[] tmp, int tmp_offset) { + public static int glXGetFBConfig(long display, long cfg, int attrib, int[] tmp, int tmp_offset) { if (display == 0) { throw new GLException("No display connection"); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index d12c43230..e1e8970f4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -127,11 +127,12 @@ public abstract class NativeWindowFactory { } catch (Exception e) { } } - boolean toolkitLockDisabled = Boolean.getBoolean("java.awt.headless"); - - if( !toolkitLockDisabled && TYPE_X11.equals(nativeWindowingTypeCustom) ) { - NativeWindowFactory _factory = null; + boolean toolkitLockForced = Boolean.getBoolean("nativewindow.locking"); + boolean awtToolkitLockDisabled = Boolean.getBoolean("java.awt.headless"); + NativeWindowFactory _factory = null; + + if( !awtToolkitLockDisabled && null!=componentClass && TYPE_X11.equals(nativeWindowingTypeCustom) ) { // There are certain operations that may be done by // user-level native code which must share the display // connection with the underlying window toolkit. In JOGL, @@ -177,17 +178,23 @@ public abstract class NativeWindowFactory { // toolkits like Newt even when running on Java SE when // the AWT is available. - if (componentClass != null) { - try { - Constructor factoryConstructor = - NWReflection.getConstructor("com.sun.nativewindow.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {}); - _factory = (NativeWindowFactory) factoryConstructor.newInstance(null); - } catch (Exception e) { } - } + try { + Constructor factoryConstructor = + NWReflection.getConstructor("com.sun.nativewindow.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {}); + _factory = (NativeWindowFactory) factoryConstructor.newInstance(null); + } catch (Exception e) { } + } - if (null !=_factory) { - factory = _factory; - } + if (toolkitLockForced && null==_factory) { + try { + Constructor factoryConstructor = + NWReflection.getConstructor("com.sun.nativewindow.impl.LockingNativeWindowFactory", new Class[] {}); + _factory = (NativeWindowFactory) factoryConstructor.newInstance(null); + } catch (Exception e) { } + } + + if (null !=_factory) { + factory = _factory; } if(null!=componentClass) { @@ -195,8 +202,10 @@ public abstract class NativeWindowFactory { registerFactory(componentClass, factory); } defaultFactory = factory; + if(DEBUG) { - System.err.println("NativeWindowFactory defaultFactory "+factory); + System.err.println("NativeWindowFactory toolkitLockForced "+toolkitLockForced+ + ", awtToolkitLockDisabled "+awtToolkitLockDisabled+", defaultFactory "+factory); } } |