Stop grabbing mouse when game window doesn't have the focus

This commit is contained in:
Magnus Norddahl 2024-08-18 14:56:58 +02:00 committed by Rachael Alexanderson
parent 70cf707251
commit f0ff273620
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0

View file

@ -267,7 +267,7 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
}
else
{
if ((GetForegroundWindow() != mainwindow.GetHandle()) || preferNative || !use_mouse)
if (preferNative || !use_mouse)
{
want_native = true;
}
@ -286,6 +286,10 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
if (!want_native && eventhandlerresult)
want_native = true;
// The application should *never* grab the mouse cursor if its window doesn't have the focus.
if (GetForegroundWindow() != mainwindow.GetHandle())
want_native = true;
//Printf ("%d %d %d\n", wantNative, preferNative, NativeMouse);
if (want_native != NativeMouse)