summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-24 23:03:11 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-24 23:03:11 +0200
commitcb9134a2ca2fa2a89f5e0ae6acee09345deebe8e (patch)
tree9f9f7533ae9cd3bd9e7abc0bc635ff608dcba2cf
parentac7e02d9841295e45f356d209e5482e05ea9acc9 (diff)
downloadserenity-cb9134a2ca2fa2a89f5e0ae6acee09345deebe8e.zip
GSlider: Ignore mouse events when disabled.
-rw-r--r--LibGUI/GSlider.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/LibGUI/GSlider.cpp b/LibGUI/GSlider.cpp
index f136b9c83a..28591c2942 100644
--- a/LibGUI/GSlider.cpp
+++ b/LibGUI/GSlider.cpp
@@ -71,6 +71,8 @@ Rect GSlider::knob_rect() const
void GSlider::mousedown_event(GMouseEvent& event)
{
+ if (!is_enabled())
+ return;
if (event.button() == GMouseButton::Left) {
if (knob_rect().contains(event.position())) {
m_dragging = true;
@@ -84,6 +86,8 @@ void GSlider::mousedown_event(GMouseEvent& event)
void GSlider::mousemove_event(GMouseEvent& event)
{
+ if (!is_enabled())
+ return;
set_knob_hovered(knob_rect().contains(event.position()));
if (m_dragging) {
float delta = event.position().x() - m_drag_origin.x();
@@ -98,6 +102,8 @@ void GSlider::mousemove_event(GMouseEvent& event)
void GSlider::mouseup_event(GMouseEvent& event)
{
+ if (!is_enabled())
+ return;
if (event.button() == GMouseButton::Left) {
m_dragging = false;
return;
@@ -108,6 +114,8 @@ void GSlider::mouseup_event(GMouseEvent& event)
void GSlider::leave_event(CEvent& event)
{
+ if (!is_enabled())
+ return;
set_knob_hovered(false);
GWidget::leave_event(event);
}