mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] added new option input:grabKeyboardOnFocus
This commit is contained in:
parent
dea7177d29
commit
bbcaaccdcc
@ -244,6 +244,13 @@ static struct Option options[] =
|
|||||||
.type = OPTION_TYPE_BOOL,
|
.type = OPTION_TYPE_BOOL,
|
||||||
.value.x_bool = true,
|
.value.x_bool = true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.module = "input",
|
||||||
|
.name = "grabKeyboardOnFocus",
|
||||||
|
.description = "Grab the keyboard when focused",
|
||||||
|
.type = OPTION_TYPE_BOOL,
|
||||||
|
.value.x_bool = true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.module = "input",
|
.module = "input",
|
||||||
.name = "escapeKey",
|
.name = "escapeKey",
|
||||||
@ -434,6 +441,7 @@ bool config_load(int argc, char * argv[])
|
|||||||
params.quickSplash = option_get_bool ("win", "quickSplash" );
|
params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||||
|
|
||||||
params.grabKeyboard = option_get_bool ("input", "grabKeyboard" );
|
params.grabKeyboard = option_get_bool ("input", "grabKeyboard" );
|
||||||
|
params.grabKeyboardOnFocus = option_get_bool ("input", "grabKeyboardOnFocus");
|
||||||
params.escapeKey = option_get_int ("input", "escapeKey" );
|
params.escapeKey = option_get_int ("input", "escapeKey" );
|
||||||
params.hideMouse = option_get_bool ("input", "hideCursor" );
|
params.hideMouse = option_get_bool ("input", "hideCursor" );
|
||||||
params.mouseSens = option_get_int ("input", "mouseSens" );
|
params.mouseSens = option_get_int ("input", "mouseSens" );
|
||||||
|
@ -928,6 +928,9 @@ static void handleWindowEnter()
|
|||||||
// only called for X11
|
// only called for X11
|
||||||
static void keyboardGrab()
|
static void keyboardGrab()
|
||||||
{
|
{
|
||||||
|
if (!params.grabKeyboardOnFocus)
|
||||||
|
return;
|
||||||
|
|
||||||
// grab the keyboard so we can intercept WM keys
|
// grab the keyboard so we can intercept WM keys
|
||||||
XGrabKeyboard(
|
XGrabKeyboard(
|
||||||
state.wminfo.info.x11.display,
|
state.wminfo.info.x11.display,
|
||||||
@ -942,6 +945,9 @@ static void keyboardGrab()
|
|||||||
// only called for X11
|
// only called for X11
|
||||||
static void keyboardUngrab()
|
static void keyboardUngrab()
|
||||||
{
|
{
|
||||||
|
if (!params.grabKeyboardOnFocus)
|
||||||
|
return;
|
||||||
|
|
||||||
// ungrab the keyboard
|
// ungrab the keyboard
|
||||||
XUngrabKeyboard(
|
XUngrabKeyboard(
|
||||||
state.wminfo.info.x11.display,
|
state.wminfo.info.x11.display,
|
||||||
|
@ -151,6 +151,7 @@ struct AppParams
|
|||||||
bool ignoreQuit;
|
bool ignoreQuit;
|
||||||
bool noScreensaver;
|
bool noScreensaver;
|
||||||
bool grabKeyboard;
|
bool grabKeyboard;
|
||||||
|
bool grabKeyboardOnFocus;
|
||||||
SDL_Scancode escapeKey;
|
SDL_Scancode escapeKey;
|
||||||
bool showAlerts;
|
bool showAlerts;
|
||||||
bool captureOnStart;
|
bool captureOnStart;
|
||||||
|
Loading…
Reference in New Issue
Block a user