aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-25 00:12:17 +0100
committerSven Gothel <[email protected]>2011-11-25 00:12:17 +0100
commitc84e235b3284d0e18481748b44594116e25821a9 (patch)
treee18d64647e830132389ef675d85cef13a080380f /src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
parent3bc1ef8344ad44969ef436a0b98b0cde490a78fa (diff)
JOGL/NativeWindow: Push down JOGL's X11AWTGLXGraphicsConfigurationFactory to NativeWindow X11AWTGraphicsConfigurationFactory
X11AWTGraphicsConfigurationFactory properly construct a AWTGraphicsConfiguration encapsulated a native X11GraphicsConfiguration, now available for non JOGL modules, ie NEWT. AWTGraphicsConfiguration's create() utilizes the X11AWTGraphicsConfigurationFactory via the generic factory mechanism and hence allows encapsulating a native [X11]GraphicsConfiguration. NewtCanvasAWT creates/destroys the JAWT NativeWindow on addNotify/removeNotify (reparentWindow) again. Hence the JAWTWindow is instantiated completly only, instead of utilizing updateConfiguration(..), which simplifies the mechanism.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 2147287ba..c43bc7864 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -48,7 +48,6 @@ import javax.media.opengl.*;
import jogamp.opengl.*;
-import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.x11.*;
@@ -88,13 +87,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
X11GLXGraphicsConfigurationFactory.registerFactory();
- if(GLProfile.isAWTAvailable()) {
- try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.x11.glx.awt.X11AWTGLXGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
- } catch (JogampRuntimeException jre) { /* n/a .. */ }
- }
-
+
defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
// Init shared resources off thread
@@ -110,7 +103,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
SharedResourceImplementation sharedResourceImpl;
SharedResourceRunner sharedResourceRunner;
Thread sharedResourceThread;
- HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap();
+ HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
static class SharedResource implements SharedResourceRunner.Resource {
X11GraphicsDevice device;
@@ -156,23 +149,24 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) {
synchronized(sharedMap) {
- return (SharedResourceRunner.Resource) sharedMap.put(connection, resource);
+ return sharedMap.put(connection, resource);
}
}
public SharedResourceRunner.Resource mapGet(String connection) {
synchronized(sharedMap) {
- return (SharedResourceRunner.Resource) sharedMap.get(connection);
+ return sharedMap.get(connection);
}
}
- public Collection/*<Resource>*/ mapValues() {
+ public Collection<SharedResourceRunner.Resource> mapValues() {
synchronized(sharedMap) {
return sharedMap.values();
}
}
public SharedResourceRunner.Resource createSharedResource(String connection) {
- X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT);
- sharedDevice.setCloseDisplay(true);
+ X11GraphicsDevice sharedDevice =
+ new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
+ NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking
sharedDevice.lock();
try {
String glXVendorName = GLXUtil.getVendorName(sharedDevice.getHandle());
@@ -421,10 +415,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
final X11GraphicsScreen sharedScreen = (X11GraphicsScreen) sr.getScreen();
final AbstractGraphicsDevice sharedDevice = sharedScreen.getDevice(); // should be same ..
- // create screen/device pair
- X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(sharedDevice.getConnection()), AbstractGraphicsDevice.DEFAULT_UNIT);
- device.setCloseDisplay(true);
- X11GraphicsScreen screen = new X11GraphicsScreen(device, sharedScreen.getIndex());
+ // create screen/device pair - Null X11 locking, due to private non-shared Display handle
+ final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(sharedDevice.getConnection()), AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.getNullToolkitLock(), true);
+ final X11GraphicsScreen screen = new X11GraphicsScreen(device, sharedScreen.getIndex());
WrappedSurface ns = new WrappedSurface(
X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) );