From feabe6ed31489fadb74cabd61e20d644e3a51089 Mon Sep 17 00:00:00 2001 From: Ignas S Date: Sun, 11 Aug 2019 12:53:02 +0300 Subject: [PATCH] GScrollBar: highlight the scrubber while it's in use. Originally, it would stop being highlighted if the mouse was moved away from it, even while in use. Now it will stay highlighted for the duration of usage. --- Libraries/LibGUI/GScrollBar.cpp | 4 +++- Libraries/LibGUI/GScrollBar.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Libraries/LibGUI/GScrollBar.cpp b/Libraries/LibGUI/GScrollBar.cpp index 473eef11b1..32b31f8985 100644 --- a/Libraries/LibGUI/GScrollBar.cpp +++ b/Libraries/LibGUI/GScrollBar.cpp @@ -208,7 +208,7 @@ void GScrollBar::paint_event(GPaintEvent& event) } if (has_scrubber()) - StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber); + StylePainter::paint_button(painter, scrubber_rect(), ButtonStyle::Normal, false, m_hovered_component == Component::Scrubber || m_scrubber_in_use); } void GScrollBar::on_automatic_scrolling_timer_fired() @@ -238,6 +238,7 @@ void GScrollBar::mousedown_event(GMouseEvent& event) return; } if (has_scrubber() && scrubber_rect().contains(event.position())) { + m_scrubber_in_use = true; m_scrubbing = true; m_scrub_start_value = value(); m_scrub_origin = event.position(); @@ -270,6 +271,7 @@ void GScrollBar::mouseup_event(GMouseEvent& event) { if (event.button() != GMouseButton::Left) return; + m_scrubber_in_use = false; m_automatic_scrolling_direction = AutomaticScrollingDirection::None; set_automatic_scrolling_active(false); if (!m_scrubbing) diff --git a/Libraries/LibGUI/GScrollBar.h b/Libraries/LibGUI/GScrollBar.h index 2197e51bd2..289d0c283d 100644 --- a/Libraries/LibGUI/GScrollBar.h +++ b/Libraries/LibGUI/GScrollBar.h @@ -70,6 +70,7 @@ private: Orientation m_orientation { Orientation::Vertical }; Component m_hovered_component { Component::Invalid }; + bool m_scrubber_in_use { false }; enum class AutomaticScrollingDirection { None = 0,