8074481: [macosx] Menu items are appearing on top of other windows
authoranashaty
Mon, 30 Mar 2015 17:46:58 +0300
changeset 29884 013dd351eb8a
parent 29883 e02d168adbc6
child 29885 6eb60fac3383
8074481: [macosx] Menu items are appearing on top of other windows Reviewed-by: ant, serb
jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java
jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Mar 27 16:13:45 2015 -0500
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Mon Mar 30 17:46:58 2015 +0300
@@ -1296,6 +1296,12 @@
         }
 
         KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
+
+        if (!becomesFocused && kfmPeer.getCurrentFocusedWindow() != getTarget()) {
+            // late window focus lost event - ingoring
+            return;
+        }
+
         kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null);
 
         int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Mar 27 16:13:45 2015 -0500
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Mon Mar 30 17:46:58 2015 +0300
@@ -164,7 +164,7 @@
         }
         // ignore focus "lost" native request as it may mistakenly
         // deactivate active window (see 8001161)
-        if (globalFocusedWindow == this && parentWindowActive) {
+        if (globalFocusedWindow == this) {
             responder.handleWindowFocusEvent(parentWindowActive, null);
         }
     }