diff options
author | Sven Gothel <[email protected]> | 2009-10-10 04:24:26 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-10 04:24:26 -0700 |
commit | 2268a6ce8a900ae7aa9f20d5f595f811185574a9 (patch) | |
tree | b4426ed20e1957bd5cba095d5a036df2bbc1736a /src/nativewindow/classes/com/sun | |
parent | 20c6d89bfc4f72144b8bcc48839da7ef9bc40681 (diff) |
NEWT: Add EventDispatchThread (EDT) pattern.
Due to limitations on Windows,
we need to standardize the one thread for
- window creation, and
- event dispatching
This was already mentioned in the previous implementation
but while integrating into another threading model (Plugin3),
it turned out that manual managing the thread is too much of a burden.
NEWT now uses a EDT per Display and Thread as the default,
where Display creation, Window creation and event dispatching is 'pipelined' into.
This can be switched off:
NewtFactory.setUseEDT(boolean onoff);
and queried via:
NewtFactory.useEDT();
Note this EDT impl. does not implicate a global lock or whatsoever.
The experimantal semantics of a current GL context
for input event dispatching is removed,
i.e. the GL context is no more made current for mouse/key listener.
This reduces the complexity and allows the proper impl. of
the external dispatch via EDT .. for example.
Removed:
GLWindow: setEventHandlerMode(int) .. etc
X11Display: XLockDisplay/XUnlockDisplay
needed to be utilized to allow the new
multithreading (EDT/Render) Display usage.
X11Window: lockSurface/unlockSurface
locks X11Display as well ..
+++++
NEWT: 'getSurfaceHandle()' semantics changed.
To allow usage of the surfaceHandle for OS
where it is allocated thread local (MS-Windows),
it shall be aquired/released while lockSurface/unlockSurface.
This is done in the Windows Window implementation.
GLWindow can no more query 'getSurfaceHandle()'
to verify if 'setRealized()' was successful.
NEWT: Window surface lock is recursive and blocking now,
as it shall be.
Diffstat (limited to 'src/nativewindow/classes/com/sun')
-rw-r--r-- | src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java index e821f9b3a..b0548bb14 100644 --- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java @@ -94,11 +94,13 @@ public abstract class JAWTWindow implements NativeWindow { private volatile Exception lockedStack = null; public synchronized int lockSurface() throws NativeWindowException { - // We have to be the owner of the JAWT ToolkitLock 'lock' to benefit from the - // recursive lock capabitlites. Otherwise a followup ToolkitLock would - // deadlock, since we already have locked JAWT with the surface lock. + // We have to be the owner of the JAWT ToolkitLock 'lock' to benefit from it's + // recursive and blocking lock capabitlites. + // Otherwise a followup ToolkitLock would deadlock, + // since we already have locked JAWT with the surface lock. NativeWindowFactory.getDefaultFactory().getToolkitLock().lock(); + // recursion not necessary here, due to the blocking ToolkitLock .. if (null!=lockedStack) { lockedStack.printStackTrace(); throw new NativeWindowException("JAWT Surface already locked - "+Thread.currentThread().getName()+" "+this); |