From 12ee92004dc522282a2005b0ad52eb8b47a41d54 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Sun, 4 Sep 2022 07:54:54 -0400 Subject: 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. --- Userland/Libraries/LibGUI/AbstractButton.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Userland/Libraries/LibGUI') 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: -- cgit v1.2.3