summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-04-05 17:40:53 +0200
committerAndreas Kling <kling@serenityos.org>2022-04-05 17:45:07 +0200
commit1a38ab0ca158f1a4fd22fccd3b1cbbd795d41249 (patch)
treef9f9c578613bdaa41ac642a2e5c341f94deae093 /Userland/Services/WindowServer
parent463dc91049e02ddc99843566f663a0ee16eaf212 (diff)
downloadserenity-1a38ab0ca158f1a4fd22fccd3b1cbbd795d41249.zip
WindowServer+LibGUI: Notify windows when their maximized state changes
Previously, GUI::Window::is_maximized() had to make a synchronous IPC request to WindowServer in order to find out if the window was indeed maximized. This patch removes the need for synchronous IPC by instead pushing the maximization state to clients when it changes. The motivation for this change was that GUI::Statusbar was checking if the containing window was maximized in its resize_event(), causing all windows with a statusbar to block on sync IPC *during* resize. Browser would typically block for ~15 milliseconds here every time on my machine, continuously during live resize.
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/Window.cpp2
-rw-r--r--Userland/Services/WindowServer/WindowClient.ipc2
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp4
3 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index f372aff82c..525fbea829 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -497,6 +497,8 @@ void Window::set_maximized(bool maximized, Optional<Gfx::IntPoint> fixed_point)
m_frame.did_set_maximized({}, maximized);
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect));
set_default_positioned(false);
+
+ WindowManager::the().notify_minimization_state_changed(*this);
}
void Window::set_always_on_top(bool always_on_top)
diff --git a/Userland/Services/WindowServer/WindowClient.ipc b/Userland/Services/WindowServer/WindowClient.ipc
index 822d4a8ba9..0c67af3830 100644
--- a/Userland/Services/WindowServer/WindowClient.ipc
+++ b/Userland/Services/WindowServer/WindowClient.ipc
@@ -19,7 +19,7 @@ endpoint WindowClient
key_up(i32 window_id, u32 code_point, u32 key, u32 modifiers, u32 scancode) =|
window_activated(i32 window_id) =|
window_deactivated(i32 window_id) =|
- window_state_changed(i32 window_id, bool minimized, bool occluded) =|
+ window_state_changed(i32 window_id, bool minimized, bool maximized, bool occluded) =|
window_close_request(i32 window_id) =|
window_resized(i32 window_id, Gfx::IntRect new_rect) =|
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index bdbbe2c1a5..097f02d6c9 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -625,7 +625,7 @@ void WindowManager::notify_minimization_state_changed(Window& window)
tell_wms_window_state_changed(window);
if (window.client())
- window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded());
+ window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_maximized(), window.is_occluded());
if (window.is_active() && window.is_minimized())
pick_new_active_window(&window);
@@ -634,7 +634,7 @@ void WindowManager::notify_minimization_state_changed(Window& window)
void WindowManager::notify_occlusion_state_changed(Window& window)
{
if (window.client())
- window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_occluded());
+ window.client()->async_window_state_changed(window.window_id(), window.is_minimized(), window.is_maximized(), window.is_occluded());
}
void WindowManager::notify_progress_changed(Window& window)