1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

WindowServer: Fix invalidating window frame

When invalidating the frame we need to properly flag that so that
we trigger rendering the frame, even if "all" was flagged as being
invalidated. Otherwise it will only get rendered if anything else
happens to trigger it (such as focus change).

Fixes #3427
This commit is contained in:
Tom 2020-09-07 11:34:30 -06:00 committed by Andreas Kling
parent 86d230ab5f
commit 3a4a9d4c6b
3 changed files with 12 additions and 7 deletions

View file

@ -409,21 +409,25 @@ void Window::invalidate(bool invalidate_frame)
Compositor::the().invalidate_window(); Compositor::the().invalidate_window();
} }
void Window::invalidate(const Gfx::IntRect& rect) void Window::invalidate(const Gfx::IntRect& rect, bool with_frame)
{ {
if (type() == WindowType::MenuApplet) { if (type() == WindowType::MenuApplet) {
AppletManager::the().invalidate_applet(*this, rect); AppletManager::the().invalidate_applet(*this, rect);
return; return;
} }
if (invalidate_no_notify(rect)) if (invalidate_no_notify(rect, with_frame))
Compositor::the().invalidate_window(); Compositor::the().invalidate_window();
} }
bool Window::invalidate_no_notify(const Gfx::IntRect& rect) bool Window::invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame)
{ {
if (m_invalidated_all || rect.is_empty()) if (rect.is_empty())
return false; return false;
if (m_invalidated_all) {
m_invalidated_frame |= with_frame;
return false;
}
auto outer_rect = frame().rect(); auto outer_rect = frame().rect();
auto inner_rect = rect; auto inner_rect = rect;
@ -434,6 +438,7 @@ bool Window::invalidate_no_notify(const Gfx::IntRect& rect)
return false; return false;
m_invalidated = true; m_invalidated = true;
m_invalidated_frame |= with_frame;
m_dirty_rects.add(inner_rect.translated(-outer_rect.location())); m_dirty_rects.add(inner_rect.translated(-outer_rect.location()));
return true; return true;
} }

View file

@ -168,8 +168,8 @@ public:
Gfx::IntSize size() const { return m_rect.size(); } Gfx::IntSize size() const { return m_rect.size(); }
void invalidate(bool with_frame = true); void invalidate(bool with_frame = true);
void invalidate(const Gfx::IntRect&); void invalidate(const Gfx::IntRect&, bool with_frame = false);
bool invalidate_no_notify(const Gfx::IntRect& rect); bool invalidate_no_notify(const Gfx::IntRect& rect, bool with_frame = false);
void prepare_dirty_rects(); void prepare_dirty_rects();
void clear_dirty_rects(); void clear_dirty_rects();

View file

@ -240,7 +240,7 @@ void WindowFrame::invalidate(Gfx::IntRect relative_rect)
auto frame_rect = rect(); auto frame_rect = rect();
auto window_rect = m_window.rect(); auto window_rect = m_window.rect();
relative_rect.move_by(frame_rect.x() - window_rect.x(), frame_rect.y() - window_rect.y()); relative_rect.move_by(frame_rect.x() - window_rect.x(), frame_rect.y() - window_rect.y());
m_window.invalidate(relative_rect); m_window.invalidate(relative_rect, true);
} }
void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect) void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)