diff options
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r-- | scene/gui/popup_menu.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 94690a4938..40db8deaac 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -244,7 +244,12 @@ void PopupMenu::_activate_submenu(int p_over, bool p_by_keyboard) { Rect2 safe_area = this_rect; safe_area.position.y += items[p_over]._ofs_cache + scroll_offset + theme_cache.panel_style->get_offset().height - theme_cache.v_separation / 2; safe_area.size.y = items[p_over]._height_cache + theme_cache.v_separation; - DisplayServer::get_singleton()->window_set_popup_safe_rect(submenu_popup->get_window_id(), safe_area); + Viewport *vp = submenu_popup->get_embedder(); + if (vp) { + vp->subwindow_set_popup_safe_rect(submenu_popup, safe_area); + } else { + DisplayServer::get_singleton()->window_set_popup_safe_rect(submenu_popup->get_window_id(), safe_area); + } // Make the position of the parent popup relative to submenu popup. this_rect.position = this_rect.position - submenu_pum->get_position(); @@ -273,7 +278,7 @@ void PopupMenu::_parent_focused() { window_parent = Object::cast_to<Window>(window_parent->get_parent()->get_viewport()); } - Rect2 safe_area = DisplayServer::get_singleton()->window_get_popup_safe_rect(get_window_id()); + Rect2 safe_area = get_embedder()->subwindow_get_popup_safe_rect(this); Point2 pos = DisplayServer::get_singleton()->mouse_get_position() - mouse_pos_adjusted; if (safe_area == Rect2i() || !safe_area.has_point(pos)) { Popup::_parent_focused(); @@ -1963,7 +1968,7 @@ void PopupMenu::clear() { void PopupMenu::_ref_shortcut(Ref<Shortcut> p_sc) { if (!shortcut_refcount.has(p_sc)) { shortcut_refcount[p_sc] = 1; - p_sc->connect("changed", callable_mp(this, &PopupMenu::_shortcut_changed)); + p_sc->connect_changed(callable_mp(this, &PopupMenu::_shortcut_changed)); } else { shortcut_refcount[p_sc] += 1; } @@ -1973,7 +1978,7 @@ void PopupMenu::_unref_shortcut(Ref<Shortcut> p_sc) { ERR_FAIL_COND(!shortcut_refcount.has(p_sc)); shortcut_refcount[p_sc]--; if (shortcut_refcount[p_sc] == 0) { - p_sc->disconnect("changed", callable_mp(this, &PopupMenu::_shortcut_changed)); + p_sc->disconnect_changed(callable_mp(this, &PopupMenu::_shortcut_changed)); shortcut_refcount.erase(p_sc); } } @@ -2303,7 +2308,7 @@ void PopupMenu::_bind_methods() { ADD_SIGNAL(MethodInfo("menu_changed")); } -void PopupMenu::popup(const Rect2 &p_bounds) { +void PopupMenu::popup(const Rect2i &p_bounds) { moved = Vector2(); popup_time_msec = OS::get_singleton()->get_ticks_msec(); Popup::popup(p_bounds); |