[Spice-devel] [PATCH spice-server 11/11] inputs-channel: Move spice_server_kbd_leds to InputsChannel
Christophe Fergeau
cfergeau at redhat.com
Tue Dec 19 16:14:59 UTC 2017
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
On Mon, Dec 11, 2017 at 10:28:08AM +0000, Frediano Ziglio wrote:
> This avoids to expose some detail about the channel.
> Like other APIs implement it move close to the part that handle
> it instead of have everything in reds.c.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/inputs-channel.c | 18 +++++++-----------
> server/inputs-channel.h | 2 --
> server/reds.c | 7 -------
> 3 files changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> index 51e25969..3b2118f9 100644
> --- a/server/inputs-channel.c
> +++ b/server/inputs-channel.c
> @@ -68,25 +68,20 @@ struct SpiceKbdState {
> /* track key press state */
> bool key[0x80];
> bool key_ext[0x80];
> - RedsState *reds;
> + InputsChannel *inputs;
> };
>
> static SpiceKbdInstance* inputs_channel_get_keyboard(InputsChannel *inputs);
> static SpiceMouseInstance* inputs_channel_get_mouse(InputsChannel *inputs);
> static SpiceTabletInstance* inputs_channel_get_tablet(InputsChannel *inputs);
>
> -static SpiceKbdState* spice_kbd_state_new(RedsState *reds)
> +static SpiceKbdState* spice_kbd_state_new(InputsChannel *inputs)
> {
> SpiceKbdState *st = g_new0(SpiceKbdState, 1);
> - st->reds = reds;
> + st->inputs = inputs;
> return st;
> }
>
> -RedsState* spice_kbd_state_get_server(SpiceKbdState *dev)
> -{
> - return dev->reds;
> -}
> -
> struct SpiceMouseState {
> int dummy;
> };
> @@ -485,9 +480,10 @@ static void inputs_channel_push_keyboard_modifiers(InputsChannel *inputs, uint8_
> red_inputs_key_modifiers_item_new(modifiers));
> }
>
> -void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds)
> +SPICE_GNUC_VISIBLE int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds)
> {
> - inputs_channel_push_keyboard_modifiers(inputs, leds);
> + inputs_channel_push_keyboard_modifiers(sin->st->inputs, leds);
> + return 0;
> }
>
> static void key_modifiers_sender(void *opaque)
> @@ -615,7 +611,7 @@ int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboar
> return -1;
> }
> inputs->keyboard = keyboard;
> - inputs->keyboard->st = spice_kbd_state_new(red_channel_get_server(RED_CHANNEL(inputs)));
> + inputs->keyboard->st = spice_kbd_state_new(inputs);
> return 0;
> }
>
> diff --git a/server/inputs-channel.h b/server/inputs-channel.h
> index 1082d66c..945ba617 100644
> --- a/server/inputs-channel.h
> +++ b/server/inputs-channel.h
> @@ -47,7 +47,6 @@ GType inputs_channel_get_type(void) G_GNUC_CONST;
> InputsChannel* inputs_channel_new(RedsState *reds);
>
> const VDAgentMouseState *inputs_channel_get_mouse_state(InputsChannel *inputs);
> -void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds);
> void inputs_channel_set_tablet_logical_size(InputsChannel *inputs, int x_res, int y_res);
>
> int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboard);
> @@ -56,7 +55,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);
> gboolean inputs_channel_is_src_during_migrate(InputsChannel *inputs);
> void inputs_release_keys(InputsChannel *inputs);
>
> diff --git a/server/reds.c b/server/reds.c
> index 761afa77..9338b78b 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -4002,13 +4002,6 @@ SPICE_GNUC_VISIBLE int spice_server_add_renderer(SpiceServer *reds, const char *
> return 0;
> }
>
> -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;
> -}
> -
> SPICE_GNUC_VISIBLE int spice_server_set_streaming_video(SpiceServer *reds, int value)
> {
> if (value != SPICE_STREAM_VIDEO_OFF &&
> --
> 2.14.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20171219/0d4578e3/attachment-0001.sig>
More information about the Spice-devel
mailing list