From b3685608005c2e3bbb1e0201f5668cd5799c4ce7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 10 Jul 2021 17:12:45 +0200 Subject: [PATCH] LibGUI: Only repaint the affected indices on AbstractView item hover Previously, moving the cursor over items in an item view would cause it to repaint itself completely. Now we only repaint the two affected items (the old hovered item and the new hovered item.) --- Userland/Libraries/LibGUI/AbstractView.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index e3c704eefb..623e22355a 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -249,7 +249,12 @@ void AbstractView::set_hovered_index(const ModelIndex& index) auto old_index = m_hovered_index; m_hovered_index = index; did_change_hovered_index(old_index, index); - update(); + + if (old_index.is_valid()) + update(to_widget_rect(paint_invalidation_rect(old_index))); + + if (index.is_valid()) + update(to_widget_rect(paint_invalidation_rect(index))); } void AbstractView::leave_event(Core::Event& event)