From eab82899e93c0f72df6c7f4bfba5ad252a36013e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 12 Oct 2009 02:07:44 -0700 Subject: 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 .. --- .../impl/x11/X11GraphicsConfigurationFactory.java | 53 ++++++++++++++-------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'src/nativewindow/classes/com/sun') 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); + } } } -- cgit v1.2.3