From 71a072203571721e8e301bdede6e048d81ddb482 Mon Sep 17 00:00:00 2001 From: Guilherme Felipe Date: Mon, 29 Jul 2019 13:23:30 -0300 Subject: [PATCH] Fix set_default_cursor_shape always sending motion event (cherry picked from commit 508761e0cd3685f65d64718d72d5627b12968cd8) --- doc/classes/Input.xml | 3 ++- main/input_default.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 71a97d0321c..2576b0f6ff8 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -319,7 +319,8 @@ Sets the default cursor shape to be used in the viewport instead of [constant CURSOR_ARROW]. - Note that if you want to change the default cursor shape for [Control]'s nodes, use [member Control.mouse_default_cursor_shape] instead. + [b]Note:[/b] If you want to change the default cursor shape for [Control]'s nodes, use [member Control.mouse_default_cursor_shape] instead. + [b]Note:[/b] This method generates an [InputEventMouseMotion] to update cursor immediately. diff --git a/main/input_default.cpp b/main/input_default.cpp index d137684b41c..02cc91df128 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -632,6 +632,10 @@ Input::CursorShape InputDefault::get_default_cursor_shape() { } void InputDefault::set_default_cursor_shape(CursorShape p_shape) { + + if (default_shape == p_shape) + return; + default_shape = p_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.