diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/input/input_event.cpp | 14 |
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(); |