mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- changed the place where the CheckRequireMouse event gets called.
The original place in I_CheckNativeMouse is unsafe because that function can get called from the system message queue which can result in a bad global state of the VM for such a call because it can be recursively invoked from code that may temporarily alter some settings.
This commit is contained in:
parent
484485f3cf
commit
d005e0b483
3 changed files with 10 additions and 6 deletions
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue