summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-07-28 09:48:44 +0200
committerGitHub <noreply@github.com>2018-07-28 09:48:44 +0200
commite6aec27428400d35c6d431044ae0b5e6c9649d53 (patch)
tree1e9cf14e00eeb68488609360a7d68bc09a1fdcd8
parent66429a1576402376c5e0a4c0ecce113904a98d49 (diff)
parentc2be1a75a0b93c2a0f8ec7c4df7f125d1a53eca4 (diff)
Merge pull request #20511 from maksloboda/InputEventActionFix
Fixed shortcuts not working with InputEventActions
-rw-r--r--core/os/input_event.cpp8
-rw-r--r--core/os/input_event.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index e94ccb4f48..12c6ef7d3b 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -949,6 +949,14 @@ bool InputEventAction::is_pressed() const {
return pressed;
}
+bool InputEventAction::shortcut_match(const Ref<InputEvent> &p_event) const {
+ Ref<InputEventKey> event = p_event;
+ if (event.is_null())
+ return false;
+
+ return event->is_action(action);
+}
+
bool InputEventAction::is_action(const StringName &p_action) const {
return action == p_action;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 04126fee77..07df81488b 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -480,6 +480,7 @@ public:
virtual bool is_action(const StringName &p_action) const;
+ virtual bool shortcut_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
virtual String as_text() const;