[client] add new option input:captureOnFocus

This option allows the client to automatically enter capture mode if the
window is focused.

Closes #1088
This commit is contained in:
Geoffrey McRae
2023-09-11 21:01:19 +10:00
parent 219c73edbe
commit 193977895b
3 changed files with 15 additions and 0 deletions

View File

@@ -95,6 +95,9 @@ void app_updateCursorPos(double x, double y)
void app_handleFocusEvent(bool focused)
{
if (g_state.focused == focused)
return;
g_state.focused = focused;
// release any imgui buttons/keys if we lost focus
@@ -126,6 +129,9 @@ void app_handleFocusEvent(bool focused)
if (g_params.minimizeOnFocusLoss)
g_state.ds->minimize();
}
else
if (g_params.captureOnFocus)
core_setGrab(true);
g_cursor.realign = true;
g_state.ds->realignPointer();