You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Update mouse cursor shape after changes
This fixes some cases where the mouse cursor shape did not change automatically, but instead required a MouseMove to update.
This commit is contained in:
@@ -392,6 +392,18 @@ 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user