diff options
author | Kenneth Russel <[email protected]> | 2006-05-28 21:33:14 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-05-28 21:33:14 +0000 |
commit | 66b19a72d52184ff4fa1951f7e5745ac9808275a (patch) | |
tree | f84d0a2b44dc280a3b978f31c4e06d0bfe5ca861 /src/classes/com/sun | |
parent | e1df17cd579e01e9350332cd63386384041ff7d3 (diff) |
Preliminary fix for
Issue 216: Cannot create GLCanvas on non-default GraphicsDevice
Made JOGL Xinerama-aware; now uses screen 0 rather than the screen
reported from the AWT GraphicsDevice when Xinerama is enabled. So far
only compiled and tested on non-Xinerama configuration on Linux; more
testing needed on Xinerama setups and on Solaris.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@782 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun')
-rw-r--r-- | src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java index 9ba591e5f..01141c121 100644 --- a/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java +++ b/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java @@ -111,7 +111,13 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { device = ((AWTGraphicsDevice) absDevice).getGraphicsDevice(); } - int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device); + int screen; + if (isXineramaEnabled()) { + screen = 0; + } else { + screen = X11SunJDKReflection.graphicsDeviceGetScreen(device); + } + // Until we have a rock-solid visual selection algorithm written // in pure Java, we're going to provide the underlying window // system's selection to the chooser as a hint @@ -520,12 +526,29 @@ public class X11GLDrawableFactory extends GLDrawableFactoryImpl { } } + //--------------------------------------------------------------------------- + // Xinerama-related functionality + // + + private boolean checkedXinerama; + private boolean xineramaEnabled; + protected synchronized boolean isXineramaEnabled() { + if (!checkedXinerama) { + checkedXinerama = true; + lockToolkit(); + long display = getDisplayConnection(); + xineramaEnabled = GLX.XineramaEnabled(display); + unlockToolkit(); + } + return xineramaEnabled; + } + //---------------------------------------------------------------------- // Gamma-related functionality // - boolean gotGammaRampLength; - int gammaRampLength; + private boolean gotGammaRampLength; + private int gammaRampLength; protected synchronized int getGammaRampLength() { if (gotGammaRampLength) { return gammaRampLength; |