summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index bb0b8c1aa..c3fb7d665 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -30,8 +30,10 @@ package jogamp.newt.swt.event;
import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.swt.SWTAccessor;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
@@ -359,15 +361,26 @@ public class SWTNewtEventFactory {
return false;
}
+ /**
+ * @throws SWTException If this method is not called
+ * {@link SWTAccessor#isOnSWTThread(org.eclipse.swt.widgets.Display) from the SWT thread},
+ * an {@link SWTException} is thrown for compliance across platforms.
+ * User may utilize {@link SWTAccessor#invokeOnSWTThread(org.eclipse.swt.widgets.Display, boolean, Runnable)}.
+ */
public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final NativeSurfaceHolder sourceHolder,
final com.jogamp.newt.event.MouseListener ml,
- final com.jogamp.newt.event.KeyListener kl) {
+ final com.jogamp.newt.event.KeyListener kl)
+ throws SWTException
+ {
if(null==ctrl) {
throw new IllegalArgumentException("Argument ctrl is null");
}
if(null==sourceHolder) {
throw new IllegalArgumentException("Argument source is null");
}
+ if( !SWTAccessor.isOnSWTThread( ctrl.getDisplay() ) ) {
+ throw new SWTException("Invalid thread access");
+ }
if( null != ml ) {
final Listener listener = new Listener () {