1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-05 10:47:36 +00:00

WindowServer: Don't spam clients with resize events.

Wait for them to finish a paint, then send them a new resize event.
The exception is when releasing the mouse button to end the resize.
Then we send a new resize event right away.
This commit is contained in:
Andreas Kling 2019-02-20 15:50:05 +01:00
parent 59b8183c4b
commit d054fbee91
3 changed files with 10 additions and 2 deletions

View file

@ -531,7 +531,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
#ifdef RESIZE_DEBUG
printf("[WM] Finish resizing WSWindow{%p}\n", m_resize_window.ptr());
#endif
invalidate(*m_resize_window);
WSMessageLoop::the().post_message(m_resize_window.ptr(), make<WSResizeEvent>(m_resize_window->rect(), m_resize_window->rect()));
m_resize_window = nullptr;
return;
}
@ -553,7 +553,10 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_
if (new_rect.height() < 50)
new_rect.set_height(50);
m_resize_window->set_rect(new_rect);
WSMessageLoop::the().post_message(m_resize_window.ptr(), make<WSResizeEvent>(old_rect, new_rect));
if (m_resize_window->has_painted_since_last_resize()) {
m_resize_window->set_has_painted_since_last_resize(false);
WSMessageLoop::the().post_message(m_resize_window.ptr(), make<WSResizeEvent>(old_rect, new_rect));
}
return;
}
}