diff options
author | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-09-08 18:13:15 -0700 |
---|---|---|
committer | Emmanuel Barroga <emmanuelbarroga@gmail.com> | 2019-09-08 18:13:44 -0700 |
commit | b8007b39474ff3f5beca80123009d57a83b236c3 (patch) | |
tree | 615c4af8df573fb608943c0922c8d3610a7635da | |
parent | 24e1039eb6fe32115e8d1a62a84965e9be19a2ed (diff) |
Fix scrollwheel triggering focus change
Clicking or using the scrollwheel outside of the focused control triggers a focus change. This makes sense for mouse clicks, but scrollwheeling outside the focuses control does not. This PR ignores scrollwheeling outside of the focused control.
-rw-r--r-- | scene/main/viewport.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b5c82ce4e3..2d23ca8c73 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1742,6 +1742,12 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { return; // no one gets the event if exclusive NO ONE } + if (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN || mb->get_button_index() == BUTTON_WHEEL_LEFT || mb->get_button_index() == BUTTON_WHEEL_RIGHT) { + //cancel scroll wheel events, only clicks should trigger focus changes. + set_input_as_handled(); + return; + } + top->notification(Control::NOTIFICATION_MODAL_CLOSE); top->_modal_stack_remove(); top->hide(); |