Skip to content

Commit

Permalink
Ensure cursor shape changes when exiting window, fixes godotengine#37724
Browse files Browse the repository at this point in the history
  • Loading branch information
reduz committed Jul 2, 2020
1 parent 67e4082 commit d3adc53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,11 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Control *c = over;
Vector2 cpos = pos;
while (c) {
cursor_shape = c->get_cursor_shape(cpos);
if (gui.mouse_focus_mask != 0 || c->has_point(cpos)) {
cursor_shape = c->get_cursor_shape(cpos);
} else {
cursor_shape = Control::CURSOR_ARROW;
}
cpos = c->get_transform().xform(cpos);
if (cursor_shape != Control::CURSOR_ARROW) {
break;
Expand Down
1 change: 1 addition & 0 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
case DisplayServer::WINDOW_EVENT_MOUSE_ENTER: {
_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER);
emit_signal("mouse_entered");
DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_ARROW); //restore cursor shape
} break;
case DisplayServer::WINDOW_EVENT_MOUSE_EXIT: {
_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_EXIT);
Expand Down

0 comments on commit d3adc53

Please sign in to comment.