From a92906bcb4ce4746f291d40a736949ec8476de61 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 17 Jun 2009 13:26:29 +0000 Subject: - Add: GLProfile.get(name) return default if name=="GL" as well (or if null) - Add: NEWT pumpMessages/dispatchMessages - Handled by the Display implementation for all windows - Windows .. OK - MacOSX .. OK - X11 .. OK - Added Atom Property handling to attach java window object to window - Removed the eventMask for dispatching messages, since dispatching is for all windows now. (Wasn't impl. for all platforms anyways) - All init static code will funnel in the Display.initSingletion(), to ensure a proper init order for all platforms. - Display creation is unique for (name,thread). Handling a TLS mapping of display-names to Displays. - GLWindow: autoSwapBufferMode and eventHandlerMode are static members - Tested with experimental tagged GLWindow.setRunPumpMessages()/runCurrentThreadPumpMessage(), 1 thread - 4 windows, etc .. java demos.es2.RedSquare -1thread -onepump -GL2 -GL2 -GL2 -GL2 No benefit .. However .. the implementation is more correct now, due to the display/current-thread message pumping. - Fix: Window.sendMouseEvent() bounds check - Fix: MacWindow has proper nsView locking now, local to the window instance. locked in lockSurface besides general window manipulation. - Fix: JAWT utilized JAWTUtil.init() to init libraries - NativeLibLoaderBase.loadNativeWindow("awt") call was missing. (Visible on MacOSX + AWT) - Fix: GLXUtil proper locking - Fix: X11Util proper locking git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1976 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/impl/x11/glx/GLXUtil.java | 64 ++++++++++++---------- 1 file changed, 34 insertions(+), 30 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl/impl') diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java index b8968ee99..8ab99ac0a 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java @@ -51,40 +51,44 @@ public class GLXUtil { // Display connection for use by visual selection algorithm and by all offscreen surfaces private static boolean multisampleAvailable=false; - private static boolean isInit=false; + private static volatile boolean isInit=false; - private static void init() { + private static synchronized void init() { if (!isInit) { - NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); - try { - long staticDisplay = X11Util.getStaticDefaultDisplay(); - if(staticDisplay!=0) { - if (DEBUG) { - long display = staticDisplay; - int screen = X11Lib.DefaultScreen(display); - System.err.println("!!! GLX server vendor : " + - GLX.glXQueryServerString(display, screen, GLX.GLX_VENDOR)); - System.err.println("!!! GLX server version: " + - GLX.glXQueryServerString(display, screen, GLX.GLX_VERSION)); - System.err.println("!!! GLX client vendor : " + - GLX.glXGetClientString(display, GLX.GLX_VENDOR)); - System.err.println("!!! GLX client version: " + - GLX.glXGetClientString(display, GLX.GLX_VERSION)); + synchronized (GLXUtil.class) { + if (!isInit) { + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + long staticDisplay = X11Util.getStaticDefaultDisplay(); + if(staticDisplay!=0) { + if (DEBUG) { + long display = staticDisplay; + int screen = X11Lib.DefaultScreen(display); + System.err.println("!!! GLX server vendor : " + + GLX.glXQueryServerString(display, screen, GLX.GLX_VENDOR)); + System.err.println("!!! GLX server version: " + + GLX.glXQueryServerString(display, screen, GLX.GLX_VERSION)); + System.err.println("!!! GLX client vendor : " + + GLX.glXGetClientString(display, GLX.GLX_VENDOR)); + System.err.println("!!! GLX client version: " + + GLX.glXGetClientString(display, GLX.GLX_VERSION)); + } + String vendor = GLX.glXGetClientString(staticDisplay, GLX.GLX_VENDOR); + if (vendor != null && vendor.startsWith("ATI")) { + isVendorATI = true; + } + String exts = GLX.glXGetClientString(staticDisplay, GLX.GLX_EXTENSIONS); + if (exts != null) { + multisampleAvailable = (exts.indexOf("GLX_ARB_multisample") >= 0); + } + isInit=true; + } else { + throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling"); + } + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } - String vendor = GLX.glXGetClientString(staticDisplay, GLX.GLX_VENDOR); - if (vendor != null && vendor.startsWith("ATI")) { - isVendorATI = true; - } - String exts = GLX.glXGetClientString(staticDisplay, GLX.GLX_EXTENSIONS); - if (exts != null) { - multisampleAvailable = (exts.indexOf("GLX_ARB_multisample") >= 0); - } - isInit=true; - } else { - throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling"); } - } finally { - NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } } } -- cgit v1.2.3