mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-10 17:38:10 +00:00
[client] input: add releaseKeysOnFocusLoss option
This makes dealing with window manager shortcuts that overlap with guest keys more pleasant, while retaining the previous functionality for users who prefer it. For instance, previously, using Alt+Tab (or $mod as Alt in i3/sway movement commands) would result in the guest retaining Alt as pressed. When the guest regained focus, it would continue thinking Alt is pressed, leading to accidentally triggering obscure shortcuts. One had to remember to press Alt again to "unstick" things, which was suboptimal.
This commit is contained in:

committed by
Geoffrey McRae

parent
98a327e99e
commit
1a407a67b1
@@ -57,6 +57,11 @@ void app_handleFocusEvent(bool focused)
|
||||
{
|
||||
core_setGrabQuiet(false);
|
||||
core_setCursorInView(false);
|
||||
|
||||
if (g_params.releaseKeysOnFocusLoss)
|
||||
for (int key = 0; key < KEY_MAX; key++)
|
||||
if (g_state.keyDown[key])
|
||||
app_handleKeyRelease(key);
|
||||
}
|
||||
|
||||
g_cursor.realign = true;
|
||||
|
@@ -271,6 +271,13 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true,
|
||||
},
|
||||
{
|
||||
.module = "input",
|
||||
.name = "releaseKeysOnFocusLoss",
|
||||
.description = "On focus loss, send key up events to guest for all held keys",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "input",
|
||||
.name = "escapeKey",
|
||||
@@ -512,17 +519,18 @@ bool config_load(int argc, char * argv[])
|
||||
case 270: g_params.winRotate = LG_ROTATE_270; break;
|
||||
}
|
||||
|
||||
g_params.grabKeyboard = option_get_bool("input", "grabKeyboard" );
|
||||
g_params.grabKeyboardOnFocus = option_get_bool("input", "grabKeyboardOnFocus");
|
||||
g_params.escapeKey = option_get_int ("input", "escapeKey" );
|
||||
g_params.ignoreWindowsKeys = option_get_bool("input", "ignoreWindowsKeys" );
|
||||
g_params.hideMouse = option_get_bool("input", "hideCursor" );
|
||||
g_params.mouseSens = option_get_int ("input", "mouseSens" );
|
||||
g_params.mouseSmoothing = option_get_bool("input", "mouseSmoothing" );
|
||||
g_params.rawMouse = option_get_bool("input", "rawMouse" );
|
||||
g_params.mouseRedraw = option_get_bool("input", "mouseRedraw" );
|
||||
g_params.autoCapture = option_get_bool("input", "autoCapture" );
|
||||
g_params.captureInputOnly = option_get_bool("input", "captureOnly" );
|
||||
g_params.grabKeyboard = option_get_bool("input", "grabKeyboard" );
|
||||
g_params.grabKeyboardOnFocus = option_get_bool("input", "grabKeyboardOnFocus" );
|
||||
g_params.releaseKeysOnFocusLoss = option_get_bool("input", "releaseKeysOnFocusLoss");
|
||||
g_params.escapeKey = option_get_int ("input", "escapeKey" );
|
||||
g_params.ignoreWindowsKeys = option_get_bool("input", "ignoreWindowsKeys" );
|
||||
g_params.hideMouse = option_get_bool("input", "hideCursor" );
|
||||
g_params.mouseSens = option_get_int ("input", "mouseSens" );
|
||||
g_params.mouseSmoothing = option_get_bool("input", "mouseSmoothing" );
|
||||
g_params.rawMouse = option_get_bool("input", "rawMouse" );
|
||||
g_params.mouseRedraw = option_get_bool("input", "mouseRedraw" );
|
||||
g_params.autoCapture = option_get_bool("input", "autoCapture" );
|
||||
g_params.captureInputOnly = option_get_bool("input", "captureOnly" );
|
||||
|
||||
g_params.minimizeOnFocusLoss = option_get_bool("win", "minimizeOnFocusLoss");
|
||||
|
||||
|
@@ -128,6 +128,7 @@ struct AppParams
|
||||
bool grabKeyboardOnFocus;
|
||||
int escapeKey;
|
||||
bool ignoreWindowsKeys;
|
||||
bool releaseKeysOnFocusLoss;
|
||||
bool showAlerts;
|
||||
bool captureOnStart;
|
||||
bool quickSplash;
|
||||
|
Reference in New Issue
Block a user