diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-07-03 07:50:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 07:50:10 +0200 |
commit | d8f0375ce6f7931657f5388ddc5383a85130cfec (patch) | |
tree | 5f63688e49180cf01a610046c431657a57cd153c | |
parent | 64aa25b2e59741c392b7ab4703e5503286db2347 (diff) | |
parent | d3adc53ad9c50c9c042a4a4b03203442e758043b (diff) |
Merge pull request #40062 from reduz/fix-cursor-shape
Ensure cursor shape changes when exiting window, fixes #37724
-rw-r--r-- | scene/main/viewport.cpp | 6 | ||||
-rw-r--r-- | scene/main/window.cpp | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 65a72267b1..1c259b7d32 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -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; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 0463615d4d..bc48a52b32 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -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); |