Merge pull request #4596 from mattiascibien/hide-cursor-fix

Hide cursor only inside window
This commit is contained in:
Rémi Verschelde 2016-05-11 09:45:38 +02:00
commit b5e0729fcd
2 changed files with 21 additions and 1 deletions

View File

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

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;