8213983: [macosx] Keyboard shortcut “cmd +`” stops working properly if popup window is displayed
authordmarkov
Thu, 06 Dec 2018 13:32:15 +0000
changeset 52967 5adeed0d6311
parent 52966 7ed5edf6ba0c
child 52968 538b38d16d94
8213983: [macosx] Keyboard shortcut “cmd +`” stops working properly if popup window is displayed Reviewed-by: kaddepalli, serb
src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Dec 05 12:59:50 2018 -0800
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Dec 06 13:32:15 2018 +0000
@@ -1264,27 +1264,18 @@
     }
 
     private void orderAboveSiblings() {
+        // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
+        // the windows are ordered above their nearest owner; ancestors of the window,
+        // which is going to become 'main window', are placed above their siblings.
         CPlatformWindow rootOwner = getRootOwner();
+        if (rootOwner.isVisible() && !rootOwner.isIconified() && !rootOwner.isActive()) {
+            rootOwner.execute(CWrapper.NSWindow::orderFront);
+        }
 
         // Do not order child windows of iconified owner.
         if (!rootOwner.isIconified()) {
             final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
-            Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target);
-
-            // No need to order windows if it doesn't own other windows and hence return
-            if (windows.length == 0) {
-                return;
-            }
-
-            // Recursively pop up the windows from the very bottom, (i.e. root owner) so that
-            // the windows are ordered above their nearest owner; ancestors of the window,
-            // which is going to become 'main window', are placed above their siblings.
-            if (rootOwner.isVisible()) {
-                rootOwner.execute(CWrapper.NSWindow::orderFront);
-            }
-
-            // Order child windows.
-            orderAboveSiblingsImpl(windows);
+            orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
         }
     }