diff --git a/server/inputs-channel.c b/server/inputs-channel.c index 5e884f47..38b23dfa 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -61,11 +61,19 @@ struct SpiceKbdState { /* track key press state */ bool key[0x7f]; bool key_ext[0x7f]; + RedsState *reds; }; -static SpiceKbdState* spice_kbd_state_new(void) +static SpiceKbdState* spice_kbd_state_new(RedsState *reds) { - return spice_new0(SpiceKbdState, 1); + SpiceKbdState *st = spice_new0(SpiceKbdState, 1); + st->reds = reds; + return st; +} + +RedsState* spice_kbd_state_get_server(SpiceKbdState *dev) +{ + return dev->reds; } struct SpiceMouseState { @@ -666,7 +674,7 @@ int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboar return -1; } inputs->keyboard = keyboard; - inputs->keyboard->st = spice_kbd_state_new(); + inputs->keyboard->st = spice_kbd_state_new(reds); return 0; } diff --git a/server/inputs-channel.h b/server/inputs-channel.h index 31574b5c..4070a237 100644 --- a/server/inputs-channel.h +++ b/server/inputs-channel.h @@ -40,5 +40,6 @@ int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet int inputs_channel_has_tablet(InputsChannel *inputs); void inputs_channel_detach_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet); RedsState* spice_tablet_state_get_server(SpiceTabletState *dev); +RedsState* spice_kbd_state_get_server(SpiceKbdState *dev); #endif diff --git a/server/reds.c b/server/reds.c index ef6c8504..91a93a19 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3780,6 +3780,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_renderer(SpiceServer *s, const char *nam SPICE_GNUC_VISIBLE int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds) { + RedsState *reds = spice_kbd_state_get_server(sin->st); inputs_channel_on_keyboard_leds_change(reds->inputs_channel, leds); return 0; }