summaryrefslogtreecommitdiff
path: root/Services/WindowServer/WindowManager.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-07-15 17:40:52 -0600
committerAndreas Kling <kling@serenityos.org>2020-07-16 16:10:21 +0200
commitbbdf0665fc34c0fee7ec367c5e9af0df2407f141 (patch)
tree6af6b57d4edb6ce07a4fe520044ab139354b79f8 /Services/WindowServer/WindowManager.h
parent2f731150a29bcfc4dd6db5c1c8d0effa57f7f144 (diff)
downloadserenity-bbdf0665fc34c0fee7ec367c5e9af0df2407f141.zip
WindowServer: Expose window parent information and more modal improvements
* The parent information is necessary by the Taskbar to be able to determine a modal window's parent * Minimize and maximize modal window stacks together
Diffstat (limited to 'Services/WindowServer/WindowManager.h')
-rw-r--r--Services/WindowServer/WindowManager.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/Services/WindowServer/WindowManager.h b/Services/WindowServer/WindowManager.h
index 08f15c0b77..2fac08daef 100644
--- a/Services/WindowServer/WindowManager.h
+++ b/Services/WindowServer/WindowManager.h
@@ -88,6 +88,7 @@ public:
void remove_window(Window&);
void notify_title_changed(Window&);
+ void notify_modal_unparented(Window&);
void notify_rect_changed(Window&, const Gfx::IntRect& oldRect, const Gfx::IntRect& newRect);
void notify_minimization_state_changed(Window&);
void notify_opacity_changed(Window&);
@@ -181,6 +182,35 @@ public:
void start_menu_doubleclick(Window& window, const MouseEvent& event);
bool is_menu_doubleclick(Window& window, const MouseEvent& event) const;
+ void minimize_windows(Window&, bool);
+ void maximize_windows(Window&, bool);
+
+ template<typename Function>
+ void for_each_window_in_modal_stack(Window& window, Function f)
+ {
+ auto* blocking_modal_window = window.is_blocked_by_modal_window();
+ if (blocking_modal_window || window.is_modal()) {
+ Vector<Window*> modal_stack;
+ auto* modal_stack_top = blocking_modal_window ? blocking_modal_window : &window;
+ for (auto* parent = modal_stack_top->parent_window(); parent; parent = parent->parent_window()) {
+ if (parent->is_blocked_by_modal_window() != modal_stack_top)
+ break;
+ modal_stack.append(parent);
+ if (!parent->is_modal())
+ break;
+ }
+ if (!modal_stack.is_empty()) {
+ for (size_t i = modal_stack.size(); i > 0; i--) {
+ f(*modal_stack[i - 1], false);
+ }
+ }
+ f(*modal_stack_top, true);
+ } else {
+ // Not a modal window stack, just "iterate" over this window
+ f(window, true);
+ }
+ }
+
private:
NonnullRefPtr<Cursor> get_cursor(const String& name);
NonnullRefPtr<Cursor> get_cursor(const String& name, const Gfx::IntPoint& hotspot);