LibGUI: Don't update windows that aren't visible (#1410)

Because the ID of a hidden window is 0, the window server will
fail to update them when the system theme is changed. This
manifests when an application has multiple windows, some of
which are hidden, and the system theme is changed (see
https://github.com/SerenityOS/serenity/issues/1378).

This PR changes the window code to ignore update messages if
the window has the ID 0--is hidden.

Ideally the window ID would not change, and visibility would be
managed separately.
This commit is contained in:
Alex Muscar 2020-03-11 20:28:19 +00:00 committed by GitHub
parent 39a843470c
commit 4c9bb266df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-19 08:46:08 +09:00

View File

@ -348,6 +348,8 @@ void Window::update()
void Window::force_update()
{
if (!this->is_visible())
return;
auto rect = this->rect();
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true));
}
@ -633,8 +635,8 @@ void Window::schedule_relayout()
void Window::update_all_windows(Badge<WindowServerConnection>)
{
for (auto* window : *all_windows) {
window->force_update();
for (auto& e : *reified_windows) {
e.value->force_update();
}
}