Ver código fonte

Merge pull request #58978 from Sauermann/revert-58913

Rémi Verschelde 3 anos atrás
pai
commit
0f73170180

+ 0 - 5
scene/gui/control.cpp

@@ -2663,11 +2663,6 @@ void Control::set_default_cursor_shape(CursorShape p_shape) {
 	ERR_FAIL_INDEX(int(p_shape), CURSOR_MAX);
 
 	data.default_cursor = p_shape;
-
-	if (!is_inside_tree()) {
-		return;
-	}
-	get_viewport()->get_base_window()->update_mouse_cursor_shape();
 }
 
 Control::CursorShape Control::get_default_cursor_shape() const {

+ 0 - 1
scene/main/scene_tree.cpp

@@ -1068,7 +1068,6 @@ void SceneTree::_change_scene(Node *p_to) {
 	if (p_to) {
 		current_scene = p_to;
 		root->add_child(p_to);
-		root->update_mouse_cursor_shape();
 	}
 }
 

+ 2 - 2
scene/main/viewport.cpp

@@ -1551,7 +1551,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
 					gui.drag_preview_id = ObjectID();
 				}
 				_propagate_viewport_notification(this, NOTIFICATION_DRAG_END);
-				get_base_window()->update_mouse_cursor_shape();
+				// Change mouse accordingly.
 			}
 
 			_gui_cancel_tooltip();
@@ -1572,7 +1572,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
 				gui.dragging = false;
 				gui.drag_mouse_over = nullptr;
 				_propagate_viewport_notification(this, NOTIFICATION_DRAG_END);
-				get_base_window()->update_mouse_cursor_shape();
+				// Change mouse accordingly.
 			}
 
 			gui.mouse_focus_mask &= ~mouse_button_to_mask(mb->get_button_index()); // Remove from mask.

+ 0 - 12
scene/main/window.cpp

@@ -378,18 +378,6 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
 	}
 }
 
-void Window::update_mouse_cursor_shape() {
-	// The default shape is set in Viewport::_gui_input_event. To instantly
-	// see the shape in the viewport we need to trigger a mouse motion event.
-	Ref<InputEventMouseMotion> mm;
-	Vector2 pos = get_mouse_position();
-	Transform2D xform = get_global_canvas_transform().affine_inverse();
-	mm.instantiate();
-	mm->set_position(pos);
-	mm->set_global_position(xform.xform(pos));
-	push_input(mm);
-}
-
 void Window::show() {
 	set_visible(true);
 }

+ 0 - 2
scene/main/window.h

@@ -205,8 +205,6 @@ public:
 	void set_visible(bool p_visible);
 	bool is_visible() const;
 
-	void update_mouse_cursor_shape();
-
 	void show();
 	void hide();