- Removed HaveFocus variable in preference of using GetForegroundWindow().

SVN r1616 (trunk)
This commit is contained in:
Randy Heit 2009-05-27 21:11:06 +00:00
parent 3f3d677526
commit a925f7eab6
4 changed files with 2 additions and 7 deletions

View file

@ -1,4 +1,5 @@
May 27, 2009 May 27, 2009
- Removed HaveFocus variable in preference of using GetForegroundWindow().
- Added Raw Input keyboard handling. - Added Raw Input keyboard handling.
May 26, 2009 May 26, 2009

View file

@ -145,7 +145,6 @@ EXTERN_CVAR (Bool, lookstrafe)
extern BOOL paused; extern BOOL paused;
bool HaveFocus;
static bool noidle = false; static bool noidle = false;
LPDIRECTINPUT8 g_pdi; LPDIRECTINPUT8 g_pdi;
@ -376,12 +375,10 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0; return 0;
case WM_KILLFOCUS: case WM_KILLFOCUS:
HaveFocus = false;
I_CheckNativeMouse (true); // Make sure mouse gets released right away I_CheckNativeMouse (true); // Make sure mouse gets released right away
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
HaveFocus = true;
I_CheckNativeMouse (false); I_CheckNativeMouse (false);
break; break;

View file

@ -63,7 +63,6 @@ extern HWND Window;
extern LPDIRECTINPUT8 g_pdi; extern LPDIRECTINPUT8 g_pdi;
extern LPDIRECTINPUT g_pdi3; extern LPDIRECTINPUT g_pdi3;
extern bool GUICapture; extern bool GUICapture;
extern bool HaveFocus;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------

View file

@ -113,7 +113,6 @@ extern HWND Window;
extern LPDIRECTINPUT8 g_pdi; extern LPDIRECTINPUT8 g_pdi;
extern LPDIRECTINPUT g_pdi3; extern LPDIRECTINPUT g_pdi3;
extern bool GUICapture; extern bool GUICapture;
extern bool HaveFocus;
// PRIVATE DATA DEFINITIONS ------------------------------------------------ // PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -180,7 +179,7 @@ static void SetCursorState(bool visible)
{ {
HCURSOR usingCursor = visible ? TheArrowCursor : TheInvisibleCursor; HCURSOR usingCursor = visible ? TheArrowCursor : TheInvisibleCursor;
SetClassLongPtr(Window, GCLP_HCURSOR, (LONG_PTR)usingCursor); SetClassLongPtr(Window, GCLP_HCURSOR, (LONG_PTR)usingCursor);
if (HaveFocus) if (GetForegroundWindow() == Window)
{ {
SetCursor(usingCursor); SetCursor(usingCursor);
} }
@ -1177,6 +1176,5 @@ void I_StartupMouse ()
MouseMode = new_mousemode; MouseMode = new_mousemode;
NativeMouse = true; NativeMouse = true;
} }
HaveFocus = (GetFocus() == Window);
} }