JRE-480 Mac OS, Ubuntu+Gnome: caret disappears from editor after closing floating navigation bar
diff --git a/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
index e89a5d3..303c484 100644
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -258,9 +258,15 @@
// Focus the owner in case this window is focused.
} else if (kfmPeer.getCurrentFocusedWindow() == getTarget()) {
// Transfer focus to the owner.
- LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
- if (owner != null) {
- owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
+ Window targetOwner = LWWindowPeer.this.getTarget().getOwner();
+
+ if (targetOwner != null) {
+
+ LWWindowPeer owner = (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(targetOwner);
+
+ if (owner != null) {
+ owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
+ }
}
}
}
@@ -1176,36 +1182,41 @@
// Make the owner active window.
if (isSimpleWindow()) {
- focusLog.fine("This is a Simple Window.");
- LWWindowPeer owner = getOwnerFrameDialog(this);
+ focusLog.fine("This is a Simple Window.");
- // If owner is not natively active, request native
- // activation on it w/o sending events up to java.
- if (owner != null && !owner.platformWindow.isActive()) {
- if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
- focusLog.fine("requesting native focus to the owner " + owner);
- }
- LWWindowPeer currentActivePeer = currentActive == null ? null :
- (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(
- currentActive);
+ Window ownerTarget = getTarget().getOwner();
+ if (ownerTarget != null) {
- // Ensure the opposite is natively active and suppress sending events.
- if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
+ LWWindowPeer owner = (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(ownerTarget);
+
+ // If owner is not natively active, request native
+ // activation on it w/o sending events up to java.
+ if (owner != null && !owner.platformWindow.isActive()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
- focusLog.fine("the opposite is " + currentActivePeer);
+ focusLog.fine("requesting native focus to the owner " + owner);
}
- currentActivePeer.skipNextFocusChange = true;
+ LWWindowPeer currentActivePeer = currentActive == null ? null :
+ (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(
+ currentActive);
+
+ // Ensure the opposite is natively active and suppress sending events.
+ if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
+ if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
+ focusLog.fine("the opposite is " + currentActivePeer);
+ }
+ // currentActivePeer.skipNextFocusChange = true;
+ }
+ // owner.skipNextFocusChange = true;
+
+ owner.platformWindow.requestWindowFocus();
}
- owner.skipNextFocusChange = true;
- owner.platformWindow.requestWindowFocus();
+ // DKFM will synthesize all the focus/activation events correctly.
+ changeFocusedWindow(true, opposite);
+ focusLog.fine("DKFM will synthesize all the focus/activation events correctly");
+ return true;
}
- // DKFM will synthesize all the focus/activation events correctly.
- changeFocusedWindow(true, opposite);
- focusLog.fine("DKFM will synthesize all the focus/activation events correctly");
- return true;
-
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {