Browse Source

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.
thankyouverycool 2 years ago
parent
commit
12ee92004d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Userland/Libraries/LibGUI/AbstractButton.cpp

+ 2 - 1
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: