From 432ab47053add555a8f95f73224c9152b14db75a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 8 Jul 2021 00:44:19 +0200 Subject: [PATCH] WindowServer: Allow partial repaints in window frame & menubars Before this change, invalidating any rect in a WindowFrame would cause the entire window (including frame & drop shadow) to get invalidated, leading to copious amounts of overdraw when mousing over menubars, titlebars, and window buttons. We now simply allow the partial frame invalidations through to the window's dirty rects collection and the compositor takes care of it. --- Userland/Services/WindowServer/Window.cpp | 4 ++-- Userland/Services/WindowServer/Window.h | 2 +- Userland/Services/WindowServer/WindowFrame.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index da3366e8a7..03edacbcdb 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -643,14 +643,14 @@ void Window::invalidate(bool invalidate_frame, bool re_render_frame) Compositor::the().invalidate_window(); } -void Window::invalidate(const Gfx::IntRect& rect, bool with_frame) +void Window::invalidate(Gfx::IntRect const& rect) { if (type() == WindowType::Applet) { AppletManager::the().invalidate_applet(*this, rect); return; } - if (invalidate_no_notify(rect, with_frame)) + if (invalidate_no_notify(rect)) Compositor::the().invalidate_window(); } diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index 329ad887c3..8c473c702f 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -202,7 +202,7 @@ public: Gfx::IntSize size() const { return m_rect.size(); } void invalidate(bool with_frame = true, bool re_render_frame = false); - void invalidate(const Gfx::IntRect&, bool with_frame = false); + void invalidate(Gfx::IntRect const&); void invalidate_menubar(); bool invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame = false); void invalidate_last_rendered_screen_rects(); diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index e670b5ebda..6cdf02d81c 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -596,7 +596,7 @@ void WindowFrame::invalidate(Gfx::IntRect relative_rect) auto window_rect = m_window.rect(); relative_rect.translate_by(frame_rect.x() - window_rect.x(), frame_rect.y() - window_rect.y()); set_dirty(); - m_window.invalidate(relative_rect, true); + m_window.invalidate(relative_rect); } void WindowFrame::window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)