aboutsummaryrefslogtreecommitdiff
path: root/src/macosx
diff options
context:
space:
mode:
authorDenis Fokin <denis.fokin@jetbrains.com>2017-09-20 20:41:21 +0300
committerDenis Fokin <denis.fokin@jetbrains.com>2017-09-20 20:41:39 +0300
commit8e21f36d4dbda9b17a0c91c91296e81471a47c64 (patch)
treeb7ce5871ed9f143120fcdcf2fbc87d59a7d5b78e /src/macosx
parent30c7ebeb68bba63e9c1045777366deee9af1ba7f (diff)
downloadjdk8u_jdk-8e21f36d4dbda9b17a0c91c91296e81471a47c64.tar.gz
JRE-480 Mac OS, Ubuntu+Gnome: caret disappears from editor after closing floating navigation barjb8u152-b1020
Diffstat (limited to 'src/macosx')
-rw-r--r--src/macosx/classes/sun/lwawt/LWWindowPeer.java63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
index e89a5d3424..303c484280 100644
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -258,9 +258,15 @@ public class LWWindowPeer
// 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 @@ public class LWWindowPeer
// Make the owner active window.
if (isSimpleWindow()) {
- focusLog.fine("This is a Simple Window.");
- LWWindowPeer owner = getOwnerFrameDialog(this);
-
- // 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);
+ focusLog.fine("This is a Simple Window.");
+
+ Window ownerTarget = getTarget().getOwner();
+ if (ownerTarget != null) {
+
+ LWWindowPeer owner = (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(ownerTarget);
- // Ensure the opposite is natively active and suppress sending events.
- if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
+ // 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()) {