Просмотр исходного кода

WindowServer: Don't allow parent windows to go above their children

Whenever a parent window is moved to front, we now follow up by
immediately moving its children to front as well.
Andreas Kling 5 лет назад
Родитель
Сommit
2ac1fbef4f
2 измененных файлов с 9 добавлено и 1 удалено
  1. 3 0
      Servers/WindowServer/Window.h
  2. 6 1
      Servers/WindowServer/WindowManager.cpp

+ 3 - 0
Servers/WindowServer/Window.h

@@ -229,6 +229,9 @@ public:
 
 
     void set_parent_window(Window&);
     void set_parent_window(Window&);
 
 
+    Vector<WeakPtr<Window>>& child_windows() { return m_child_windows; }
+    const Vector<WeakPtr<Window>>& child_windows() const { return m_child_windows; }
+
 private:
 private:
     void handle_mouse_event(const MouseEvent&);
     void handle_mouse_event(const MouseEvent&);
     void update_menu_item_text(PopupMenuItem item);
     void update_menu_item_text(PopupMenuItem item);

+ 6 - 1
Servers/WindowServer/WindowManager.cpp

@@ -47,8 +47,8 @@
 #include <WindowServer/Cursor.h>
 #include <WindowServer/Cursor.h>
 #include <WindowServer/WindowClientEndpoint.h>
 #include <WindowServer/WindowClientEndpoint.h>
 #include <errno.h>
 #include <errno.h>
-#include <stdio.h>
 #include <serenity.h>
 #include <serenity.h>
+#include <stdio.h>
 #include <time.h>
 #include <time.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
@@ -218,6 +218,11 @@ void WindowManager::move_to_front_and_make_active(Window& window)
         m_switcher.select_window(window);
         m_switcher.select_window(window);
         set_highlight_window(&window);
         set_highlight_window(&window);
     }
     }
+
+    for (auto& child_window : window.child_windows()) {
+        if (child_window)
+            move_to_front_and_make_active(*child_window);
+    }
 }
 }
 
 
 void WindowManager::remove_window(Window& window)
 void WindowManager::remove_window(Window& window)