From d544c839f6df10f20977c786a446833f3aa7ef13 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Mon, 18 Nov 2013 10:54:35 -0800 Subject: 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 --- src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/newt/classes/com') 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 -- cgit v1.2.3