[Spice-devel] [spice PATCH 40/55] inputs channel: fix using spice messages enums as pipe items type
Yonit Halperin
yhalperi at redhat.com
Wed Aug 15 00:56:20 PDT 2012
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 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 269e2dc..9f96624 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)
--
1.7.7.6
More information about the Spice-devel
mailing list