Added tracking of cursor visibility.

This commit is contained in:
Camilla Berglund 2013-04-14 15:36:10 +02:00
parent 608109c249
commit 6164eb603b
2 changed files with 20 additions and 4 deletions

View File

@ -154,6 +154,7 @@ typedef struct _GLFWwindowWin32
// Various platform specific internal variables
GLboolean cursorCentered;
GLboolean cursorInside;
GLboolean cursorHidden;
int oldCursorX, oldCursorY;
} _GLFWwindowWin32;

View File

@ -54,7 +54,12 @@ static void hideCursor(_GLFWwindow* window)
ReleaseCapture();
ClipCursor(NULL);
if (window->win32.cursorHidden)
{
ShowCursor(TRUE);
window->win32.cursorHidden = GL_FALSE;
}
if (GetCursorPos(&pos))
{
@ -66,8 +71,13 @@ static void hideCursor(_GLFWwindow* window)
// Capture mouse cursor
//
static void captureCursor(_GLFWwindow* window)
{
if (!window->win32.cursorHidden)
{
ShowCursor(FALSE);
window->win32.cursorHidden = GL_TRUE;
}
updateClipRect(window);
SetCapture(window->win32.handle);
}
@ -80,7 +90,12 @@ static void showCursor(_GLFWwindow* window)
ReleaseCapture();
ClipCursor(NULL);
if (window->win32.cursorHidden)
{
ShowCursor(TRUE);
window->win32.cursorHidden = GL_FALSE;
}
if (GetCursorPos(&pos))
{