[client] spice: add ability to set keyboard LED state in guest

FIXME: update PureSpice
This commit is contained in:
Quantum 2021-08-14 06:14:09 -04:00 committed by Geoffrey McRae
parent 0f6f89fa5b
commit 3a00277e93
2 changed files with 12 additions and 0 deletions

View file

@ -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);

View file

@ -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)
{