summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-09-04 07:54:54 -0400
committerLinus Groh <mail@linusgroh.de>2022-09-08 10:17:27 +0100
commit12ee92004dc522282a2005b0ad52eb8b47a41d54 (patch)
tree57be260061b152725db1060b73653d43001d1fe2
parent56a719daf84f542e082c789d7bf4177ad7e624a3 (diff)
downloadserenity-12ee92004dc522282a2005b0ad52eb8b47a41d54.zip
LibGUI+Taskbar: Don't immediately repaint checkable Buttons
Unlike regular buttons, unchecked checkables don't need to repaint on MouseUp to feel responsive when clicking rapidly. In fact, this can lead to a flickering effect when a bogus unchecked state gets painted again before the button's checked one.
-rw-r--r--Userland/Libraries/LibGUI/AbstractButton.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractButton.cpp b/Userland/Libraries/LibGUI/AbstractButton.cpp
index 78f5d59082..52a36442e0 100644
--- a/Userland/Libraries/LibGUI/AbstractButton.cpp
+++ b/Userland/Libraries/LibGUI/AbstractButton.cpp
@@ -134,7 +134,8 @@ void AbstractButton::mouseup_event(MouseEvent& event)
bool was_being_pressed = m_being_pressed;
m_being_pressed = false;
m_pressed_mouse_button = MouseButton::None;
- repaint();
+ if (!is_checkable() || is_checked())
+ repaint();
if (was_being_pressed && !was_auto_repeating) {
switch (event.button()) {
case MouseButton::Primary: