1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

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
parent 486775f9fe
commit 4d090487ac

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;