diff options
author | Sven Gothel <[email protected]> | 2012-01-16 21:23:42 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-01-16 21:23:42 +0100 |
commit | 73d6ec97e65743b49770cf13709082c80b77b935 (patch) | |
tree | 228953afe5b6f357f30a1c047d830919bf61ffbd /src/newt/classes/jogamp | |
parent | 10e77e2af4448c3404becdd2ce359a3f34a91f5c (diff) |
NewtCanvasAWT: Handle 'lost' child and fullscreen case.
NewtCanvasAWT may loose it's parent role (reparenting).
In such cases it shall no more handle focus events.
Focus handling is also no more desired in case the child is in fullscreen mode.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 8e9c028d4..ce8ed7c49 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -30,6 +30,8 @@ package jogamp.newt.awt.event; import java.awt.KeyboardFocusManager; +import javax.media.nativewindow.NativeWindow; + import jogamp.newt.driver.DriverUpdatePosition; import com.jogamp.newt.event.awt.AWTAdapter; @@ -43,8 +45,11 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener { - public AWTParentWindowAdapter(com.jogamp.newt.Window downstream) { + NativeWindow downstreamParent; + + public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) { super(downstream); + this.downstreamParent = downstreamParent; } public AWTAdapter addTo(java.awt.Component awtComponent) { @@ -61,13 +66,17 @@ public class AWTParentWindowAdapter // forward focus to NEWT child final com.jogamp.newt.Window newtChild = getNewtWindow(); final boolean isOnscreen = newtChild.isNativeValid() && newtChild.getGraphicsConfiguration().getChosenCapabilities().isOnscreen(); + final boolean isParent = downstreamParent == newtChild.getParent(); + final boolean isFullscreen = newtChild.isFullscreen(); if(DEBUG_IMPLEMENTATION) { - System.err.println("AWT: focusGained: onscreen "+ isOnscreen+", "+e); + System.err.println("AWT: focusGained: onscreen "+ isOnscreen+", "+e+", isParent: "+isParent+", isFS "+isFullscreen); } - if(isOnscreen) { - KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + if(isParent) { + if(isOnscreen && !isFullscreen) { + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + } + newtChild.requestFocus(false); } - newtChild.requestFocus(false); } public void focusLost(java.awt.event.FocusEvent e) { |