summaryrefslogtreecommitdiff
path: root/scene/gui/popup_menu.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-23 22:15:23 +0200
committerGitHub <noreply@github.com>2021-07-23 22:15:23 +0200
commit57388809f728e7c81c431a88194573ee040efa8b (patch)
treeae9ee19ab742cff9450aaccaa4c3d524f85ffdd5 /scene/gui/popup_menu.cpp
parentaa4babdc065d3e0932a60059718c1001b5d250b3 (diff)
parent944b5ee6394ad7ec1cbe3b482cc1f2147621bda7 (diff)
Merge pull request #50780 from JFonS/fix_submenus
Fix Popup submenu in single-window mode
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r--scene/gui/popup_menu.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index ee9e0e8ab8..14c86c0d27 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -397,10 +397,6 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> m = p_event;
if (m.is_valid()) {
- if (!item_clickable_area.has_point(m->get_position())) {
- return;
- }
-
for (List<Rect2>::Element *E = autohide_areas.front(); E; E = E->next()) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E->get().has_point(m->get_position())) {
_close_pressed();
@@ -408,6 +404,10 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
}
}
+ if (!item_clickable_area.has_point(m->get_position())) {
+ return;
+ }
+
int over = _get_mouse_over(m->get_position());
int id = (over < 0 || items[over].separator || items[over].disabled) ? -1 : (items[over].id >= 0 ? items[over].id : over);
@@ -747,7 +747,7 @@ void PopupMenu::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
//only used when using operating system windows
- if (get_window_id() != DisplayServer::INVALID_WINDOW_ID && autohide_areas.size()) {
+ if (!is_embedded() && autohide_areas.size()) {
Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
mouse_pos -= get_position();
@@ -786,7 +786,7 @@ void PopupMenu::_notification(int p_what) {
set_process_internal(false);
} else {
- if (get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
+ if (!is_embedded()) {
set_process_internal(true);
}