diff options
author | Sven Gothel <[email protected]> | 2013-02-21 14:22:10 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-21 14:22:10 +0100 |
commit | 405bc071d5d13e00d0561a485d31e3a7d61bf167 (patch) | |
tree | b9e83f5397fde2d810de0f2ed706ace979e1e364 /src/nativewindow | |
parent | fe0a2ad6f702aee71ea06f9da19ec9fd696d4095 (diff) |
TestNewtEventModifiers*: Robostness (uhh) Unify wait-clear result code - fix SWT event dispatching.
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index 5479f2495..5c4fd82d2 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -482,6 +482,23 @@ public class SWTAccessor { } } + /** + * Runs the specified action on the SWT UI thread. + * <p> + * If <code>display</code> is disposed or the current thread is the SWT UI thread + * {@link #invoke(boolean, Runnable)} is being used. + * @see #invoke(boolean, Runnable) + */ + public static void invoke(org.eclipse.swt.widgets.Display display, boolean wait, Runnable runnable) { + if( display.isDisposed() || Thread.currentThread() == display.getThread() ) { + invoke(wait, runnable); + } else if( wait ) { + display.syncExec(runnable); + } else { + display.asyncExec(runnable); + } + } + // // Specific X11 GTK ChildWindow - Using plain X11 native parenting (works well) // |