mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibGUI: Don't spam WindowServer with SetWindowOverrideCursor messages
Remember the override cursor in GUI::Window and avoid sending a message to WindowServer when possible. This removes a lot of synchronous IPC between Browser and WindowServer, which noticeably improves DOM event responsiveness. :^)
This commit is contained in:
parent
065db26d7c
commit
ec6e55cfc6
2 changed files with 6 additions and 0 deletions
|
@ -89,6 +89,7 @@ void Window::show()
|
||||||
{
|
{
|
||||||
if (is_visible())
|
if (is_visible())
|
||||||
return;
|
return;
|
||||||
|
m_override_cursor = StandardCursor::None;
|
||||||
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>(
|
auto response = WindowServerConnection::the().send_sync<Messages::WindowServer::CreateWindow>(
|
||||||
m_rect_when_windowless,
|
m_rect_when_windowless,
|
||||||
m_has_alpha_channel,
|
m_has_alpha_channel,
|
||||||
|
@ -123,6 +124,7 @@ void Window::hide()
|
||||||
m_pending_paint_event_rects.clear();
|
m_pending_paint_event_rects.clear();
|
||||||
m_back_bitmap = nullptr;
|
m_back_bitmap = nullptr;
|
||||||
m_front_bitmap = nullptr;
|
m_front_bitmap = nullptr;
|
||||||
|
m_override_cursor = StandardCursor::None;
|
||||||
|
|
||||||
bool app_has_visible_windows = false;
|
bool app_has_visible_windows = false;
|
||||||
for (auto& window : *all_windows) {
|
for (auto& window : *all_windows) {
|
||||||
|
@ -183,7 +185,10 @@ void Window::set_override_cursor(StandardCursor cursor)
|
||||||
{
|
{
|
||||||
if (!is_visible())
|
if (!is_visible())
|
||||||
return;
|
return;
|
||||||
|
if (m_override_cursor == cursor)
|
||||||
|
return;
|
||||||
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
|
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowOverrideCursor>(m_window_id, (u32)cursor);
|
||||||
|
m_override_cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::event(Core::Event& event)
|
void Window::event(Core::Event& event)
|
||||||
|
|
|
@ -212,6 +212,7 @@ private:
|
||||||
Gfx::Size m_base_size;
|
Gfx::Size m_base_size;
|
||||||
Color m_background_color { Color::WarmGray };
|
Color m_background_color { Color::WarmGray };
|
||||||
WindowType m_window_type { WindowType::Normal };
|
WindowType m_window_type { WindowType::Normal };
|
||||||
|
StandardCursor m_override_cursor { StandardCursor::None };
|
||||||
bool m_is_active { false };
|
bool m_is_active { false };
|
||||||
bool m_has_alpha_channel { false };
|
bool m_has_alpha_channel { false };
|
||||||
bool m_double_buffering_enabled { true };
|
bool m_double_buffering_enabled { true };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue