diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-03 13:39:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-03 13:39:25 +0200 |
commit | 9a115ccaf3dd0224de0e5b1a2d116e53b6fabffb (patch) | |
tree | 9d6106ff824a1cdadd2fbd247188af7ce5da351a | |
parent | 77b1214a9a63efdd6e3cf6772965777cc06408bb (diff) | |
parent | 5bfe32eaa4b2254b48f39bde3e7bb6055eae9b83 (diff) |
Merge pull request #32518 from nekomatata/fix-revert-cursor
Properly revert cursor when using set_custom_mouse_cursor with null
-rw-r--r-- | platform/javascript/os_javascript.cpp | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 7 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 7 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 0179bf813d..b0661cb4dd 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -574,6 +574,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s }, cursors[p_shape].utf8().get_data()); /* clang-format on */ cursors[p_shape] = ""; + + cursors_cache.erase(p_shape); } set_cursor_shape(cursor_shape); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index f48d4a307d..d30cb1c092 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1973,11 +1973,16 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c [nsimage release]; } else { // Reset to default system cursor - cursors[p_shape] = NULL; + if (cursors[p_shape] != NULL) { + [cursors[p_shape] release]; + cursors[p_shape] = NULL; + } CursorShape c = cursor_shape; cursor_shape = CURSOR_MAX; set_cursor_shape(c); + + cursors_cache.erase(p_shape); } } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index facf5b8d91..81b8d08b3d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2485,11 +2485,16 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap DeleteObject(bitmap); } else { // Reset to default system cursor - cursors[p_shape] = NULL; + if (cursors[p_shape]) { + DestroyIcon(cursors[p_shape]); + cursors[p_shape] = NULL; + } CursorShape c = cursor_shape; cursor_shape = CURSOR_MAX; set_cursor_shape(c); + + cursors_cache.erase(p_shape); } } diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 687981f32b..39160ee720 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -2996,6 +2996,8 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c CursorShape c = current_cursor; current_cursor = CURSOR_MAX; set_cursor_shape(c); + + cursors_cache.erase(p_shape); } } |