summaryrefslogtreecommitdiff
path: root/scene/gui/shortcut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/shortcut.cpp')
-rw-r--r--scene/gui/shortcut.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 885a51e058..1c29870682 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -29,10 +29,10 @@
/*************************************************************************/
#include "shortcut.h"
-
#include "core/os/keyboard.h"
void Shortcut::set_event(const Ref<InputEvent> &p_event) {
+ ERR_FAIL_COND(Object::cast_to<InputEventShortcut>(*p_event));
event = p_event;
emit_changed();
}
@@ -42,6 +42,12 @@ Ref<InputEvent> Shortcut::get_event() const {
}
bool Shortcut::matches_event(const Ref<InputEvent> &p_event) const {
+ Ref<InputEventShortcut> ies = p_event;
+ if (ies != nullptr) {
+ if (ies->get_shortcut().ptr() == this) {
+ return true;
+ }
+ }
return event.is_valid() && event->is_match(p_event, true);
}