diff options
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java | 3 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java | 32 |
2 files changed, 33 insertions, 2 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java index 6473b9f67..ed59861ca 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java @@ -65,8 +65,7 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl private static int fetchScreen(X11GraphicsDevice device, int screen) { // It still could be an AWT hold handle .. - long display = device.getHandle(); - if(X11Lib.XineramaEnabled(display)) { + if(X11Util.XineramaIsEnabled(device.getHandle())) { screen = 0; // Xinerama -> 1 screen } return screen; diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 7e5155771..4cbc1e367 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -485,6 +485,38 @@ public class X11Util { } } + static volatile boolean XineramaFetched = false; + static long XineramaLibHandle = 0; + static long XineramaQueryFunc = 0; + + public static boolean XineramaIsEnabled(long display) { + if(0==display) { + throw new IllegalArgumentException("Display NULL"); + } + if(!XineramaFetched) { // volatile: ok + synchronized(X11Util.class) { + if( !XineramaFetched ) { + XineramaLibHandle = X11Lib.XineramaGetLibHandle(); + if(0 != XineramaLibHandle) { + XineramaQueryFunc = X11Lib.XineramaGetQueryFunc(XineramaLibHandle); + } + XineramaFetched = true; + } + } + } + if(0!=XineramaQueryFunc) { + final boolean res = X11Lib.XineramaIsEnabled(XineramaQueryFunc, display); + if(DEBUG) { + System.err.println("XineramaIsEnabled: "+res); + } + return res; + } else if(DEBUG) { + System.err.println("XineramaIsEnabled: Couldn't bind to Xinerama - lib 0x"+Long.toHexString(XineramaLibHandle)+ + "query 0x"+Long.toHexString(XineramaQueryFunc)); + } + return false; + } + private static native boolean initialize0(boolean firstUIActionOnProcess); private static native void shutdown0(); private static native void setX11ErrorHandler0(boolean onoff, boolean quiet); |