GUACAMOLE-313: Include current button state within mouse update for completeness.
This commit is contained in:
parent
7eb4e22515
commit
81a0e66d9f
@ -102,6 +102,21 @@ typedef struct guac_common_cursor {
|
||||
*/
|
||||
int y;
|
||||
|
||||
/**
|
||||
* An integer value representing the current state of each button, where
|
||||
* the Nth bit within the integer is set to 1 if and only if the Nth mouse
|
||||
* button is currently pressed. The lowest-order bit is the left mouse
|
||||
* button, followed by the middle button, right button, and finally the up
|
||||
* and down buttons of the scroll wheel.
|
||||
*
|
||||
* @see GUAC_CLIENT_MOUSE_LEFT
|
||||
* @see GUAC_CLIENT_MOUSE_MIDDLE
|
||||
* @see GUAC_CLIENT_MOUSE_RIGHT
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_UP
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_DOWN
|
||||
*/
|
||||
int button_mask;
|
||||
|
||||
/**
|
||||
* The server timestamp representing the point in time when the mousr
|
||||
* location was last updated.
|
||||
@ -148,12 +163,12 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
||||
guac_socket* socket);
|
||||
|
||||
/**
|
||||
* Moves the mouse cursor, marking the given user as the most recent user of
|
||||
* the mouse. The remote mouse cursor will be hidden for this user and shown
|
||||
* for all others.
|
||||
* Updates the current position and button state of the mouse cursor, marking
|
||||
* the given user as the most recent user of the mouse. The remote mouse cursor
|
||||
* will be hidden for this user and shown for all others.
|
||||
*
|
||||
* @param cursor
|
||||
* The cursor being moved.
|
||||
* The cursor being updated.
|
||||
*
|
||||
* @param user
|
||||
* The user that moved the cursor.
|
||||
@ -163,9 +178,22 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
||||
*
|
||||
* @param y
|
||||
* The new Y coordinate of the cursor.
|
||||
*
|
||||
* @param button_mask
|
||||
* An integer value representing the current state of each button, where
|
||||
* the Nth bit within the integer is set to 1 if and only if the Nth mouse
|
||||
* button is currently pressed. The lowest-order bit is the left mouse
|
||||
* button, followed by the middle button, right button, and finally the up
|
||||
* and down buttons of the scroll wheel.
|
||||
*
|
||||
* @see GUAC_CLIENT_MOUSE_LEFT
|
||||
* @see GUAC_CLIENT_MOUSE_MIDDLE
|
||||
* @see GUAC_CLIENT_MOUSE_RIGHT
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_UP
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_DOWN
|
||||
*/
|
||||
void guac_common_cursor_move(guac_common_cursor* cursor, guac_user* user,
|
||||
int x, int y);
|
||||
void guac_common_cursor_update(guac_common_cursor* cursor, guac_user* user,
|
||||
int x, int y, int button_mask);
|
||||
|
||||
/**
|
||||
* Sets the cursor image to the given raw image data. This raw image data must
|
||||
|
@ -102,7 +102,7 @@ guac_common_recording* guac_common_recording_create(guac_client* client,
|
||||
void guac_common_recording_free(guac_common_recording* recording);
|
||||
|
||||
/**
|
||||
* Reports the current mouse position within the recording.
|
||||
* Reports the current mouse position and button state within the recording.
|
||||
*
|
||||
* @param recording
|
||||
* The guac_common_recording associated with the mouse that has moved.
|
||||
@ -112,9 +112,22 @@ void guac_common_recording_free(guac_common_recording* recording);
|
||||
*
|
||||
* @param y
|
||||
* The new Y coordinate of the mouse cursor, in pixels.
|
||||
*
|
||||
* @param button_mask
|
||||
* An integer value representing the current state of each button, where
|
||||
* the Nth bit within the integer is set to 1 if and only if the Nth mouse
|
||||
* button is currently pressed. The lowest-order bit is the left mouse
|
||||
* button, followed by the middle button, right button, and finally the up
|
||||
* and down buttons of the scroll wheel.
|
||||
*
|
||||
* @see GUAC_CLIENT_MOUSE_LEFT
|
||||
* @see GUAC_CLIENT_MOUSE_MIDDLE
|
||||
* @see GUAC_CLIENT_MOUSE_RIGHT
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_UP
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_DOWN
|
||||
*/
|
||||
void guac_common_recording_report_mouse(guac_common_recording* recording,
|
||||
int x, int y);
|
||||
int x, int y, int button_mask);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -103,7 +103,7 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
||||
guac_socket* socket) {
|
||||
|
||||
/* Synchronize location */
|
||||
guac_protocol_send_mouse(socket, cursor->x, cursor->y,
|
||||
guac_protocol_send_mouse(socket, cursor->x, cursor->y, cursor->button_mask,
|
||||
cursor->timestamp);
|
||||
|
||||
/* Synchronize cursor image */
|
||||
@ -125,24 +125,25 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
||||
|
||||
/**
|
||||
* Callback for guac_client_foreach_user() which sends the current cursor
|
||||
* position to any given user except the user that moved the cursor last.
|
||||
* position and button state to any given user except the user that moved the
|
||||
* cursor last.
|
||||
*
|
||||
* @param data
|
||||
* A pointer to the guac_common_cursor whose position should be broadcast
|
||||
* to all users except the user that moved the cursor last.
|
||||
* A pointer to the guac_common_cursor whose state should be broadcast to
|
||||
* all users except the user that moved the cursor last.
|
||||
*
|
||||
* @return
|
||||
* Always NULL.
|
||||
*/
|
||||
static void* guac_common_cursor_broadcast_position(guac_user* user,
|
||||
static void* guac_common_cursor_broadcast_state(guac_user* user,
|
||||
void* data) {
|
||||
|
||||
guac_common_cursor* cursor = (guac_common_cursor*) data;
|
||||
|
||||
/* Send cursor position only if the user is not moving the cursor */
|
||||
/* Send cursor state only if the user is not moving the cursor */
|
||||
if (user != cursor->user) {
|
||||
guac_protocol_send_mouse(user->socket, cursor->x, cursor->y,
|
||||
cursor->timestamp);
|
||||
cursor->button_mask, cursor->timestamp);
|
||||
guac_socket_flush(user->socket);
|
||||
}
|
||||
|
||||
@ -150,22 +151,23 @@ static void* guac_common_cursor_broadcast_position(guac_user* user,
|
||||
|
||||
}
|
||||
|
||||
void guac_common_cursor_move(guac_common_cursor* cursor, guac_user* user,
|
||||
int x, int y) {
|
||||
void guac_common_cursor_update(guac_common_cursor* cursor, guac_user* user,
|
||||
int x, int y, int button_mask) {
|
||||
|
||||
/* Update current user of cursor */
|
||||
cursor->user = user;
|
||||
|
||||
/* Update cursor position */
|
||||
/* Update cursor state */
|
||||
cursor->x = x;
|
||||
cursor->y = y;
|
||||
cursor->button_mask = button_mask;
|
||||
|
||||
/* Store time at which cursor position was updated */
|
||||
/* Store time at which cursor was updated */
|
||||
cursor->timestamp = guac_timestamp_current();
|
||||
|
||||
/* Notify all other users of change in cursor position */
|
||||
/* Notify all other users of change in cursor state */
|
||||
guac_client_foreach_user(cursor->client,
|
||||
guac_common_cursor_broadcast_position, cursor);
|
||||
guac_common_cursor_broadcast_state, cursor);
|
||||
|
||||
}
|
||||
|
||||
|
@ -180,10 +180,10 @@ void guac_common_recording_free(guac_common_recording* recording) {
|
||||
}
|
||||
|
||||
void guac_common_recording_report_mouse(guac_common_recording* recording,
|
||||
int x, int y) {
|
||||
int x, int y, int button_mask) {
|
||||
|
||||
/* Report mouse location */
|
||||
guac_protocol_send_mouse(recording->socket, x, y,
|
||||
guac_protocol_send_mouse(recording->socket, x, y, button_mask,
|
||||
guac_timestamp_current());
|
||||
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ int guacenc_handle_mouse(guacenc_display* display, int argc, char** argv) {
|
||||
cursor->y = y;
|
||||
|
||||
/* If no timestamp provided, nothing further to do */
|
||||
if (argc < 3)
|
||||
if (argc < 4)
|
||||
return 0;
|
||||
|
||||
/* Leverage timestamp to render frame */
|
||||
guac_timestamp timestamp = guacenc_parse_timestamp(argv[2]);
|
||||
guac_timestamp timestamp = guacenc_parse_timestamp(argv[3]);
|
||||
return guacenc_display_sync(display, timestamp);
|
||||
|
||||
}
|
||||
|
@ -159,6 +159,19 @@ int vguac_protocol_send_log(guac_socket* socket, const char* format,
|
||||
* @param y
|
||||
* The Y coordinate of the current mouse position.
|
||||
*
|
||||
* @param button_mask
|
||||
* An integer value representing the current state of each button, where
|
||||
* the Nth bit within the integer is set to 1 if and only if the Nth mouse
|
||||
* button is currently pressed. The lowest-order bit is the left mouse
|
||||
* button, followed by the middle button, right button, and finally the up
|
||||
* and down buttons of the scroll wheel.
|
||||
*
|
||||
* @see GUAC_CLIENT_MOUSE_LEFT
|
||||
* @see GUAC_CLIENT_MOUSE_MIDDLE
|
||||
* @see GUAC_CLIENT_MOUSE_RIGHT
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_UP
|
||||
* @see GUAC_CLIENT_MOUSE_SCROLL_DOWN
|
||||
*
|
||||
* @param timestamp
|
||||
* The server timestamp (in milliseconds) at the point in time this mouse
|
||||
* position was acknowledged.
|
||||
@ -167,7 +180,7 @@ int vguac_protocol_send_log(guac_socket* socket, const char* format,
|
||||
* Zero on success, non-zero on error.
|
||||
*/
|
||||
int guac_protocol_send_mouse(guac_socket* socket, int x, int y,
|
||||
guac_timestamp timestamp);
|
||||
int button_mask, guac_timestamp timestamp);
|
||||
|
||||
/**
|
||||
* Sends a nest instruction over the given guac_socket connection.
|
||||
|
@ -685,7 +685,7 @@ int guac_protocol_send_lstroke(guac_socket* socket,
|
||||
}
|
||||
|
||||
int guac_protocol_send_mouse(guac_socket* socket, int x, int y,
|
||||
guac_timestamp timestamp) {
|
||||
int button_mask, guac_timestamp timestamp) {
|
||||
|
||||
int ret_val;
|
||||
|
||||
@ -696,6 +696,8 @@ int guac_protocol_send_mouse(guac_socket* socket, int x, int y,
|
||||
|| guac_socket_write_string(socket, ",")
|
||||
|| __guac_socket_write_length_int(socket, y)
|
||||
|| guac_socket_write_string(socket, ",")
|
||||
|| __guac_socket_write_length_int(socket, button_mask)
|
||||
|| guac_socket_write_string(socket, ",")
|
||||
|| __guac_socket_write_length_int(socket, timestamp)
|
||||
|| guac_socket_write_string(socket, ";");
|
||||
|
||||
|
@ -47,12 +47,12 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Store current mouse location */
|
||||
guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
|
||||
/* Store current mouse location/state */
|
||||
guac_common_cursor_update(rdp_client->display->cursor, user, x, y, mask);
|
||||
|
||||
/* Report mouse position within recording */
|
||||
if (rdp_client->recording != NULL)
|
||||
guac_common_recording_report_mouse(rdp_client->recording, x, y);
|
||||
guac_common_recording_report_mouse(rdp_client->recording, x, y, mask);
|
||||
|
||||
/* If button mask unchanged, just send move event */
|
||||
if (mask == rdp_client->mouse_button_mask)
|
||||
|
@ -43,7 +43,7 @@ int guac_ssh_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
|
||||
/* Report mouse position within recording */
|
||||
if (ssh_client->recording != NULL)
|
||||
guac_common_recording_report_mouse(ssh_client->recording, x, y);
|
||||
guac_common_recording_report_mouse(ssh_client->recording, x, y, mask);
|
||||
|
||||
/* Send mouse event */
|
||||
guac_terminal_send_mouse(term, user, x, y, mask);
|
||||
|
@ -45,7 +45,8 @@ int guac_telnet_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
|
||||
/* Report mouse position within recording */
|
||||
if (telnet_client->recording != NULL)
|
||||
guac_common_recording_report_mouse(telnet_client->recording, x, y);
|
||||
guac_common_recording_report_mouse(telnet_client->recording, x, y,
|
||||
mask);
|
||||
|
||||
/* Send mouse if not searching for password or username */
|
||||
if (settings->password_regex == NULL && settings->username_regex == NULL)
|
||||
|
@ -33,12 +33,12 @@ int guac_vnc_user_mouse_handler(guac_user* user, int x, int y, int mask) {
|
||||
guac_vnc_client* vnc_client = (guac_vnc_client*) client->data;
|
||||
rfbClient* rfb_client = vnc_client->rfb_client;
|
||||
|
||||
/* Store current mouse location */
|
||||
guac_common_cursor_move(vnc_client->display->cursor, user, x, y);
|
||||
/* Store current mouse location/state */
|
||||
guac_common_cursor_update(vnc_client->display->cursor, user, x, y, mask);
|
||||
|
||||
/* Report mouse position within recording */
|
||||
if (vnc_client->recording != NULL)
|
||||
guac_common_recording_report_mouse(vnc_client->recording, x, y);
|
||||
guac_common_recording_report_mouse(vnc_client->recording, x, y, mask);
|
||||
|
||||
/* Send VNC event only if finished connecting */
|
||||
if (rfb_client != NULL)
|
||||
|
@ -1670,8 +1670,8 @@ static int __guac_terminal_send_mouse(guac_terminal* term, guac_user* user,
|
||||
int released_mask = term->mouse_mask & ~mask;
|
||||
int pressed_mask = ~term->mouse_mask & mask;
|
||||
|
||||
/* Store current mouse location */
|
||||
guac_common_cursor_move(term->cursor, user, x, y);
|
||||
/* Store current mouse location/state */
|
||||
guac_common_cursor_update(term->cursor, user, x, y, mask);
|
||||
|
||||
/* Notify scrollbar, do not handle anything handled by scrollbar */
|
||||
if (guac_terminal_scrollbar_handle_mouse(term->scrollbar, x, y, mask)) {
|
||||
|
Loading…
Reference in New Issue
Block a user