diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/base_button.cpp | 5 | ||||
-rw-r--r-- | scene/gui/shortcut.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 871ad889ca..d252a4507c 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -145,10 +145,11 @@ void BaseButton::on_action_event(Ref<InputEvent> p_event) { if (status.press_attempt && status.pressing_inside) { if (toggle_mode) { + bool is_pressed = p_event->is_pressed(); if (Object::cast_to<InputEventShortcut>(*p_event)) { - action_mode = ACTION_MODE_BUTTON_PRESS; // HACK. + is_pressed = false; } - if ((p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_PRESS) || (!p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_RELEASE)) { + if ((is_pressed && action_mode == ACTION_MODE_BUTTON_PRESS) || (!is_pressed && action_mode == ACTION_MODE_BUTTON_RELEASE)) { if (action_mode == ACTION_MODE_BUTTON_PRESS) { status.press_attempt = false; status.pressing_inside = false; diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp index 1c29870682..c0aac6d91a 100644 --- a/scene/gui/shortcut.cpp +++ b/scene/gui/shortcut.cpp @@ -43,7 +43,7 @@ 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.is_valid()) { if (ies->get_shortcut().ptr() == this) { return true; } |