summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-18 01:11:15 +0100
committerSven Gothel <[email protected]>2013-11-18 01:11:15 +0100
commit23697c7921039e9655a5760e21d7029598b679d7 (patch)
tree922e715e8b3d3648f2929786321193c3fd06cda1 /src/newt
parentd04ca826bc3ca95eb32921e59c1845a1626f88e6 (diff)
Fix Bug 879 Regression (2/2) - NewtCanvasAWT.FocusAction must take focus when in offscreen-mode (OSX/CALayer)
NewtCanvasAWT.FocusAction must take focus when in offscreen-mode (OSX/CALayer) since the NEWT window _is_ offscreen (no input events) and AWT events are translated to NEWT. Regression of commit 0be87f241c0f0b2f5881d9a602ce12378b8e453d
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 9611cc960..b8de1f596 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -190,9 +190,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusAction: "+Display.getThreadName()+", isOnscreen "+isOnscreen+", hasFocus "+hasFocus()+", isParent "+isParent+", isFS "+isFullscreen);
}
- if( isParent && !isFullscreen && isOnscreen ) {
- // Remove the AWT focus in favor of the native NEWT focus
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ 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();
+ } else if( !isOnscreen ) {
+ // In offscreen mode we require the focus!
+ if( !hasFocus() ) {
+ // Newt-EDT -> AWT-EDT may freeze Window's native peer requestFocus.
+ NewtCanvasAWT.super.requestFocus();
+ }
+ }
}
return false; // NEWT shall proceed requesting the native focus
}