diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 82d52b66d..5394ddcb6 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 2eb184c81..e3273fd11 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 9a756ed4a..fa449548e 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 b7253a21d..7de6d62cc 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); }