소스 검색

Fix popup submenu in single-window mode

The internal processing code only works for OS windows, since it takes
the mouse position relative to the window and not the viewport. Now we
make sure it's not called in single-window mode.
jfons 4 년 전
부모
커밋
944b5ee639
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      scene/gui/popup_menu.cpp

+ 6 - 6
scene/gui/popup_menu.cpp

@@ -397,10 +397,6 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseMotion> m = p_event;
 	Ref<InputEventMouseMotion> m = p_event;
 
 
 	if (m.is_valid()) {
 	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()) {
 		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())) {
 			if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E->get().has_point(m->get_position())) {
 				_close_pressed();
 				_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 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);
 		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;
 		} break;
 		case NOTIFICATION_INTERNAL_PROCESS: {
 		case NOTIFICATION_INTERNAL_PROCESS: {
 			//only used when using operating system windows
 			//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();
 				Point2 mouse_pos = DisplayServer::get_singleton()->mouse_get_position();
 				mouse_pos -= get_position();
 				mouse_pos -= get_position();
 
 
@@ -786,7 +786,7 @@ void PopupMenu::_notification(int p_what) {
 
 
 				set_process_internal(false);
 				set_process_internal(false);
 			} else {
 			} else {
-				if (get_window_id() != DisplayServer::INVALID_WINDOW_ID) {
+				if (!is_embedded()) {
 					set_process_internal(true);
 					set_process_internal(true);
 				}
 				}