From 5aec370a7a7c588572f7edace41a3ce2c482c555 Mon Sep 17 00:00:00 2001 From: Yonit Halperin Date: Sun, 5 Aug 2012 22:20:08 +0300 Subject: inputs channel: fix using spice messages enums as pipe items type A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE. SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK. --- server/inputs_channel.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'server/inputs_channel.c') diff --git a/server/inputs_channel.c b/server/inputs_channel.c index 269e2dc4..9f96624a 100644 --- a/server/inputs_channel.c +++ b/server/inputs_channel.c @@ -73,10 +73,9 @@ typedef struct InputsChannel { } InputsChannel; enum { - PIPE_ITEM_INPUTS_INIT = SPICE_MSG_INPUTS_INIT, - PIPE_ITEM_MOUSE_MOTION_ACK = SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, - PIPE_ITEM_KEY_MODIFIERS = SPICE_MSG_INPUTS_KEY_MODIFIERS, - PIPE_ITEM_MIGRATE = SPICE_MSG_MIGRATE, + PIPE_ITEM_INPUTS_INIT = PIPE_ITEM_TYPE_CHANNEL_BASE, + PIPE_ITEM_MOUSE_MOTION_ACK, + PIPE_ITEM_KEY_MODIFIERS, }; typedef struct InputsPipeItem { @@ -252,33 +251,32 @@ static void inputs_channel_send_item(RedChannelClient *rcc, PipeItem *base) { SpiceMarshaller *m = red_channel_client_get_marshaller(rcc); - red_channel_client_init_send_data(rcc, base->type, base); switch (base->type) { case PIPE_ITEM_KEY_MODIFIERS: { SpiceMsgInputsKeyModifiers key_modifiers; + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS, base); key_modifiers.modifiers = SPICE_CONTAINEROF(base, KeyModifiersPipeItem, base)->modifiers; spice_marshall_msg_inputs_key_modifiers(m, &key_modifiers); + break; } case PIPE_ITEM_INPUTS_INIT: { SpiceMsgInputsInit inputs_init; + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT, base); inputs_init.keyboard_modifiers = SPICE_CONTAINEROF(base, InputsInitPipeItem, base)->modifiers; spice_marshall_msg_inputs_init(m, &inputs_init); - } - case PIPE_ITEM_MIGRATE: - { - SpiceMsgMigrate migrate; - - migrate.flags = 0; - spice_marshall_msg_migrate(m, &migrate); break; } + case PIPE_ITEM_MOUSE_MOTION_ACK: + red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, base); + break; default: + spice_warning("invalid pipe iten %d", base->type); break; } red_channel_client_begin_send_message(rcc); @@ -452,7 +450,7 @@ static void inputs_channel_on_disconnect(RedChannelClient *rcc) static void inputs_migrate(RedChannelClient *rcc) { spice_assert(g_inputs_channel == (InputsChannel *)rcc->channel); - red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MIGRATE); + red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_MIGRATE); } static void inputs_pipe_add_init(RedChannelClient *rcc) -- cgit