mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +00:00
[client] Allow keyboard capture (#26)
This commit is contained in:
parent
8a9d0b0bfb
commit
b19518a1f8
@ -101,6 +101,7 @@ struct AppParams
|
|||||||
bool hideMouse;
|
bool hideMouse;
|
||||||
bool ignoreQuit;
|
bool ignoreQuit;
|
||||||
bool allowScreensaver;
|
bool allowScreensaver;
|
||||||
|
bool grabKeyboard;
|
||||||
SDL_Scancode captureKey;
|
SDL_Scancode captureKey;
|
||||||
|
|
||||||
bool forceRenderer;
|
bool forceRenderer;
|
||||||
@ -134,6 +135,7 @@ struct AppParams params =
|
|||||||
.ignoreQuit = false,
|
.ignoreQuit = false,
|
||||||
.allowScreensaver = true,
|
.allowScreensaver = true,
|
||||||
.captureKey = SDL_SCANCODE_SCROLLLOCK,
|
.captureKey = SDL_SCANCODE_SCROLLLOCK,
|
||||||
|
.grabKeyboard = true,
|
||||||
.forceRenderer = false
|
.forceRenderer = false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -526,6 +528,7 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||||||
serverMode = !serverMode;
|
serverMode = !serverMode;
|
||||||
spice_mouse_mode(serverMode);
|
spice_mouse_mode(serverMode);
|
||||||
SDL_SetRelativeMouseMode(serverMode);
|
SDL_SetRelativeMouseMode(serverMode);
|
||||||
|
SDL_SetWindowGrab(state.window, serverMode);
|
||||||
DEBUG_INFO("Server Mode: %s", serverMode ? "on" : "off");
|
DEBUG_INFO("Server Mode: %s", serverMode ? "on" : "off");
|
||||||
|
|
||||||
if (state.lgr)
|
if (state.lgr)
|
||||||
@ -1070,6 +1073,7 @@ void doHelp(char * app)
|
|||||||
" -b HEIGHT Initial window height [current: %u]\n"
|
" -b HEIGHT Initial window height [current: %u]\n"
|
||||||
" -Q Ignore requests to quit (ie: Alt+F4)\n"
|
" -Q Ignore requests to quit (ie: Alt+F4)\n"
|
||||||
" -S Disable the screensaver\n"
|
" -S Disable the screensaver\n"
|
||||||
|
" -G Don't capture the keyboard in capture mode\n"
|
||||||
" -m CODE Specify the capture key [current: %u (%s)]\n"
|
" -m CODE Specify the capture key [current: %u (%s)]\n"
|
||||||
" See https://wiki.libsdl.org/SDLScancodeLookup for valid values\n"
|
" See https://wiki.libsdl.org/SDLScancodeLookup for valid values\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -1314,7 +1318,7 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
switch(getopt(argc, argv, "hC:f:L:sc:p:jMvK:kg:o:anrdFx:y:w:b:QSm:l"))
|
switch(getopt(argc, argv, "hC:f:L:sc:p:jMvK:kg:o:anrdFx:y:w:b:QSGm:l"))
|
||||||
{
|
{
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
@ -1539,6 +1543,10 @@ int main(int argc, char * argv[])
|
|||||||
params.allowScreensaver = false;
|
params.allowScreensaver = false;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case 'G':
|
||||||
|
params.grabKeyboard = false;
|
||||||
|
continue;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
params.captureKey = atoi(optarg);
|
params.captureKey = atoi(optarg);
|
||||||
continue;
|
continue;
|
||||||
@ -1557,6 +1565,11 @@ int main(int argc, char * argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.grabKeyboard)
|
||||||
|
{
|
||||||
|
SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
|
||||||
|
}
|
||||||
|
|
||||||
const int ret = run();
|
const int ret = run();
|
||||||
|
|
||||||
free(params.shmFile);
|
free(params.shmFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user