diff --git a/client/include/app.h b/client/include/app.h index 19af32d5..79e8eae1 100644 --- a/client/include/app.h +++ b/client/include/app.h @@ -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 diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index b2bfa991..97b4a325 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -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" ); diff --git a/client/src/app.c b/client/src/app.c index d582fa77..327713a2 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -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; } diff --git a/client/src/keybind.c b/client/src/keybind.c index 988881df..25787ae0 100644 --- a/client/src/keybind.c +++ b/client/src/keybind.c @@ -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"); } } diff --git a/client/src/main.h b/client/src/main.h index 06e1a373..74a13cfc 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -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;