Cursor hides only in client area

At the moment is however restored when going out and then in again.
This commit is contained in:
Mattias Cibien 2016-05-09 15:18:08 +02:00
parent 8a45936abd
commit 0b64b97d41
2 changed files with 19 additions and 1 deletions

View file

@ -705,6 +705,23 @@ 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 {
if(hCursor != NULL) {
SetCursor(hCursor);
hCursor = NULL;
}
}
}
} break;
default: {
@ -1211,7 +1228,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;

View file

@ -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;