summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-09-02 06:08:35 -0400
committerAndreas Kling <kling@serenityos.org>2022-09-03 00:07:06 +0200
commit4d090487acb56cd2f0f8ba0fa007920206fa7c6e (patch)
tree6f1cc0687614926eb3fc742bbd8459347ab40571
parent486775f9fe4fafb15df2d8fbe3276c796595eeec (diff)
downloadserenity-4d090487acb56cd2f0f8ba0fa007920206fa7c6e.zip
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.
-rw-r--r--Userland/Libraries/LibGUI/AbstractButton.cpp2
1 files changed, 2 insertions, 0 deletions
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;