[client] add quit keybind

This commit is contained in:
feltcat 2020-04-22 17:31:30 +01:00 committed by Geoffrey McRae
parent b9cdaf8e19
commit e3cbdd18a0
3 changed files with 9 additions and 0 deletions

View File

@ -46,6 +46,7 @@ Below are a list of current key bindings:
| <kbd>ScrLk</kbd>+<kbd>F</kbd> | Full Screen toggle |
| <kbd>ScrLk</kbd>+<kbd>I</kbd> | Spice keyboard & mouse enable toggle |
| <kbd>ScrLk</kbd>+<kbd>N</kbd> | Toggle night vision mode (EGL renderer only!) |
| <kbd>ScrLk</kbd>+<kbd>Q</kbd> | Quit |
| <kbd>ScrLk</kbd>+<kbd>Insert</kbd> | Increase mouse sensitivity (in capture mode only) |
| <kbd>ScrLk</kbd>+<kbd>Del</kbd> | Decrease mouse sensitivity (in capture mode only) |
| <kbd>ScrLk</kbd>+<kbd>F1</kbd> | Send <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>F1</kbd> to the guest |

View File

@ -1082,6 +1082,11 @@ static void toggle_input(SDL_Scancode key, void * opaque)
);
}
static void quit(SDL_Scancode key, void * opaque)
{
state.running = false;
}
static void mouse_sens_inc(SDL_Scancode key, void * opaque)
{
char * msg;
@ -1130,6 +1135,7 @@ static void register_key_binds()
{
state.kbFS = app_register_keybind(SDL_SCANCODE_F , toggle_fullscreen, NULL);
state.kbInput = app_register_keybind(SDL_SCANCODE_I , toggle_input , NULL);
state.kbQuit = app_register_keybind(SDL_SCANCODE_Q , quit , NULL);
state.kbMouseSensInc = app_register_keybind(SDL_SCANCODE_INSERT, mouse_sens_inc , NULL);
state.kbMouseSensDec = app_register_keybind(SDL_SCANCODE_DELETE, mouse_sens_dec , NULL);
@ -1151,6 +1157,7 @@ static void release_key_binds()
{
app_release_keybind(&state.kbFS);
app_release_keybind(&state.kbInput);
app_release_keybind(&state.kbQuit);
for(int i = 0; i < 12; ++i)
app_release_keybind(&state.kbCtrlAltFn[i]);
}

View File

@ -87,6 +87,7 @@ struct AppState
KeybindHandle kbFS;
KeybindHandle kbInput;
KeybindHandle kbQuit;
KeybindHandle kbMouseSensInc;
KeybindHandle kbMouseSensDec;
KeybindHandle kbCtrlAltFn[12];