diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-08-15 16:01:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-15 16:01:49 +0200 |
commit | 966559c3bdcdc7eeb0cd04098520250580ea3a04 (patch) | |
tree | a7e0955cfd4e62183c1db66a1ef2bf67227277e6 /scene | |
parent | 57e16812a1a4b89058de29e81247351afdd09087 (diff) | |
parent | a0205e4f344eece7d681df9911ff9ddc371aaefc (diff) |
Merge pull request #51512 from Bhu1-V/PR/cmd-fix
command palette improvements
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; } |