summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Felipe <guilhermefelipecgs@gmail.com>2019-07-29 13:23:30 -0300
committerGuilherme Felipe <guilhermefelipecgs@gmail.com>2019-07-29 14:00:37 -0300
commit508761e0cd3685f65d64718d72d5627b12968cd8 (patch)
tree4bc5138c260fefc49580936c603f67abfb485afc
parent639127de0967bf32b20dac9a54c4bba44d2786ad (diff)
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.