diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-22 11:13:57 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-05-22 11:17:43 +0300 |
commit | cb3ce8590223ea34be4324d0ffb2c149b48456ee (patch) | |
tree | f05c20d0c7031942454431e379ec8b95a6f3e41c /scene | |
parent | 8e2141eac534f6984bb0bdbcefbd17de27ae0993 (diff) | |
download | redot-engine-cb3ce8590223ea34be4324d0ffb2c149b48456ee.tar.gz |
Fix `PopupMenu` focus issues after `Viewport::set_embedding_subwindows` is changed.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/popup_menu.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index dbf1137bd6..bdd0102b63 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1014,9 +1014,6 @@ void PopupMenu::_notification(int p_what) { float pm_delay = pm->get_submenu_popup_delay(); set_submenu_popup_delay(pm_delay); } - if (!is_embedded()) { - set_flag(FLAG_NO_FOCUS, true); - } if (system_menu_id != NativeMenu::INVALID_MENU_ID) { bind_global_menu(); } @@ -2829,6 +2826,8 @@ void PopupMenu::popup(const Rect2i &p_bounds) { if (native) { NativeMenu::get_singleton()->popup(global_menu, (p_bounds != Rect2i()) ? p_bounds.position : get_position()); } else { + set_flag(FLAG_NO_FOCUS, !is_embedded()); + moved = Vector2(); popup_time_msec = OS::get_singleton()->get_ticks_msec(); if (!is_embedded()) { @@ -2856,6 +2855,8 @@ void PopupMenu::set_visible(bool p_visible) { NativeMenu::get_singleton()->popup(global_menu, get_position()); } } else { + set_flag(FLAG_NO_FOCUS, !is_embedded()); + Popup::set_visible(p_visible); } } |