From fde51aeb28350dc75259c1995d4bee6c7c0ddc7a Mon Sep 17 00:00:00 2001 From: Ricardo Subtil Date: Sat, 2 Dec 2023 11:06:06 +0000 Subject: [PATCH] Ensure slider grabs focus only when it can --- scene/gui/slider.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 8bb8eb1d3004..586334a0b446 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -88,10 +88,14 @@ void Slider::gui_input(const Ref &p_event) { } } else if (scrollable) { if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) { - grab_focus(); + if (get_focus_mode() != FOCUS_NONE) { + grab_focus(); + } set_value(get_value() + get_step()); } else if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) { - grab_focus(); + if (get_focus_mode() != FOCUS_NONE) { + grab_focus(); + } set_value(get_value() - get_step()); } }