diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-05-11 08:14:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-11 08:14:53 +0200 |
commit | dbee4825f292ce5eba25fab251a6403d4d197906 (patch) | |
tree | 6527d408f51b7ca7bda6bd422454698b0578f116 | |
parent | b38905ae981e25689b82030afd344f4ea69531b4 (diff) | |
parent | 50a0220d2dedd1d93f94e581d6b8ff363b62a130 (diff) |
Merge pull request #18776 from guilhermefelipecgs/reset_cursor
Reset the cursor with Input.set_custom_mouse_cursor(null)
-rw-r--r-- | doc/classes/Input.xml | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 5 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 5 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 8 |
4 files changed, 19 insertions, 1 deletions
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index f537908625..58cee7b556 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -284,7 +284,7 @@ <argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )"> </argument> <description> - Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. See enum [code]CURSOR_*[/code] for the list of shapes. + Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See enum [code]CURSOR_*[/code] for the list of shapes. </description> </method> <method name="set_mouse_mode"> diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 80d466f4b6..dbe9a11471 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1594,6 +1594,11 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { [cursor set]; } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 2850d38ce4..d6cdea7b88 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2117,6 +2117,11 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap if (hXorMask != NULL) { DeleteObject(hXorMask); } + } else { + // Reset to default system cursor + cursors[p_shape] = NULL; + cursor_shape = CURSOR_MAX; + set_cursor_shape(p_shape); } } diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 117995ea48..eec371865e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -2486,6 +2486,14 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { XDefineCursor(x11_display, x11_window, cursors[p_shape]); } + } else { + // Reset to default system cursor + if (img[p_shape]) { + cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]); + } + + current_cursor = CURSOR_MAX; + set_cursor_shape(p_shape); } } |