Skip to content

Commit

Permalink
Stop grabbing mouse when game window doesn't have the focus
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas authored and madame-rachelle committed Aug 23, 2024
1 parent 70cf707 commit f0ff273
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common/platform/win32/i_mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)
Expand Down

0 comments on commit f0ff273

Please sign in to comment.