1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

WindowServer: Add show desktop toggle IPC call

Differentiates between normal minimization and hidden windows. A window
which is hidden is still minimized, but can be seen as another stage
of being minimized.
This commit is contained in:
ForLoveOfCats 2021-06-28 19:21:35 -04:00 committed by Gunnar Beutner
parent 62d4b4abf3
commit 271840ca22
7 changed files with 78 additions and 9 deletions

View file

@ -115,6 +115,34 @@ void WMClientConnection::set_window_minimized(i32 client_id, i32 window_id, bool
WindowManager::the().minimize_windows(window, minimized);
}
void WMClientConnection::toggle_show_desktop()
{
bool should_hide = false;
WindowServer::ClientConnection::for_each_client([&should_hide](auto& client) {
client.for_each_window([&should_hide](Window& window) {
if (window.type() == WindowType::Normal && window.is_minimizable()) {
if (!window.is_hidden() && !window.is_minimized()) {
should_hide = true;
return IterationDecision::Break;
}
}
return IterationDecision::Continue;
});
});
WindowServer::ClientConnection::for_each_client([should_hide](auto& client) {
client.for_each_window([should_hide](Window& window) {
if (window.type() == WindowType::Normal && window.is_minimizable()) {
auto state = window.minimized_state();
if (state == WindowMinimizedState::None || state == WindowMinimizedState::Hidden) {
WindowManager::the().hide_windows(window, should_hide);
}
}
return IterationDecision::Continue;
});
});
}
void WMClientConnection::set_event_mask(u32 event_mask)
{
m_event_mask = event_mask;