mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
WindowServer: Add request_close_fragile_windows() helper
This commit is contained in:
parent
c23adeaaf7
commit
35bd79701c
2 changed files with 23 additions and 2 deletions
|
@ -2388,4 +2388,14 @@ Window* WindowManager::foremost_popup_window(WindowStack& stack)
|
||||||
return popup_window;
|
return popup_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::request_close_fragile_windows(WindowStack& stack)
|
||||||
|
{
|
||||||
|
for_each_visible_window_from_back_to_front([&](Window& window) {
|
||||||
|
if (is_fragile_window_type(window.type()))
|
||||||
|
window.request_close();
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
},
|
||||||
|
&stack);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Window* foremost_popup_window(WindowStack& stack = WindowManager::the().current_window_stack());
|
Window* foremost_popup_window(WindowStack& stack = WindowManager::the().current_window_stack());
|
||||||
|
void request_close_fragile_windows(WindowStack& stack = WindowManager::the().current_window_stack());
|
||||||
Window* active_input_window()
|
Window* active_input_window()
|
||||||
{
|
{
|
||||||
VERIFY(m_current_window_stack);
|
VERIFY(m_current_window_stack);
|
||||||
|
@ -301,14 +302,24 @@ public:
|
||||||
{
|
{
|
||||||
switch (window_type) {
|
switch (window_type) {
|
||||||
case WindowType::Normal:
|
case WindowType::Normal:
|
||||||
case WindowType::Tooltip:
|
|
||||||
case WindowType::Popup:
|
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr bool is_fragile_window_type(WindowType window_type)
|
||||||
|
{
|
||||||
|
switch (window_type) {
|
||||||
|
case WindowType::Autocomplete:
|
||||||
|
case WindowType::Popup:
|
||||||
|
case WindowType::Tooltip:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void did_switch_window_stack(Badge<Compositor>, WindowStack&, WindowStack&);
|
void did_switch_window_stack(Badge<Compositor>, WindowStack&, WindowStack&);
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue