diff options
author | Sven Gothel <[email protected]> | 2010-04-22 23:37:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-22 23:37:12 +0200 |
commit | c9b12606cf57c4ef255d88a65eb713ff9167c6de (patch) | |
tree | d4b351a31413ed65665679d59321bb123a12694e /src/nativewindow/classes/javax | |
parent | c5513ba4d6a29cdc9f25863a8d6951beaae97409 (diff) | |
parent | d5b392ac40d8f7c65e76aca5673748cf24b8a1e8 (diff) |
Merge branch 'master' of github.com:mbien/jogl
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java index 69ace3c52..58b40efe0 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java @@ -57,13 +57,16 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl /** Creates a new X11GraphicsScreen using a thread local display connection */ public static AbstractGraphicsScreen createDefault() { NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); - long display = X11Util.createThreadLocalDefaultDisplay(); try { + long display = X11Util.createThreadLocalDefaultDisplay(); X11Lib.XLockDisplay(display); - int scrnIdx = X11Lib.DefaultScreen(display); - return createScreenDevice(display, scrnIdx); + try{ + int scrnIdx = X11Lib.DefaultScreen(display); + return createScreenDevice(display, scrnIdx); + }finally{ + X11Lib.XUnlockDisplay(display); + } } finally { - X11Lib.XUnlockDisplay(display); NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } } @@ -71,13 +74,16 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl public long getDefaultVisualID() { // It still could be an AWT hold handle .. NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); - long display = getDevice().getHandle(); try { + long display = getDevice().getHandle(); X11Lib.XLockDisplay(display); - int scrnIdx = X11Lib.DefaultScreen(display); - return X11Lib.DefaultVisualID(display, scrnIdx); + try{ + int scrnIdx = X11Lib.DefaultScreen(display); + return X11Lib.DefaultVisualID(display, scrnIdx); + }finally{ + X11Lib.XUnlockDisplay(display); + } } finally { - X11Lib.XUnlockDisplay(display); NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } } @@ -85,14 +91,17 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl private static int fetchScreen(X11GraphicsDevice device, int screen) { // It still could be an AWT hold handle .. NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); - long display = device.getHandle(); try { + long display = device.getHandle(); X11Lib.XLockDisplay(display); - if(X11Lib.XineramaEnabled(display)) { - screen = 0; // Xinerama -> 1 screen + try{ + if(X11Lib.XineramaEnabled(display)) { + screen = 0; // Xinerama -> 1 screen + } + }finally{ + X11Lib.XUnlockDisplay(display); } } finally { - X11Lib.XUnlockDisplay(display); NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } return screen; |