summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-06 08:57:57 +0200
committerSven Gothel <[email protected]>2012-07-06 08:57:57 +0200
commitdfee8c58d4915f78f57545c26a492668b2b68a87 (patch)
treef3d12ef6c4595558379526801f27826cc0e17a56 /src/nativewindow/classes/com
parent627a27581688e0b12300370c751e3823b1afe44b (diff)
Fix SWT GLCanvas threading. Note: On OSX _only_ it's main thread is valid!
Diffstat (limited to 'src/nativewindow/classes/com')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
index f4309617b..735d85fb1 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
@@ -37,11 +37,13 @@ import org.eclipse.swt.widgets.Control;
import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeWindowFactory;
+
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice;
import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
+import jogamp.common.awt.AWTEDTExecutor;
import jogamp.nativewindow.macosx.OSXUtil;
public class SWTAccessor {
@@ -254,8 +256,25 @@ public class SWTAccessor {
});
}
+ /**
+ * Runs the specified action in an SWT compatible thread, which is:
+ * <ul>
+ * <li>Mac OSX
+ * <ul>
+ * <!--li>AWT EDT: In case AWT is available, the AWT EDT is the OSX UI main thread</li-->
+ * <li><i>Main Thread</i>: Run on OSX UI main thread.</li>
+ * </ul></li>
+ * <li>Linux, Windows, ..
+ * <ul>
+ * <li>Current thread.</li>
+ * </ul></li>
+ * </ul>
+ * @see Platform#AWT_AVAILABLE
+ * @see Platform#getOSType()
+ */
public static void invoke(boolean wait, Runnable runnable) {
- if(Platform.OS_TYPE == Platform.OSType.MACOS) {
+ if( Platform.OS_TYPE == Platform.OSType.MACOS ) {
+ // Use SWT main thread! Only reliable config w/ -XStartOnMainThread !?
OSXUtil.RunOnMainThread(wait, runnable);
} else {
runnable.run();