diff options
author | Sven Gothel <[email protected]> | 2009-06-17 13:26:29 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-06-17 13:26:29 +0000 |
commit | a92906bcb4ce4746f291d40a736949ec8476de61 (patch) | |
tree | 49708922895aa07bdc72b0513bb5e90f63ecedb2 /src/nativewindow/classes/com/sun | |
parent | 802288f8964affbda3460eea52df3d241ae3036a (diff) |
- 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
Diffstat (limited to 'src/nativewindow/classes/com/sun')
-rw-r--r-- | src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java | 21 | ||||
-rw-r--r-- | src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java | 38 |
2 files changed, 38 insertions, 21 deletions
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java index ae606a790..20e8cf966 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java @@ -43,21 +43,28 @@ import javax.media.nativewindow.*; import java.awt.GraphicsEnvironment; public class JAWTUtil { - static { - JAWTNativeLibLoader.loadAWTImpl(); - NativeLibLoaderBase.loadNativeWindow("awt"); - } - - // See whether we're running in headless mode - private static boolean headlessMode; static { + JAWTNativeLibLoader.loadAWTImpl(); + NativeLibLoaderBase.loadNativeWindow("awt"); + lockedStack = null; headlessMode = GraphicsEnvironment.isHeadless(); } + // See whether we're running in headless mode + private static final boolean headlessMode; + private static Exception lockedStack; + // Just a hook to let this class being initialized, + // ie loading the native libraries .. + public static void init() { } + + public static boolean isHeadlessMode() { + return headlessMode; + } + public static synchronized void lockToolkit() throws NativeWindowException { if (null!=lockedStack) { lockedStack.printStackTrace(); diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java b/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java index 731bd3caf..38d0fb73d 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java @@ -73,18 +73,23 @@ public class X11Util { private static ThreadLocal currentDisplayAssociation = new ThreadLocal(); - private static long staticDefaultDisplay=0; + private static volatile long staticDefaultDisplay=0; private static boolean staticDefaultDisplayXineramaEnable=false; private static long fetchStaticDefaultDisplay() { if(0==staticDefaultDisplay) { synchronized (X11Util.class) { if(0==staticDefaultDisplay) { - staticDefaultDisplay = X11Lib.XOpenDisplay(null); - if(0==staticDefaultDisplay) { - throw new NativeWindowException("Unable to create a static default display connection"); + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + staticDefaultDisplay = X11Lib.XOpenDisplay(null); + if(0==staticDefaultDisplay) { + throw new NativeWindowException("Unable to create a static default display connection"); + } + staticDefaultDisplayXineramaEnable = X11Lib.XineramaEnabled(staticDefaultDisplay); + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } - staticDefaultDisplayXineramaEnable = X11Lib.XineramaEnabled(staticDefaultDisplay); } } } @@ -109,15 +114,20 @@ public class X11Util { public static long getThreadLocalDefaultDisplay() { Long dpyL = (Long) currentDisplayAssociation.get(); if(null==dpyL) { - long dpy = X11Lib.XOpenDisplay(null); - if(0==dpy) { - throw new NativeWindowException("Unable to create a default display connection on Thread "+Thread.currentThread().getName()); - } - dpyL = new Long(dpy); - currentDisplayAssociation.set( dpyL ); - if(DEBUG) { - Exception e = new Exception("Created new TLS display connection 0x"+Long.toHexString(dpy)+" for thread "+Thread.currentThread().getName()); - e.printStackTrace(); + NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + try { + long dpy = X11Lib.XOpenDisplay(null); + if(0==dpy) { + throw new NativeWindowException("Unable to create a default display connection on Thread "+Thread.currentThread().getName()); + } + dpyL = new Long(dpy); + currentDisplayAssociation.set( dpyL ); + if(DEBUG) { + Exception e = new Exception("Created new TLS display connection 0x"+Long.toHexString(dpy)+" for thread "+Thread.currentThread().getName()); + e.printStackTrace(); + } + } finally { + NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock(); } } return dpyL.longValue(); |