mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 14:24:35 +00:00
Implemented hidden cursor on Windows.
This commit is contained in:
parent
26e8fde8fb
commit
200e07027c
@ -50,7 +50,17 @@ static void updateClipRect(_GLFWwindow* window)
|
||||
//
|
||||
static void hideCursor(_GLFWwindow* window)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(window);
|
||||
POINT pos;
|
||||
|
||||
ReleaseCapture();
|
||||
ClipCursor(NULL);
|
||||
ShowCursor(TRUE);
|
||||
|
||||
if (GetCursorPos(&pos))
|
||||
{
|
||||
if (WindowFromPoint(pos) == window->win32.handle)
|
||||
SetCursor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// Capture mouse cursor
|
||||
@ -66,11 +76,17 @@ static void captureCursor(_GLFWwindow* window)
|
||||
//
|
||||
static void showCursor(_GLFWwindow* window)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(window);
|
||||
POINT pos;
|
||||
|
||||
ReleaseCapture();
|
||||
ClipCursor(NULL);
|
||||
ShowCursor(TRUE);
|
||||
|
||||
if (GetCursorPos(&pos))
|
||||
{
|
||||
if (WindowFromPoint(pos) == window->win32.handle)
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
}
|
||||
}
|
||||
|
||||
// Translates a Windows key to the corresponding GLFW key
|
||||
@ -597,6 +613,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN &&
|
||||
window->win32.handle == GetForegroundWindow() &&
|
||||
LOWORD(lParam) == HTCLIENT)
|
||||
{
|
||||
SetCursor(NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DEVICECHANGE:
|
||||
{
|
||||
if (DBT_DEVNODES_CHANGED == wParam)
|
||||
|
Loading…
Reference in New Issue
Block a user