- Add a SetCursor() call to I_SetCursor() when the pointer is within the window's client area to

make the pointer change instant instead of waiting until the next mouse event.

SVN r3010 (trunk)
This commit is contained in:
Randy Heit 2010-11-19 04:20:33 +00:00
commit f7fa3c8dbb
3 changed files with 20 additions and 2 deletions

View file

@ -131,6 +131,7 @@ extern HANDLE StdOut;
extern bool FancyStdOut;
extern HINSTANCE g_hInst;
extern FILE *Logfile;
extern bool NativeMouse;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -1214,6 +1215,23 @@ bool I_SetCursor(FTexture *cursorpic)
cursor = LoadCursor(NULL, IDC_ARROW);
}
SetClassLongPtr(Window, GCLP_HCURSOR, (LONG_PTR)cursor);
if (NativeMouse)
{
POINT pt;
RECT client;
// If the mouse pointer is within the window's client rect, set it now.
if (GetCursorPos(&pt) && GetClientRect(Window, &client) &&
ClientToScreen(Window, (LPPOINT)&client.left) &&
ClientToScreen(Window, (LPPOINT)&client.right))
{
if (pt.x >= client.left && pt.x < client.right &&
pt.y >= client.top && pt.y < client.bottom)
{
SetCursor(cursor);
}
}
}
return true;
}