mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 15:05:09 +00:00
WindowServer: Merge WM_WindowAdded and WM_WindowStateChanged.
These events are identical, so it's silly to send both. Just broadcast window state changes everywhere instead, it doesn't matter when it was added as clients are learning about this asynchronously anyway.
This commit is contained in:
parent
329cc60a92
commit
99b98dc653
9 changed files with 14 additions and 97 deletions
|
@ -494,18 +494,14 @@ void WSWindowManager::add_window(WSWindow& window)
|
|||
m_switcher.refresh();
|
||||
|
||||
if (window.listens_to_wm_events()) {
|
||||
for_each_window([&window] (WSWindow& other_window) {
|
||||
if (&window != &other_window && other_window.client())
|
||||
WSMessageLoop::the().post_message(window, make<WSWMWindowAddedEvent>(other_window.client()->client_id(), other_window.window_id(), other_window.title(), other_window.rect(), other_window.is_active(), other_window.type()));
|
||||
for_each_window([&] (WSWindow& other_window) {
|
||||
if (&window != &other_window)
|
||||
tell_wm_listener_about_window(window, other_window);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowAddedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WSWindowManager::move_to_front_and_make_active(WSWindow& window)
|
||||
|
@ -541,11 +537,16 @@ void WSWindowManager::remove_window(WSWindow& window)
|
|||
});
|
||||
}
|
||||
|
||||
void WSWindowManager::tell_wm_listener_about_window(WSWindow& listener, WSWindow& window)
|
||||
{
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
}
|
||||
|
||||
void WSWindowManager::tell_wm_listeners_window_state_changed(WSWindow& window)
|
||||
{
|
||||
for_each_window_listening_to_wm_events([&window] (WSWindow& listener) {
|
||||
if (window.client())
|
||||
WSMessageLoop::the().post_message(listener, make<WSWMWindowStateChangedEvent>(window.client()->client_id(), window.window_id(), window.title(), window.rect(), window.is_active(), window.type()));
|
||||
for_each_window_listening_to_wm_events([&] (WSWindow& listener) {
|
||||
tell_wm_listener_about_window(listener, window);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue