From a925f7eab635fd901de832cd70ff64190cb2c603 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 27 May 2009 21:11:06 +0000 Subject: [PATCH] - Removed HaveFocus variable in preference of using GetForegroundWindow(). SVN r1616 (trunk) --- docs/rh-log.txt | 1 + src/win32/i_input.cpp | 3 --- src/win32/i_keyboard.cpp | 1 - src/win32/i_mouse.cpp | 4 +--- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 82d52b66d6..5394ddcb68 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ May 27, 2009 +- Removed HaveFocus variable in preference of using GetForegroundWindow(). - Added Raw Input keyboard handling. May 26, 2009 diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 2eb184c81f..e3273fd114 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -145,7 +145,6 @@ EXTERN_CVAR (Bool, lookstrafe) extern BOOL paused; -bool HaveFocus; static bool noidle = false; LPDIRECTINPUT8 g_pdi; @@ -376,12 +375,10 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case WM_KILLFOCUS: - HaveFocus = false; I_CheckNativeMouse (true); // Make sure mouse gets released right away break; case WM_SETFOCUS: - HaveFocus = true; I_CheckNativeMouse (false); break; diff --git a/src/win32/i_keyboard.cpp b/src/win32/i_keyboard.cpp index 9a756ed4af..fa449548ee 100644 --- a/src/win32/i_keyboard.cpp +++ b/src/win32/i_keyboard.cpp @@ -63,7 +63,6 @@ extern HWND Window; extern LPDIRECTINPUT8 g_pdi; extern LPDIRECTINPUT g_pdi3; extern bool GUICapture; -extern bool HaveFocus; // PRIVATE DATA DEFINITIONS ------------------------------------------------ diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index b7253a21d7..7de6d62cc5 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -113,7 +113,6 @@ extern HWND Window; extern LPDIRECTINPUT8 g_pdi; extern LPDIRECTINPUT g_pdi3; extern bool GUICapture; -extern bool HaveFocus; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -180,7 +179,7 @@ static void SetCursorState(bool visible) { HCURSOR usingCursor = visible ? TheArrowCursor : TheInvisibleCursor; SetClassLongPtr(Window, GCLP_HCURSOR, (LONG_PTR)usingCursor); - if (HaveFocus) + if (GetForegroundWindow() == Window) { SetCursor(usingCursor); } @@ -1177,6 +1176,5 @@ void I_StartupMouse () MouseMode = new_mousemode; NativeMouse = true; } - HaveFocus = (GetFocus() == Window); }