aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-12 02:07:44 -0700
committerSven Gothel <[email protected]>2009-10-12 02:07:44 -0700
commiteab82899e93c0f72df6c7f4bfba5ad252a36013e (patch)
tree33ab60783b2701f405271c734fd608b15600b4e0 /src/nativewindow/classes/com/sun
parent7a2103506ba9e570737da6af4e156c3bf06fe765 (diff)
X11 Display Lock completed (hope so)
- JOGL GLXUtil - JOGL X11GLXDrawableFactory - JOGL X11GLXGraphicsConfigurationFactory - JOGL X11OffscreenGLXDrawable - NW X11GraphicsConfigurationFactory NEWT Display - Stop EDT immediatly from within EDT when destroying - NEWT Window - Remove obsolete 'disposeSurfaceHandle()' NEWT GLWindow destroy(): - Deep destruction (Window, Screen and Display) if owner, otherwise just the GLWindow/GLDrawable - Add 'sendDisposeEvent' flag, to allow avoiding sending dispose to all GLEventListeners in a critical shutdown, ie from within the browser. NEWT EDT - More fine grained locking - unlocked while event dispatching - double check locking - Fixed cases where we are running on the EDT ..
Diffstat (limited to 'src/nativewindow/classes/com/sun')
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java53
1 files changed, 33 insertions, 20 deletions
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
index 890f017ab..d6abf291f 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
@@ -56,14 +56,21 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
xvi_temp.visualid(visualID);
xvi_temp.screen(screen.getIndex());
int num[] = { -1 };
+ long display = screen.getDevice().getHandle();
- XVisualInfo[] xvis = X11Lib.XGetVisualInfoCopied(screen.getDevice().getHandle(), X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0);
+ try {
+ X11Lib.XLockDisplay(display);
+ XVisualInfo[] xvis = X11Lib.XGetVisualInfoCopied(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0);
- if(xvis==null || num[0]<1) {
- return null;
+ if(xvis==null || num[0]<1) {
+ return null;
+ }
+
+ return XVisualInfo.create(xvis[0]);
+ } finally {
+ X11Lib.XUnlockDisplay(display);
}
- return XVisualInfo.create(xvis[0]);
}
public static XVisualInfo getXVisualInfo(AbstractGraphicsScreen screen, Capabilities capabilities)
@@ -81,25 +88,31 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
XVisualInfo vinfo_template = XVisualInfo.create();
vinfo_template.screen(screen.getIndex());
vinfo_template.c_class(c_class);
+ long display = screen.getDevice().getHandle();
- XVisualInfo[] vinfos = X11Lib.XGetVisualInfoCopied(screen.getDevice().getHandle(), 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++) {
- if ( best == null ||
- best.depth() < vinfos[i].depth() )
- {
- best = vinfos[i];
- if(rdepth <= best.depth())
- break;
+ try {
+ X11Lib.XLockDisplay(display);
+ XVisualInfo[] vinfos = X11Lib.XGetVisualInfoCopied(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++) {
+ if ( best == null ||
+ best.depth() < vinfos[i].depth() )
+ {
+ best = vinfos[i];
+ if(rdepth <= best.depth())
+ break;
+ }
}
- }
- if ( null!=best && ( rdepth <= best.depth() || 24 == best.depth()) ) {
- ret = XVisualInfo.create(best);
- }
- best = null;
+ if ( null!=best && ( rdepth <= best.depth() || 24 == best.depth()) ) {
+ ret = XVisualInfo.create(best);
+ }
+ best = null;
- return ret;
+ return ret;
+ } finally {
+ X11Lib.XUnlockDisplay(display);
+ }
}
}