aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-27 18:20:37 +0100
committerSven Gothel <[email protected]>2012-02-27 18:20:37 +0100
commitb7407c39c0d3785f2fc21782d31c439622f0d744 (patch)
tree5ef1fc876f54e182fa8cdea0226f55783c324a2f /src/nativewindow/classes/jogamp
parentf519190f0cf97eb6b3fda61f4eb8c1f55de43b51 (diff)
NativeWindow: Relax Xinerama dependency / Rename Windows impl subfolder to common name win32 (same as stub_include)
Utilizing dlopen/dlsym in an efficient way relaxes the platform requirement of having Xinerama available. This allows using Nokia N9 MeeGo out of the box.
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java32
1 files changed, 32 insertions, 0 deletions
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);