Browse Source

LibGUI: Repaint buttons immediately on mouse up/down events

This ensures that rapidly clicking a button doesn't look like it's
"swallowing" some of the mouse events.

This already worked okay due to a hack in Window, but this will allow us
to get rid of that hack.
Andreas Kling 3 năm trước cách đây
mục cha
commit
d196fbce5b

+ 2 - 2
Userland/Libraries/LibGUI/AbstractButton.cpp

@@ -116,7 +116,7 @@ void AbstractButton::mousedown_event(MouseEvent& event)
 {
 {
     if (event.button() == MouseButton::Left) {
     if (event.button() == MouseButton::Left) {
         m_being_pressed = true;
         m_being_pressed = true;
-        update();
+        repaint();
 
 
         if (m_auto_repeat_interval) {
         if (m_auto_repeat_interval) {
             click();
             click();
@@ -134,7 +134,7 @@ void AbstractButton::mouseup_event(MouseEvent& event)
         m_auto_repeat_timer->stop();
         m_auto_repeat_timer->stop();
         bool was_being_pressed = m_being_pressed;
         bool was_being_pressed = m_being_pressed;
         m_being_pressed = false;
         m_being_pressed = false;
-        update();
+        repaint();
         if (was_being_pressed && !was_auto_repeating)
         if (was_being_pressed && !was_auto_repeating)
             click(event.modifiers());
             click(event.modifiers());
     }
     }