diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index a2c96ec47..901e61483 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -150,6 +150,9 @@ extern bool AppActive; int SessionState = 0; int BlockMouseMove; +static bool EventHandlerResultForNativeMouse; + + CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) @@ -457,11 +460,11 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case WM_KILLFOCUS: - I_CheckNativeMouse (true); // Make sure mouse gets released right away + I_CheckNativeMouse (true, false); // Make sure mouse gets released right away break; case WM_SETFOCUS: - I_CheckNativeMouse (false); + I_CheckNativeMouse (false, EventHandlerResultForNativeMouse); // This cannot call the event handler. Doing it from here is unsafe. break; case WM_SETCURSOR: @@ -778,7 +781,8 @@ void I_StartTic () BlockMouseMove--; ResetButtonTriggers (); I_CheckGUICapture (); - I_CheckNativeMouse (false); + EventHandlerResultForNativeMouse = eventManager.CheckRequireMouse(); + I_CheckNativeMouse (false, EventHandlerResultForNativeMouse); I_GetEvent (); } diff --git a/src/win32/i_input.h b/src/win32/i_input.h index 529ea83f5..00f853e9b 100644 --- a/src/win32/i_input.h +++ b/src/win32/i_input.h @@ -129,7 +129,7 @@ public: extern FJoystickCollection *JoyDevices[NUM_JOYDEVICES]; void I_StartupMouse(); -void I_CheckNativeMouse(bool prefer_native); +void I_CheckNativeMouse(bool prefer_native, bool eh); void I_StartupKeyboard(); void I_StartupXInput(); void I_StartupDirectInputJoystick(); diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index baa3106b6..9915479b7 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -284,7 +284,7 @@ static bool CaptureMode_InGame() // //========================================================================== -void I_CheckNativeMouse(bool preferNative) +void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult) { bool windowed = (screen == NULL) || !screen->IsFullscreen(); bool want_native; @@ -311,7 +311,7 @@ void I_CheckNativeMouse(bool preferNative) } } - if (!want_native && eventManager.CheckRequireMouse()) + if (!want_native && eventhandlerresult) want_native = true; //Printf ("%d %d %d\n", wantNative, preferNative, NativeMouse);