Fixed mouse drag handling.

This commit is contained in:
Michael Jumper 2011-07-25 14:57:40 -07:00
parent 3e9bfbf79d
commit 344b215554

View File

@ -319,23 +319,24 @@ int rdp_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data;
rdpInst* rdp_inst = guac_client_data->rdp_inst; rdpInst* rdp_inst = guac_client_data->rdp_inst;
/* If no buttons pressed */ /* If button mask unchanged, just send move event */
if (mask == 0) { if (mask == guac_client_data->mouse_button_mask)
/* Send mouse move event if no buttons pressed before */
if (guac_client_data->mouse_button_mask == 0)
rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_MOVE, x, y); rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_MOVE, x, y);
/* Otherwise, send mouse up event, releasing any old buttons */ /* Otherwise, send events describing button change */
else else {
rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_BUTTON1, x, y);
}
/* Otherwise, send mouse down event */ /* Release event */
if (mask == 0)
rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_BUTTON1, x, y);
/* Press event */
else else
rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_DOWN | PTRFLAGS_BUTTON1, x, y); rdp_inst->rdp_send_input(rdp_inst, RDP_INPUT_MOUSE, PTRFLAGS_DOWN | PTRFLAGS_BUTTON1, x, y);
guac_client_data->mouse_button_mask = mask; guac_client_data->mouse_button_mask = mask;
}
return 0; return 0;
} }