summaryrefslogtreecommitdiff
path: root/core/input/input_event.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-20 11:26:05 +0100
committerGitHub <noreply@github.com>2022-03-20 11:26:05 +0100
commitcb51df3286bda88d716cc579f11b21b6eee0daae (patch)
tree782454f82fb7b41973204b60177ceea0d191344e /core/input/input_event.cpp
parent81c2d7a82a805477fc716e47c93a0dfb2447260d (diff)
parentea20049afc9dad1398e5cb8ffd3c0518f15d58bc (diff)
Merge pull request #59343 from madmiraal/fix-57943
Ensure minimum modifiers are pressed when matching actions
Diffstat (limited to 'core/input/input_event.cpp')
-rw-r--r--core/input/input_event.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index ab0f36132f..52c7c69315 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -424,8 +424,13 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool p_exact_ma
} else {
match = get_physical_keycode() == key->get_physical_keycode();
}
+ Key action_mask = get_modifiers_mask();
+ Key key_mask = key->get_modifiers_mask();
+ if (key->is_pressed()) {
+ match &= (action_mask & key_mask) == action_mask;
+ }
if (p_exact_match) {
- match &= get_modifiers_mask() == key->get_modifiers_mask();
+ match &= action_mask == key_mask;
}
if (match) {
bool pressed = key->is_pressed();
@@ -589,8 +594,13 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool p_
}
bool match = button_index == mb->button_index;
+ Key action_mask = get_modifiers_mask();
+ Key button_mask = mb->get_modifiers_mask();
+ if (mb->is_pressed()) {
+ match &= (action_mask & button_mask) == action_mask;
+ }
if (p_exact_match) {
- match &= get_modifiers_mask() == mb->get_modifiers_mask();
+ match &= action_mask == button_mask;
}
if (match) {
bool pressed = mb->is_pressed();