summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-03-10 18:44:28 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-09-18 17:15:38 +0200
commit52da6f1a44ff407fcb852a7e7124b7e652885d87 (patch)
treeed55ca4520c6eb372e432837e8d243bba6968e79 /scene/gui
parente5594c26b14e75d8b75d1f697cf2bfbd6254a50c (diff)
Update mouse cursor shape after changes
This fixes some cases where the mouse cursor shape did not change automatically, but instead required a MouseMove to update.
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 347fe9aa11..bd8ac93d84 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2225,7 +2225,19 @@ void Control::_window_find_focus_neighbor(const Vector2 &p_dir, Node *p_at, cons
void Control::set_default_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(int(p_shape), CURSOR_MAX);
+ if (data.default_cursor == p_shape) {
+ return;
+ }
data.default_cursor = p_shape;
+
+ if (!is_inside_tree()) {
+ return;
+ }
+ if (!get_global_rect().has_point(get_global_mouse_position())) {
+ return;
+ }
+
+ get_viewport()->get_base_window()->update_mouse_cursor_shape();
}
Control::CursorShape Control::get_default_cursor_shape() const {