From 4d090487acb56cd2f0f8ba0fa007920206fa7c6e Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Fri, 2 Sep 2022 06:08:35 -0400 Subject: [PATCH] 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. --- Userland/Libraries/LibGUI/AbstractButton.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibGUI/AbstractButton.cpp b/Userland/Libraries/LibGUI/AbstractButton.cpp index bccd23f111..78f5d59082 100644 --- a/Userland/Libraries/LibGUI/AbstractButton.cpp +++ b/Userland/Libraries/LibGUI/AbstractButton.cpp @@ -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;