diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-05-11 09:45:38 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-05-11 09:45:38 +0200 |
commit | b5e0729fcd21a63fc71fe2f37804a02c1d446e40 (patch) | |
tree | d573c16e4298f4038310afe07299fc850a3cb25e | |
parent | b9b423c1ee4b9d83e5cfa9d50da73af7cdca5827 (diff) | |
parent | 4ee2999777a434940f9546316069bec305e92472 (diff) |
Merge pull request #4596 from mattiascibien/hide-cursor-fix
Hide cursor only inside window
-rw-r--r-- | platform/windows/os_windows.cpp | 20 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 352b7d645f..c9c7780a2a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -705,6 +705,25 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { joystick->probe_joysticks(); } break; + case WM_SETCURSOR: { + + if(LOWORD(lParam) == HTCLIENT) { + if(mouse_mode == MOUSE_MODE_HIDDEN) { + //Hide the cursor + if(hCursor == NULL) + hCursor = SetCursor(NULL); + else + SetCursor(NULL); + } + else { + if(hCursor != NULL) { + SetCursor(hCursor); + hCursor = NULL; + } + } + } + + } break; default: { @@ -1211,7 +1230,6 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) { if (mouse_mode==p_mode) return; - ShowCursor(p_mode==MOUSE_MODE_VISIBLE); mouse_mode=p_mode; if (p_mode==MOUSE_MODE_CAPTURED) { RECT clipRect; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 81cf313849..adea26308f 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -103,6 +103,8 @@ class OS_Windows : public OS { HDC hDC; // Private GDI Device Context HINSTANCE hInstance; // Holds The Instance Of The Application HWND hWnd; + + HCURSOR hCursor; Size2 window_rect; VideoMode video_mode; |