From f7fa3c8dbb4fc889574a93a5547a528f89b5311c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 19 Nov 2010 04:20:33 +0000 Subject: [PATCH] - 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) --- src/r_defs.h | 2 +- src/win32/i_mouse.cpp | 2 +- src/win32/i_system.cpp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index 07a716d97..22745f54c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1049,7 +1049,7 @@ struct vissprite_t { short x1, x2; fixed_t cx; // for line side calculation - fixed_t gx, gy; // for fake floor clipping + fixed_t gx, gy; // for drawseg and fake floor clipping fixed_t gz, gzt; // global bottom / top for silhouette clipping fixed_t startfrac; // horizontal position of x1 fixed_t xscale, yscale; diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index 873b9271a..4ed347234 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -118,7 +118,6 @@ extern int BlockMouseMove; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static bool NativeMouse; static EMouseMode MouseMode = MM_None; static FMouse *(*MouseFactory[])() = { @@ -130,6 +129,7 @@ static FMouse *(*MouseFactory[])() = // PUBLIC DATA DEFINITIONS ------------------------------------------------- FMouse *Mouse; +bool NativeMouse; bool CursorState; diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index b585be71a..1da4855cc 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -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; }