summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-05-30 22:27:31 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-05-30 22:27:55 +0200
commitc218390864ea106e00632037f97868c21cbe7d2c (patch)
treee31b04bc94d34bee07d83a33d9f2b5b107e27fd9
parent5567e898d1052c1e2c2d32d3c37dfd957f4dc4bd (diff)
InputEvent: Restore old behaviour for matching key events to actions.
Original code in 9100db7
-rw-r--r--core/os/input_event.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 7ec76c1eed..0d727f4bcb 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -282,7 +282,10 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event) const {
if (key.is_null())
return false;
- return get_scancode_with_modifiers() == key->get_scancode_with_modifiers();
+ uint32_t code = get_scancode_with_modifiers();
+ uint32_t event_code = key->get_scancode_with_modifiers();
+
+ return get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
}
void InputEventKey::_bind_methods() {