LibGUI: Stop auto repeat timer for Buttons on EnabledChange events

Since 5064b58 SpinBox buttons are disabled if value reaches the
min or max allowed. Consequently this swallows the final MouseUp
event, leaving the repeat timer running. Fixes SpinBoxes
{dec,inc}rementing their value in perpetuity after min/max value
is reached through button clicking.
This commit is contained in:
thankyouverycool 2022-09-02 06:08:35 -04:00 committed by Andreas Kling
commit 4d090487ac
Notes: sideshowbarker 2024-07-17 07:33:41 +09:00

View file

@ -249,6 +249,8 @@ void AbstractButton::paint_text(Painter& painter, Gfx::IntRect const& rect, Gfx:
void AbstractButton::change_event(Event& event)
{
if (event.type() == Event::Type::EnabledChange) {
if (m_auto_repeat_timer->is_active())
m_auto_repeat_timer->stop();
if (!is_enabled()) {
bool was_being_pressed = m_being_pressed;
m_being_pressed = false;