From 3a00277e93f76691bbd0b78020b6064d9122105c Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 14 Aug 2021 06:14:09 -0400 Subject: [PATCH] [client] spice: add ability to set keyboard LED state in guest FIXME: update PureSpice --- client/include/app.h | 1 + client/src/app.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/client/include/app.h b/client/include/app.h index 72da3c66..caa9d687 100644 --- a/client/include/app.h +++ b/client/include/app.h @@ -62,6 +62,7 @@ void app_handleKeyPress(int scancode); void app_handleKeyRelease(int scancode); void app_handleKeyboardTyped(const char * typed); void app_handleKeyboardModifiers(bool ctrl, bool shift, bool alt, bool super); +void app_handleKeyboardLEDs(bool numLock, bool capsLock, bool scrollLock); void app_handleEnterEvent(bool entered); void app_handleFocusEvent(bool focused); void app_handleCloseEvent(void); diff --git a/client/src/app.c b/client/src/app.c index c73d5628..3f4a29ff 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -412,6 +412,17 @@ void app_handleKeyboardModifiers(bool ctrl, bool shift, bool alt, bool super) g_state.io->KeySuper = super; } +void app_handleKeyboardLEDs(bool numLock, bool capsLock, bool scrollLock) +{ + uint32_t modifiers = + (scrollLock ? 1 /* SPICE_SCROLL_LOCK_MODIFIER */ : 0) | + (numLock ? 2 /* SPICE_NUM_LOCK_MODIFIER */ : 0) | + (capsLock ? 4 /* SPICE_CAPS_LOCK_MODIFIER */ : 0); + + if (!spice_key_modifiers(modifiers)) + DEBUG_ERROR("app_handleKeyboardLEDs: failed to send message"); +} + void app_handleMouseRelative(double normx, double normy, double rawx, double rawy) {