mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 11:35:10 +00:00
WindowServer+LibGUI: Force full window repaints after theme change
We were not repainting windows that were occluded at the time of the theme changing. This patch adds a way to bypass occlusion testing when invalidating window rects. Fixes #1249.
This commit is contained in:
parent
8a2dc5d188
commit
eaa680ab8e
7 changed files with 20 additions and 12 deletions
|
@ -341,7 +341,14 @@ bool Window::is_visible() const
|
||||||
|
|
||||||
void Window::update()
|
void Window::update()
|
||||||
{
|
{
|
||||||
update({ 0, 0, width(), height() });
|
auto rect = this->rect();
|
||||||
|
update({ 0, 0, rect.width(), rect.height() });
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::force_update()
|
||||||
|
{
|
||||||
|
auto rect = this->rect();
|
||||||
|
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, { { 0, 0, rect.width(), rect.height() } }, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::update(const Gfx::Rect& a_rect)
|
void Window::update(const Gfx::Rect& a_rect)
|
||||||
|
@ -366,7 +373,7 @@ void Window::update(const Gfx::Rect& a_rect)
|
||||||
Vector<Gfx::Rect> rects_to_send;
|
Vector<Gfx::Rect> rects_to_send;
|
||||||
for (auto& r : rects)
|
for (auto& r : rects)
|
||||||
rects_to_send.append(r);
|
rects_to_send.append(r);
|
||||||
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send));
|
WindowServerConnection::the().post_message(Messages::WindowServer::InvalidateRect(m_window_id, rects_to_send, false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
m_pending_paint_event_rects.append(a_rect);
|
m_pending_paint_event_rects.append(a_rect);
|
||||||
|
@ -626,7 +633,7 @@ void Window::schedule_relayout()
|
||||||
void Window::update_all_windows(Badge<WindowServerConnection>)
|
void Window::update_all_windows(Badge<WindowServerConnection>)
|
||||||
{
|
{
|
||||||
for (auto* window : *all_windows) {
|
for (auto* window : *all_windows) {
|
||||||
window->update();
|
window->force_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,7 @@ private:
|
||||||
NonnullRefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::Size&);
|
NonnullRefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::Size&);
|
||||||
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
|
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
|
||||||
void flip(const Vector<Gfx::Rect, 32>& dirty_rects);
|
void flip(const Vector<Gfx::Rect, 32>& dirty_rects);
|
||||||
|
void force_update();
|
||||||
|
|
||||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||||
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
||||||
|
|
|
@ -465,10 +465,10 @@ OwnPtr<Messages::WindowServer::DestroyWindowResponse> ClientConnection::handle(c
|
||||||
return make<Messages::WindowServer::DestroyWindowResponse>();
|
return make<Messages::WindowServer::DestroyWindowResponse>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::post_paint_message(Window& window)
|
void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion)
|
||||||
{
|
{
|
||||||
auto rect_set = window.take_pending_paint_rects();
|
auto rect_set = window.take_pending_paint_rects();
|
||||||
if (window.is_minimized() || window.is_occluded())
|
if (window.is_minimized() || (!ignore_occlusion && window.is_occluded()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
post_message(Messages::WindowClient::Paint(window.window_id(), window.size(), rect_set.rects()));
|
post_message(Messages::WindowClient::Paint(window.window_id(), window.size(), rect_set.rects()));
|
||||||
|
@ -483,7 +483,7 @@ void ClientConnection::handle(const Messages::WindowServer::InvalidateRect& mess
|
||||||
}
|
}
|
||||||
auto& window = *(*it).value;
|
auto& window = *(*it).value;
|
||||||
for (int i = 0; i < message.rects().size(); ++i)
|
for (int i = 0; i < message.rects().size(); ++i)
|
||||||
window.request_update(message.rects()[i].intersected({ {}, window.size() }));
|
window.request_update(message.rects()[i].intersected({ {}, window.size() }), message.ignore_occlusion());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& message)
|
void ClientConnection::handle(const Messages::WindowServer::DidFinishPainting& message)
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
void notify_about_new_screen_rect(const Gfx::Rect&);
|
void notify_about_new_screen_rect(const Gfx::Rect&);
|
||||||
void notify_about_clipboard_contents_changed();
|
void notify_about_clipboard_contents_changed();
|
||||||
void post_paint_message(Window&);
|
void post_paint_message(Window&, bool ignore_occlusion = false);
|
||||||
|
|
||||||
Menu* find_menu_by_id(int menu_id)
|
Menu* find_menu_by_id(int menu_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -317,11 +317,11 @@ void Window::set_default_icon()
|
||||||
m_icon = default_window_icon();
|
m_icon = default_window_icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::request_update(const Gfx::Rect& rect)
|
void Window::request_update(const Gfx::Rect& rect, bool ignore_occlusion)
|
||||||
{
|
{
|
||||||
if (m_pending_paint_rects.is_empty()) {
|
if (m_pending_paint_rects.is_empty()) {
|
||||||
deferred_invoke([this](auto&) {
|
deferred_invoke([this, ignore_occlusion](auto&) {
|
||||||
client()->post_paint_message(*this);
|
client()->post_paint_message(*this, ignore_occlusion);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
m_pending_paint_rects.add(rect);
|
m_pending_paint_rects.add(rect);
|
||||||
|
|
|
@ -208,7 +208,7 @@ public:
|
||||||
const Cursor* override_cursor() const { return m_override_cursor.ptr(); }
|
const Cursor* override_cursor() const { return m_override_cursor.ptr(); }
|
||||||
void set_override_cursor(RefPtr<Cursor>&& cursor) { m_override_cursor = move(cursor); }
|
void set_override_cursor(RefPtr<Cursor>&& cursor) { m_override_cursor = move(cursor); }
|
||||||
|
|
||||||
void request_update(const Gfx::Rect&);
|
void request_update(const Gfx::Rect&, bool ignore_occlusion = false);
|
||||||
Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
|
Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
|
||||||
|
|
||||||
bool in_minimize_animation() const { return m_minimize_animation_step != -1; }
|
bool in_minimize_animation() const { return m_minimize_animation_step != -1; }
|
||||||
|
|
|
@ -51,7 +51,7 @@ endpoint WindowServer = 2
|
||||||
SetWindowRect(i32 window_id, Gfx::Rect rect) => ()
|
SetWindowRect(i32 window_id, Gfx::Rect rect) => ()
|
||||||
GetWindowRect(i32 window_id) => (Gfx::Rect rect)
|
GetWindowRect(i32 window_id) => (Gfx::Rect rect)
|
||||||
|
|
||||||
InvalidateRect(i32 window_id, Vector<Gfx::Rect> rects) =|
|
InvalidateRect(i32 window_id, Vector<Gfx::Rect> rects, bool ignore_occlusion) =|
|
||||||
DidFinishPainting(i32 window_id, Vector<Gfx::Rect> rects) =|
|
DidFinishPainting(i32 window_id, Vector<Gfx::Rect> rects) =|
|
||||||
|
|
||||||
SetGlobalCursorTracking(i32 window_id, bool enabled) => ()
|
SetGlobalCursorTracking(i32 window_id, bool enabled) => ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue