[client] keybind: add descriptions for all keybindings

This commit is contained in:
Quantum 2021-01-30 22:48:24 -05:00 committed by Geoffrey McRae
parent 4e765b063a
commit ead8069dae
5 changed files with 26 additions and 24 deletions

View File

@ -97,7 +97,7 @@ typedef void (*KeybindFn)(int sc, void * opaque);
* @retval A handle for the binding or NULL on failure.
* The caller is required to release the handle via `app_releaseKeybind` when it is no longer required
*/
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque);
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description);
/**
* Release an existing key binding

View File

@ -134,7 +134,7 @@ bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display)
egl_model_set_default((*desktop)->model);
egl_model_set_texture((*desktop)->model, (*desktop)->texture);
app_registerKeybind(KEY_N, egl_desktop_toggle_nv, *desktop);
app_registerKeybind(KEY_N, egl_desktop_toggle_nv, *desktop, "Toggle night vision mode");
(*desktop)->nvMax = option_get_int("egl", "nvGainMax");
(*desktop)->nvGain = option_get_int("egl", "nvGain" );

View File

@ -458,7 +458,7 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
free(buffer);
}
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque)
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description)
{
// don't allow duplicate binds
if (g_state.bindings[sc])
@ -473,6 +473,7 @@ KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque)
handle->opaque = opaque;
g_state.bindings[sc] = handle;
g_state.keyDescription[sc] = description;
return handle;
}

View File

@ -124,31 +124,31 @@ static void bind_passthrough(int sc, void * opaque)
void keybind_register(void)
{
app_registerKeybind(KEY_F, bind_fullscreen, NULL);
app_registerKeybind(KEY_V, bind_video , NULL);
app_registerKeybind(KEY_R, bind_rotate , NULL);
app_registerKeybind(KEY_Q, bind_quit , NULL);
app_registerKeybind(KEY_F, bind_fullscreen, NULL, "Full screen toggle");
app_registerKeybind(KEY_V, bind_video , NULL, "Video stream toggle");
app_registerKeybind(KEY_R, bind_rotate , NULL, "Rotate the output clockwise by 90° increments");
app_registerKeybind(KEY_Q, bind_quit , NULL, "Quit");
if (g_params.useSpiceInput)
{
app_registerKeybind(KEY_I , bind_input , NULL);
app_registerKeybind(KEY_INSERT, bind_mouseSens, (void*)true );
app_registerKeybind(KEY_DELETE, bind_mouseSens, (void*)false);
app_registerKeybind(KEY_I , bind_input , NULL , "Spice keyboard & mouse toggle");
app_registerKeybind(KEY_INSERT, bind_mouseSens, (void*)true , "Increase mouse sensitivity in capture mode");
app_registerKeybind(KEY_DELETE, bind_mouseSens, (void*)false, "Descrease mouse sensitivity in capture mode");
app_registerKeybind(KEY_F1 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F2 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F3 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F4 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F5 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F6 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F7 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F8 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F9 , bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F10, bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F11, bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F12, bind_ctrlAltFn, NULL);
app_registerKeybind(KEY_F1 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F1 to the guest");
app_registerKeybind(KEY_F2 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F2 to the guest");
app_registerKeybind(KEY_F3 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F3 to the guest");
app_registerKeybind(KEY_F4 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F4 to the guest");
app_registerKeybind(KEY_F5 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F5 to the guest");
app_registerKeybind(KEY_F6 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F6 to the guest");
app_registerKeybind(KEY_F7 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F7 to the guest");
app_registerKeybind(KEY_F8 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F8 to the guest");
app_registerKeybind(KEY_F9 , bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F9 to the guest");
app_registerKeybind(KEY_F10, bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F10 to the guest");
app_registerKeybind(KEY_F11, bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F11 to the guest");
app_registerKeybind(KEY_F12, bind_ctrlAltFn, NULL, "Send Ctrl+Alt+F12 to the guest");
app_registerKeybind(KEY_LEFTMETA , bind_passthrough, NULL);
app_registerKeybind(KEY_RIGHTMETA, bind_passthrough, NULL);
app_registerKeybind(KEY_LEFTMETA , bind_passthrough, NULL, "Send LWin to the guest");
app_registerKeybind(KEY_RIGHTMETA, bind_passthrough, NULL, "Send RWin to the guest");
}
}

View File

@ -50,6 +50,7 @@ struct AppState
bool escapeActive;
int escapeAction;
KeybindHandle bindings[KEY_MAX];
const char * keyDescription[KEY_MAX];
bool keyDown[KEY_MAX];
bool haveSrcSize;