summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-10 17:12:45 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-10 18:30:46 +0200
commitb3685608005c2e3bbb1e0201f5668cd5799c4ce7 (patch)
tree25f7a7e66cf3b150d0854073f1e83d2b73a6ea26 /Userland
parentdf9638012197fc3a15ad1ece7a875ed805a9bce5 (diff)
downloadserenity-b3685608005c2e3bbb1e0201f5668cd5799c4ce7.zip
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.)
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/AbstractView.cpp7
1 files changed, 6 insertions, 1 deletions
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)