diff options
author | Harvey Harrison <[email protected]> | 2013-11-18 10:54:35 -0800 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-11-18 11:08:40 -0800 |
commit | d544c839f6df10f20977c786a446833f3aa7ef13 (patch) | |
tree | 07bafc5fdfeba545947d3f2b5a81f42ce4e11dbd /src | |
parent | 0a9d16f057727652220a5983b65f22f427df6a22 (diff) |
jogl: do the clearGlobalFocusOwner() call on the AWT EDT in NewtCanvasAWT
Otherwise we can deadlock in the native focusrequest calls from the AWT thread,
see bug 879 for the details.
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-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 |