< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page

        

@@ -1203,21 +1203,31 @@
         }
         return rootOwner;
     }
 
     private void orderAboveSiblings() {
+        CPlatformWindow rootOwner = getRootOwner();
+
+        // 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.
-        CPlatformWindow rootOwner = getRootOwner();
-        if (rootOwner.isVisible() && !rootOwner.isIconified()) {
+            if (rootOwner.isVisible()) {
             rootOwner.execute(CWrapper.NSWindow::orderFront);
         }
-        // Do not order child windows of iconified owner.
-        if (!rootOwner.isIconified()) {
-            final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
-            orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
+
+            // Order child windows.
+            orderAboveSiblingsImpl(windows);
         }
     }
 
     private void orderAboveSiblingsImpl(Window[] windows) {
         ArrayList<Window> childWindows = new ArrayList<Window>();
< prev index next >