changeset 3778:f66302f166fa

RT-30628 raise owned windows when parent is raised
author David Hill
date Fri, 31 May 2013 11:31:02 -0400
parents 59839bab2fba
children e15e5f07eef3
files glass/glass/src/com/sun/glass/ui/Window.java
diffstat 1 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/glass/glass/src/com/sun/glass/ui/Window.java	Fri May 31 05:33:21 2013 -0700
+++ b/glass/glass/src/com/sun/glass/ui/Window.java	Fri May 31 11:31:02 2013 -0400
@@ -1000,11 +1000,30 @@
     public void toFront() {
         Application.checkEventThread();
         checkNotClosed();
+        toFrontImpl(this, null);
+    }
+
+    private void toFrontImpl(Window w, List<Window> list) {
         // for z-order stacking, pop the window
         // and push it on the end (closest Z)
-        visibleWindows.remove(this);
-        visibleWindows.add(this);
-        _toFront(this.ptr);
+        visibleWindows.remove(w);
+        visibleWindows.add(w);
+        _toFront(w.ptr);
+        raiseOurOwnedWindows(w, list);
+    }
+
+    private void raiseOurOwnedWindows(Window window, List<Window> list) {
+        // owned windows should be maintained in front of the owner.
+        if (list == null) {
+            // get a single copy of the window list
+            // copy is needed to avoid concurence issues with the iterator
+            list = (List<Window>) Window.visibleWindows.clone();
+        }
+        for(Window w: list) {
+            if (window.equals(w.getOwner())) {
+                toFrontImpl(w, list);
+            }
+        }
     }
 
     protected abstract void _toBack(long ptr);