diff options
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r-- | scene/gui/menu_button.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 868383b141..080b687337 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -57,24 +57,7 @@ void MenuButton::_popup_visibility_changed(bool p_visible) { } if (switch_on_hover) { - Window *wnd = Object::cast_to<Window>(get_viewport()); - if (wnd) { - mouse_pos_adjusted = wnd->get_position(); - - if (wnd->is_embedded()) { - Window *wnd_parent = Object::cast_to<Window>(wnd->get_parent()->get_viewport()); - while (wnd_parent) { - if (!wnd_parent->is_embedded()) { - mouse_pos_adjusted += wnd_parent->get_position(); - break; - } - - wnd_parent = Object::cast_to<Window>(wnd_parent->get_parent()->get_viewport()); - } - } - - set_process_internal(true); - } + set_process_internal(true); } } @@ -155,8 +138,7 @@ void MenuButton::_notification(int p_what) { } break; case NOTIFICATION_INTERNAL_PROCESS: { - Vector2i mouse_pos = DisplayServer::get_singleton()->mouse_get_position() - mouse_pos_adjusted; - MenuButton *menu_btn_other = Object::cast_to<MenuButton>(get_viewport()->gui_find_control(mouse_pos)); + MenuButton *menu_btn_other = Object::cast_to<MenuButton>(get_viewport()->gui_find_control(get_viewport()->get_mouse_position())); if (menu_btn_other && menu_btn_other != this && menu_btn_other->is_switch_on_hover() && !menu_btn_other->is_disabled() && (get_parent()->is_ancestor_of(menu_btn_other) || menu_btn_other->get_parent()->is_ancestor_of(popup))) { |