mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 21:43:40 +00:00
[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:
parent
219c73edbe
commit
193977895b
@ -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();
|
||||
|
@ -297,6 +297,13 @@ static struct Option options[] =
|
||||
},
|
||||
|
||||
// input options
|
||||
{
|
||||
.module = "input",
|
||||
.name = "captureOnFocus",
|
||||
.description = "Enable capture mode when the window becomes focused",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false
|
||||
},
|
||||
{
|
||||
.module = "input",
|
||||
.name = "grabKeyboard",
|
||||
@ -664,6 +671,7 @@ bool config_load(int argc, char * argv[])
|
||||
case 270: g_params.winRotate = LG_ROTATE_270; break;
|
||||
}
|
||||
|
||||
g_params.captureOnFocus = option_get_bool("input", "captureOnFocus" );
|
||||
g_params.grabKeyboard = option_get_bool("input", "grabKeyboard" );
|
||||
g_params.grabKeyboardOnFocus = option_get_bool("input", "grabKeyboardOnFocus" );
|
||||
g_params.releaseKeysOnFocusLoss = option_get_bool("input", "releaseKeysOnFocusLoss");
|
||||
|
@ -186,6 +186,7 @@ struct AppParams
|
||||
bool ignoreQuit;
|
||||
bool noScreensaver;
|
||||
bool autoScreensaver;
|
||||
bool captureOnFocus;
|
||||
bool grabKeyboard;
|
||||
bool grabKeyboardOnFocus;
|
||||
int escapeKey;
|
||||
|
Loading…
Reference in New Issue
Block a user