From: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx> It's breaking PPC's keyboard functionality, once this cast is getting the first byte (from left to right) on any architecture, what's wrong when we think in a PPC (we should get the last one, instead). Signed-off-by: Erlon R. Cruz <erlon.cruz@xxxxxxxxxxxxxxxxxx> Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@xxxxxxxxx> Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@xxxxxxxxxxxxxxxxxxxxx> --- server/inputs_channel.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/inputs_channel.c b/server/inputs_channel.c index e14e995..aa1cba9 100644 --- a/server/inputs_channel.c +++ b/server/inputs_channel.c @@ -289,28 +289,28 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui { InputsChannel *inputs_channel = (InputsChannel *)rcc->channel; InputsChannelClient *icc = (InputsChannelClient *)rcc; - uint8_t *buf = (uint8_t *)message; spice_assert(g_inputs_channel == inputs_channel); switch (type) { case SPICE_MSGC_INPUTS_KEY_DOWN: { - SpiceMsgcKeyDown *key_up = (SpiceMsgcKeyDown *)buf; + SpiceMsgcKeyDown *key_up = (SpiceMsgcKeyDown *)message; if (key_up->code == CAPS_LOCK_SCAN_CODE || key_up->code == NUM_LOCK_SCAN_CODE || key_up->code == SCROLL_LOCK_SCAN_CODE) { activate_modifiers_watch(); } } case SPICE_MSGC_INPUTS_KEY_UP: { - SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf; - uint8_t *now = (uint8_t *)&key_down->code; - uint8_t *end = now + sizeof(key_down->code); - for (; now < end && *now; now++) { - kbd_push_scan(keyboard, *now); + SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)message; + uint32_t code = key_down->code; + + for (; code != 0; code >>= 8) { + kbd_push_scan(keyboard, code & 0xff); } + break; } case SPICE_MSGC_INPUTS_MOUSE_MOTION: { - SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)buf; + SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)message; if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) { red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MOUSE_MOTION_ACK); @@ -325,7 +325,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui break; } case SPICE_MSGC_INPUTS_MOUSE_POSITION: { - SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *)buf; + SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *)message; if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) { red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MOUSE_MOTION_ACK); @@ -349,7 +349,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui break; } case SPICE_MSGC_INPUTS_MOUSE_PRESS: { - SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *)buf; + SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *)message; int dz = 0; if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) { dz = -1; @@ -377,7 +377,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui break; } case SPICE_MSGC_INPUTS_MOUSE_RELEASE: { - SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *)buf; + SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *)message; if (reds_get_mouse_mode() == SPICE_MOUSE_MODE_CLIENT) { if (reds_get_agent_mouse() && reds_has_vdagent()) { inputs_channel->mouse_state.buttons = @@ -397,7 +397,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui break; } case SPICE_MSGC_INPUTS_KEY_MODIFIERS: { - SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)buf; + SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)message; uint8_t leds; if (!keyboard) { -- 1.7.4.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel