summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric M <itsjusteza@gmail.com>2021-08-07 13:50:32 +1000
committerEric M <itsjusteza@gmail.com>2021-09-21 12:24:07 +1000
commitcaac2e1a87cc22272a26e7881157e78286454928 (patch)
tree8738fed0b1d8ac1efa5d62aee82d93780f2307d2
parent2d1699ef82a29ef65d810194ee76dddc0d9e0389 (diff)
Fix focus shortcuts triggering incorrectly
-rw-r--r--scene/main/viewport.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index cef1b830df..b3b743370b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1972,35 +1972,30 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Control *from = gui.key_focus ? gui.key_focus : nullptr;
- // Keyboard focus.
- Ref<InputEventKey> k = p_event;
- // Need to check for mods, otherwise any combination of alt/ctrl/shift+<up/down/left/right/etc> is handled here when it shouldn't be.
- bool mods = k.is_valid() && (k->is_ctrl_pressed() || k->is_alt_pressed() || k->is_shift_pressed() || k->is_meta_pressed());
-
if (from && p_event->is_pressed()) {
Control *next = nullptr;
- if (p_event->is_action_pressed("ui_focus_next", true)) {
+ if (p_event->is_action_pressed("ui_focus_next", true, true)) {
next = from->find_next_valid_focus();
}
- if (p_event->is_action_pressed("ui_focus_prev", true)) {
+ if (p_event->is_action_pressed("ui_focus_prev", true, true)) {
next = from->find_prev_valid_focus();
}
- if (!mods && p_event->is_action_pressed("ui_up", true)) {
+ if (p_event->is_action_pressed("ui_up", true, true)) {
next = from->_get_focus_neighbor(SIDE_TOP);
}
- if (!mods && p_event->is_action_pressed("ui_left", true)) {
+ if (p_event->is_action_pressed("ui_left", true, true)) {
next = from->_get_focus_neighbor(SIDE_LEFT);
}
- if (!mods && p_event->is_action_pressed("ui_right", true)) {
+ if (p_event->is_action_pressed("ui_right", true, true)) {
next = from->_get_focus_neighbor(SIDE_RIGHT);
}
- if (!mods && p_event->is_action_pressed("ui_down", true)) {
+ if (p_event->is_action_pressed("ui_down", true, true)) {
next = from->_get_focus_neighbor(SIDE_BOTTOM);
}