From 66b19a72d52184ff4fa1951f7e5745ac9808275a Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 28 May 2006 21:33:14 +0000 Subject: 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 --- .../sun/opengl/impl/x11/X11GLDrawableFactory.java | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/classes') 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; -- cgit v1.2.3