From c2be1a75a0b93c2a0f8ec7c4df7f125d1a53eca4 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 27 Jul 2018 14:02:30 +0300 Subject: [PATCH] Fixed shortcuts not working with InputEventActions --- core/os/input_event.cpp | 8 ++++++++ core/os/input_event.h | 1 + 2 files changed, 9 insertions(+) diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 4ebb821a2fe..206938f393f 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -937,6 +937,14 @@ bool InputEventAction::is_pressed() const { return pressed; } +bool InputEventAction::shortcut_match(const Ref &p_event) const { + Ref 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 037649ed604..df89dd518c1 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -467,6 +467,7 @@ public: virtual bool is_action(const StringName &p_action) const; + virtual bool shortcut_match(const Ref &p_event) const; virtual bool is_action_type() const { return true; } virtual String as_text() const;