diff options
author | Bhuvan Vemula <bhuvanvemula@gmail.com> | 2021-08-11 15:51:31 +0530 |
---|---|---|
committer | Bhuvan Vemula <bhuvanvemula@gmail.com> | 2021-08-15 11:40:44 +0530 |
commit | a0205e4f344eece7d681df9911ff9ddc371aaefc (patch) | |
tree | 85876b34cde035ea251e61c54103b2cdc1dc3cf9 /scene/gui | |
parent | a98589a4497bdff15c66a98b6d07241addddae2c (diff) |
command palette improvements
Diffstat (limited to 'scene/gui')
-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; } |