summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-26 16:45:45 +0100
committerSven Gothel <[email protected]>2011-11-26 16:45:45 +0100
commit0c7f98ddba346668d928b1b7e82a7c7899c72e19 (patch)
tree5db033a0906d3455a5adb3d1b0a4c2e8e90ae48d /src/nativewindow/classes/jogamp
parentb62d7b08212bdbae8d7755dafe4759dc61ace74a (diff)
X11Util: Remove wrapped/locked X11Lib methods
We shall lock a level above due to differentiation of XLockDisplay/RecursiveLock using X11/AWT ToolkitLock.
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTToolkitLock.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11ToolkitLock.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java219
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java4
6 files changed, 12 insertions, 228 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTToolkitLock.java
index 94a71f5e6..743d371b7 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTToolkitLock.java
@@ -28,6 +28,7 @@
package jogamp.nativewindow.jawt.x11;
import jogamp.nativewindow.jawt.*;
+import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
import javax.media.nativewindow.ToolkitLock;
@@ -57,7 +58,7 @@ public class X11JAWTToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("X11JAWTToolkitLock.lock() - native: "+(null==lock)); }
JAWTUtil.lockToolkit();
if(null == lock) {
- X11Util.XLockDisplay(displayHandle);
+ X11Lib.XLockDisplay(displayHandle);
} else {
lock.lock();
}
@@ -66,7 +67,7 @@ public class X11JAWTToolkitLock implements ToolkitLock {
public final void unlock() {
if(TRACE_LOCK) { System.err.println("X11JAWTToolkitLock.unlock() - native: "+(null==lock)); }
if(null == lock) {
- X11Util.XUnlockDisplay(displayHandle);
+ X11Lib.XUnlockDisplay(displayHandle);
} else {
lock.unlock();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
index 10b760a50..35dc2343f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
@@ -48,7 +48,7 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import jogamp.nativewindow.jawt.JAWTWindow;
import jogamp.nativewindow.jawt.JAWT_DrawingSurface;
import jogamp.nativewindow.jawt.JAWT_DrawingSurfaceInfo;
-import jogamp.nativewindow.x11.X11Util;
+import jogamp.nativewindow.x11.X11Lib;
public class X11JAWTWindow extends JAWTWindow {
@@ -126,7 +126,7 @@ public class X11JAWTWindow extends JAWTWindow {
}
protected Point getLocationOnScreenNativeImpl(int x, int y) {
- return X11Util.GetRelativeLocation( getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
+ return X11Lib.GetRelativeLocation( getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
// Variables for lockSurface/unlockSurface
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
index 0fd38631b..268416266 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
@@ -67,7 +67,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
int num[] = { -1 };
long display = screen.getDevice().getHandle();
- XVisualInfo[] xvis = X11Util.XGetVisualInfo(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0);
+ XVisualInfo[] xvis = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0);
if(xvis==null || num[0]<1) {
return null;
@@ -93,7 +93,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
vinfo_template.setC_class(c_class);
long display = screen.getDevice().getHandle();
- XVisualInfo[] vinfos = X11Util.XGetVisualInfo(display, X11Lib.VisualScreenMask, vinfo_template, num, 0);
+ XVisualInfo[] vinfos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, vinfo_template, num, 0);
XVisualInfo best=null;
int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits();
for (int i = 0; vinfos!=null && i < num[0]; i++) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11ToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11ToolkitLock.java
index 974211261..5166ef577 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11ToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11ToolkitLock.java
@@ -53,7 +53,7 @@ public class X11ToolkitLock implements ToolkitLock {
public final void lock() {
if(TRACE_LOCK) { System.err.println("X11ToolkitLock.lock() - native: "+(null==lock)); }
if(null == lock) {
- X11Util.XLockDisplay(displayHandle);
+ X11Lib.XLockDisplay(displayHandle);
} else {
lock.lock();
}
@@ -62,7 +62,7 @@ public class X11ToolkitLock implements ToolkitLock {
public final void unlock() {
if(TRACE_LOCK) { System.err.println("X11ToolkitLock.unlock() - native: "+(null==lock)); }
if(null == lock) {
- X11Util.XUnlockDisplay(displayHandle);
+ X11Lib.XUnlockDisplay(displayHandle);
} else {
lock.unlock();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index d1d8bcebe..94a47d0f7 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -40,13 +40,9 @@ import jogamp.nativewindow.NWJNILibLoader;
import javax.media.nativewindow.*;
-import java.nio.Buffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.util.Point;
/**
* Contains a thread safe X11 utility to retrieve display connections.
@@ -136,22 +132,6 @@ public class X11Util {
}
}
- public static void lockDefaultToolkit(long dpyHandle) {
- if(ToolkitLock.TRACE_LOCK) {
- System.out.println("+++ X11 Display lockDefaultToolkit [x11Lock: "+isX11LockAvailable+"] get 0x"+Long.toHexString(dpyHandle));
- }
- NativeWindowFactory.getDefaultToolkitLock().lock();
- X11Util.XLockDisplay(dpyHandle);
- }
-
- public static void unlockDefaultToolkit(long dpyHandle) {
- if(ToolkitLock.TRACE_LOCK) {
- System.out.println("+++ X11 Display lockDefaultToolkit [x11Lock: "+isX11LockAvailable+"] rel 0x"+Long.toHexString(dpyHandle));
- }
- X11Util.XUnlockDisplay(dpyHandle);
- NativeWindowFactory.getDefaultToolkitLock().unlock();
- }
-
public static String getNullDisplayName() {
if(null==nullDisplayName) { // volatile: ok
synchronized(X11Util.class) {
@@ -445,7 +425,7 @@ public class X11Util {
public static String validateDisplayName(String name, long handle) {
if( ( null==name || AbstractGraphicsDevice.DEFAULT_CONNECTION.equals(name) ) && 0!=handle) {
- name = XDisplayString(handle);
+ name = X11Lib.XDisplayString(handle);
}
return validateDisplayName(name);
}
@@ -493,203 +473,6 @@ public class X11Util {
}
}
- public static int XFree(Buffer arg0) {
- NativeWindowFactory.getDefaultToolkitLock().lock();
- try {
- return X11Lib.XFree(arg0);
- } finally {
- NativeWindowFactory.getDefaultToolkitLock().unlock();
- }
- }
-
- public static int XSync(long display, boolean discard) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XSync(display, discard);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static void XSynchronize(long display, boolean onoff) {
- lockDefaultToolkit(display);
- try {
- X11Lib.XSynchronize(display, onoff);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XineramaEnabled(long display) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XineramaEnabled(display);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static int DefaultScreen(long display) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.DefaultScreen(display);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static long RootWindow(long display, int screen_number) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.RootWindow(display, screen_number);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static long XCreatePixmap(long display, long arg1, int arg2, int arg3, int arg4) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XCreatePixmap(display, arg1, arg2, arg3, arg4);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static String XDisplayString(long display) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XDisplayString(display);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static int XFlush(long display) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XFlush(display);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static int XFreePixmap(long display, long arg1) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XFreePixmap(display, arg1);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static long DefaultVisualID(long display, int screen) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.DefaultVisualID(display, screen);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static long CreateDummyWindow(long display, int screen_index, long visualID, int width, int height) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.CreateDummyWindow(display, screen_index, visualID, width, height);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static void DestroyDummyWindow(long display, long window) {
- lockDefaultToolkit(display);
- try {
- X11Lib.DestroyDummyWindow(display, window);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static Point GetRelativeLocation(long display, int screen_index, long src_win, long dest_win, int src_x, int src_y) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.GetRelativeLocation(display, screen_index, src_win, dest_win, src_x, src_y);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static XVisualInfo[] XGetVisualInfo(long display, long arg1, XVisualInfo arg2, int[] arg3, int arg3_offset) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XGetVisualInfo(display, arg1, arg2, arg3, arg3_offset);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeGetGammaRamp(long display, int screen, int size, ShortBuffer red_array, ShortBuffer green_array, ShortBuffer blue_array) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeGetGammaRamp(display, screen, size, red_array, green_array, blue_array);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeGetGammaRamp(long display, int screen, int size, short[] red_array, int red_array_offset, short[] green_array, int green_array_offset, short[] blue_array, int blue_array_offset) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeGetGammaRamp(display, screen, size, red_array, red_array_offset, green_array, green_array_offset, blue_array, blue_array_offset);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeGetGammaRampSize(long display, int screen, IntBuffer size) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeGetGammaRampSize(display, screen, size);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeGetGammaRampSize(long display, int screen, int[] size, int size_offset) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeGetGammaRampSize(display, screen, size, size_offset);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeSetGammaRamp(long display, int screen, int size, ShortBuffer red_array, ShortBuffer green_array, ShortBuffer blue_array) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeSetGammaRamp(display, screen, size, red_array, green_array, blue_array);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static boolean XF86VidModeSetGammaRamp(long display, int screen, int size, short[] red_array, int red_array_offset, short[] green_array, int green_array_offset, short[] blue_array, int blue_array_offset) {
- lockDefaultToolkit(display);
- try {
- return X11Lib.XF86VidModeSetGammaRamp(display, screen, size, red_array, red_array_offset, green_array, green_array_offset, blue_array, blue_array_offset);
- } finally {
- unlockDefaultToolkit(display);
- }
- }
-
- public static void XLockDisplay(long handle) {
- X11Lib.XLockDisplay(handle);
- }
-
- public static void XUnlockDisplay(long handle) {
- X11Lib.XUnlockDisplay(handle);
- }
-
private static native boolean initialize0(boolean firstUIActionOnProcess);
private static native void shutdown0();
private static native void setX11ErrorHandler0(boolean onoff, boolean quiet);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
index a525b1859..efaf4728c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
@@ -33,7 +33,6 @@
package jogamp.nativewindow.x11.awt;
-import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -54,6 +53,7 @@ import javax.media.nativewindow.x11.X11GraphicsDevice;
import javax.media.nativewindow.x11.X11GraphicsScreen;
import jogamp.nativewindow.jawt.x11.X11SunJDKReflection;
+import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
@@ -102,7 +102,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
* some work, but some behave erratic.
* I.e. hangs in XQueryExtension(..) via X11GraphicsScreen.
*/
- final String displayName = X11Util.XDisplayString(displayHandle);
+ final String displayName = X11Lib.XDisplayString(displayHandle);
if(DEBUG) {
System.err.println(Thread.currentThread().getName() + " - X11AWTGraphicsConfigurationFactory: create X11 display @ "+displayName+" / 0x"+Long.toHexString(displayHandle));
}