summaryrefslogtreecommitdiff
path: root/Userland/Services
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-11-17 10:31:21 -0500
committerAndreas Kling <kling@serenityos.org>2022-11-19 16:04:42 +0100
commitc23adeaaf70dd84e8fbcd2a95c2962f30d024e56 (patch)
tree87326e17aa85accd9a5169169551058aa3e6c30e /Userland/Services
parent3027cf7e99ee417233ec89ba0f5a7e040706b6fd (diff)
downloadserenity-c23adeaaf70dd84e8fbcd2a95c2962f30d024e56.zip
WindowServer: Add foremost_popup_window() helper
Diffstat (limited to 'Userland/Services')
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp14
-rw-r--r--Userland/Services/WindowServer/WindowManager.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 7de186e7a5..08ff9482ff 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -2374,4 +2374,18 @@ bool WindowManager::sync_config_to_disk()
return true;
}
+Window* WindowManager::foremost_popup_window(WindowStack& stack)
+{
+ Window* popup_window = nullptr;
+ for_each_visible_window_from_front_to_back([&](Window& window) {
+ if (window.type() == WindowType::Popup) {
+ popup_window = &window;
+ return IterationDecision::Break;
+ }
+ return IterationDecision::Continue;
+ },
+ &stack);
+ return popup_window;
+}
+
}
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index 1d5b665db7..5b05fbc804 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -98,6 +98,7 @@ public:
return m_current_window_stack->active_window();
}
+ Window* foremost_popup_window(WindowStack& stack = WindowManager::the().current_window_stack());
Window* active_input_window()
{
VERIFY(m_current_window_stack);