diff options
-rw-r--r-- | src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index e5c76f25d..e1a819e77 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -212,7 +212,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto if( isParent && !isFullscreen ) { // must be parent of newtChild _and_ newtChild not fullscreen if( isOnscreen ) { // Remove the AWT focus in favor of the native NEWT focus - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + AWTEDTExecutor.singleton.invoke(false, awtClearGlobalFocusOwner); } else { // In offscreen mode we require the focus! @@ -227,6 +227,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } private final FocusAction focusAction = new FocusAction(); + private static class ClearFocusOwner implements Runnable { + @Override + public void run() { + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + } + } + private static final Runnable awtClearGlobalFocusOwner = new ClearFocusOwner(); + /** Must run on AWT-EDT non-blocking, since it invokes tasks on AWT-EDT w/ waiting otherwise. */ private final Runnable awtClearSelectedMenuPath = new Runnable() { @Override |