summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-07-29 19:31:26 +0200
committerGitHub <noreply@github.com>2019-07-29 19:31:26 +0200
commitcc0e5e51b816cadcbf4ae3f909d35c783a71d3d5 (patch)
treefa47c46997035442541e21900e788ec8aa9de3b9
parentb90ef52eceef51ff6ad58ca230b159642f984651 (diff)
parent508761e0cd3685f65d64718d72d5627b12968cd8 (diff)
Merge pull request #30931 from guilhermefelipecgs/fix_30917
Fix set_default_cursor_shape always sending motion event
-rw-r--r--doc/classes/Input.xml1
-rw-r--r--main/input_default.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index bbf1ee186f..f938cd0757 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -318,6 +318,7 @@
<description>
Sets the default cursor shape to be used in the viewport instead of [constant CURSOR_ARROW].
[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.
</description>
</method>
<method name="set_mouse_mode">
diff --git a/main/input_default.cpp b/main/input_default.cpp
index caa5c10518..5ba98c20e2 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -629,6 +629,10 @@ Input::CursorShape InputDefault::get_default_cursor_shape() const {
}
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.