summaryrefslogtreecommitdiff
path: root/main/input_default.cpp
diff options
context:
space:
mode:
authorMartin Capitanio <capnm@capitanio.org>2018-09-15 20:54:22 +0200
committerMartin Capitanio <capnm@capitanio.org>2018-09-15 20:54:22 +0200
commit64cecf9d61eccb45f939b33cc752f336682cdda1 (patch)
tree9cd98a64ff3e0c3a228e06bc09df17ba5816e27f /main/input_default.cpp
parent2cf024ed916abf565011b254ea4f69c04781964c (diff)
Fix set_default_cursor_shape interaction with Control nodes
Do not call `set_cursor_shape` when the cursor is inside the `Control` node. Make it work for x11 in MOUSE_MODE_CONFINED.
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r--main/input_default.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 2efbb3f849..10be291b8d 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -598,7 +598,13 @@ Input::CursorShape InputDefault::get_default_cursor_shape() {
void InputDefault::set_default_cursor_shape(CursorShape p_shape) {
default_shape = p_shape;
- OS::get_singleton()->set_cursor_shape((OS::CursorShape)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.
+ Ref<InputEventMouseMotion> mm;
+ mm.instance();
+ mm->set_position(mouse_pos);
+ mm->set_global_position(mouse_pos);
+ parse_input_event(mm);
}
void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {