mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
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.
This commit is contained in:
parent
463dc91049
commit
1a38ab0ca1
7 changed files with 16 additions and 20 deletions
|
@ -169,7 +169,7 @@ void Window::show()
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
set_maximized(m_maximized_when_windowless);
|
||||
set_maximized(m_maximized);
|
||||
reified_windows->set(m_window_id, this);
|
||||
Application::the()->did_create_window({});
|
||||
update();
|
||||
|
@ -1019,17 +1019,9 @@ void Window::set_forced_shadow(bool shadow)
|
|||
ConnectionToWindowServer::the().async_set_forced_shadow(m_window_id, shadow);
|
||||
}
|
||||
|
||||
bool Window::is_maximized() const
|
||||
{
|
||||
if (!is_visible())
|
||||
return m_maximized_when_windowless;
|
||||
|
||||
return ConnectionToWindowServer::the().is_maximized(m_window_id);
|
||||
}
|
||||
|
||||
void Window::set_maximized(bool maximized)
|
||||
{
|
||||
m_maximized_when_windowless = maximized;
|
||||
m_maximized = maximized;
|
||||
if (!is_visible())
|
||||
return;
|
||||
|
||||
|
@ -1069,10 +1061,12 @@ void Window::update_all_windows(Badge<ConnectionToWindowServer>)
|
|||
}
|
||||
}
|
||||
|
||||
void Window::notify_state_changed(Badge<ConnectionToWindowServer>, bool minimized, bool occluded)
|
||||
void Window::notify_state_changed(Badge<ConnectionToWindowServer>, bool minimized, bool maximized, bool occluded)
|
||||
{
|
||||
m_visible_for_timer_purposes = !minimized && !occluded;
|
||||
|
||||
m_maximized = maximized;
|
||||
|
||||
// When double buffering is enabled, minimization/occlusion means we can mark the front bitmap volatile (in addition to the back bitmap.)
|
||||
// When double buffering is disabled, there is only the back bitmap (which we can now mark volatile!)
|
||||
auto& store = m_double_buffering_enabled ? m_front_store : m_back_store;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue