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;
|
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
|
* The server timestamp representing the point in time when the mousr
|
||||||
* location was last updated.
|
* location was last updated.
|
||||||
@ -148,12 +163,12 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
|||||||
guac_socket* socket);
|
guac_socket* socket);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the mouse cursor, marking the given user as the most recent user of
|
* Updates the current position and button state of the mouse cursor, marking
|
||||||
* the mouse. The remote mouse cursor will be hidden for this user and shown
|
* the given user as the most recent user of the mouse. The remote mouse cursor
|
||||||
* for all others.
|
* will be hidden for this user and shown for all others.
|
||||||
*
|
*
|
||||||
* @param cursor
|
* @param cursor
|
||||||
* The cursor being moved.
|
* The cursor being updated.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* The user that moved the cursor.
|
* The user that moved the cursor.
|
||||||
@ -163,9 +178,22 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
|||||||
*
|
*
|
||||||
* @param y
|
* @param y
|
||||||
* The new Y coordinate of the cursor.
|
* 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,
|
void guac_common_cursor_update(guac_common_cursor* cursor, guac_user* user,
|
||||||
int x, int y);
|
int x, int y, int button_mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the cursor image to the given raw image data. This raw image data must
|
* 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);
|
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
|
* @param recording
|
||||||
* The guac_common_recording associated with the mouse that has moved.
|
* 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
|
* @param y
|
||||||
* The new Y coordinate of the mouse cursor, in pixels.
|
* 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,
|
void guac_common_recording_report_mouse(guac_common_recording* recording,
|
||||||
int x, int y);
|
int x, int y, int button_mask);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void guac_common_cursor_dup(guac_common_cursor* cursor, guac_user* user,
|
|||||||
guac_socket* socket) {
|
guac_socket* socket) {
|
||||||
|
|
||||||
/* Synchronize location */
|
/* 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);
|
cursor->timestamp);
|
||||||
|
|
||||||
/* Synchronize cursor image */
|
/* 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
|
* 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
|
* @param data
|
||||||
* A pointer to the guac_common_cursor whose position should be broadcast
|
* A pointer to the guac_common_cursor whose state should be broadcast to
|
||||||
* to all users except the user that moved the cursor last.
|
* all users except the user that moved the cursor last.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* Always NULL.
|
* Always NULL.
|
||||||
*/
|
*/
|
||||||
static void* guac_common_cursor_broadcast_position(guac_user* user,
|
static void* guac_common_cursor_broadcast_state(guac_user* user,
|
||||||
void* data) {
|
void* data) {
|
||||||
|
|
||||||
guac_common_cursor* cursor = (guac_common_cursor*) 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) {
|
if (user != cursor->user) {
|
||||||
guac_protocol_send_mouse(user->socket, cursor->x, cursor->y,
|
guac_protocol_send_mouse(user->socket, cursor->x, cursor->y,
|
||||||
cursor->timestamp);
|
cursor->button_mask, cursor->timestamp);
|
||||||
guac_socket_flush(user->socket);
|
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,
|
void guac_common_cursor_update(guac_common_cursor* cursor, guac_user* user,
|
||||||
int x, int y) {
|
int x, int y, int button_mask) {
|
||||||
|
|
||||||
/* Update current user of cursor */
|
/* Update current user of cursor */
|
||||||
cursor->user = user;
|
cursor->user = user;
|
||||||
|
|
||||||
/* Update cursor position */
|
/* Update cursor state */
|
||||||
cursor->x = x;
|
cursor->x = x;
|
||||||
cursor->y = y;
|
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();
|
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_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,
|
void guac_common_recording_report_mouse(guac_common_recording* recording,
|
||||||
int x, int y) {
|
int x, int y, int button_mask) {
|
||||||
|
|
||||||
/* Report mouse location */
|
/* Report mouse location */
|
||||||
guac_protocol_send_mouse(recording->socket, x, y,
|
guac_protocol_send_mouse(recording->socket, x, y, button_mask,
|
||||||
guac_timestamp_current());
|
guac_timestamp_current());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ int guacenc_handle_mouse(guacenc_display* display, int argc, char** argv) {
|
|||||||
cursor->y = y;
|
cursor->y = y;
|
||||||
|
|
||||||
/* If no timestamp provided, nothing further to do */
|
/* If no timestamp provided, nothing further to do */
|
||||||
if (argc < 3)
|
if (argc < 4)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Leverage timestamp to render frame */
|
/* 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);
|
return guacenc_display_sync(display, timestamp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,19 @@ int vguac_protocol_send_log(guac_socket* socket, const char* format,
|
|||||||
* @param y
|
* @param y
|
||||||
* The Y coordinate of the current mouse position.
|
* 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
|
* @param timestamp
|
||||||
* The server timestamp (in milliseconds) at the point in time this mouse
|
* The server timestamp (in milliseconds) at the point in time this mouse
|
||||||
* position was acknowledged.
|
* 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.
|
* Zero on success, non-zero on error.
|
||||||
*/
|
*/
|
||||||
int guac_protocol_send_mouse(guac_socket* socket, int x, int y,
|
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.
|
* 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,
|
int guac_protocol_send_mouse(guac_socket* socket, int x, int y,
|
||||||
guac_timestamp timestamp) {
|
int button_mask, guac_timestamp timestamp) {
|
||||||
|
|
||||||
int ret_val;
|
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_string(socket, ",")
|
||||||
|| __guac_socket_write_length_int(socket, y)
|
|| __guac_socket_write_length_int(socket, y)
|
||||||
|| guac_socket_write_string(socket, ",")
|
|| 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_length_int(socket, timestamp)
|
||||||
|| guac_socket_write_string(socket, ";");
|
|| 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store current mouse location */
|
/* Store current mouse location/state */
|
||||||
guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
|
guac_common_cursor_update(rdp_client->display->cursor, user, x, y, mask);
|
||||||
|
|
||||||
/* Report mouse position within recording */
|
/* Report mouse position within recording */
|
||||||
if (rdp_client->recording != NULL)
|
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 button mask unchanged, just send move event */
|
||||||
if (mask == rdp_client->mouse_button_mask)
|
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 */
|
/* Report mouse position within recording */
|
||||||
if (ssh_client->recording != NULL)
|
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 */
|
/* Send mouse event */
|
||||||
guac_terminal_send_mouse(term, user, x, y, mask);
|
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 */
|
/* Report mouse position within recording */
|
||||||
if (telnet_client->recording != NULL)
|
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 */
|
/* Send mouse if not searching for password or username */
|
||||||
if (settings->password_regex == NULL && settings->username_regex == NULL)
|
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;
|
guac_vnc_client* vnc_client = (guac_vnc_client*) client->data;
|
||||||
rfbClient* rfb_client = vnc_client->rfb_client;
|
rfbClient* rfb_client = vnc_client->rfb_client;
|
||||||
|
|
||||||
/* Store current mouse location */
|
/* Store current mouse location/state */
|
||||||
guac_common_cursor_move(vnc_client->display->cursor, user, x, y);
|
guac_common_cursor_update(vnc_client->display->cursor, user, x, y, mask);
|
||||||
|
|
||||||
/* Report mouse position within recording */
|
/* Report mouse position within recording */
|
||||||
if (vnc_client->recording != NULL)
|
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 */
|
/* Send VNC event only if finished connecting */
|
||||||
if (rfb_client != NULL)
|
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 released_mask = term->mouse_mask & ~mask;
|
||||||
int pressed_mask = ~term->mouse_mask & mask;
|
int pressed_mask = ~term->mouse_mask & mask;
|
||||||
|
|
||||||
/* Store current mouse location */
|
/* Store current mouse location/state */
|
||||||
guac_common_cursor_move(term->cursor, user, x, y);
|
guac_common_cursor_update(term->cursor, user, x, y, mask);
|
||||||
|
|
||||||
/* Notify scrollbar, do not handle anything handled by scrollbar */
|
/* Notify scrollbar, do not handle anything handled by scrollbar */
|
||||||
if (guac_terminal_scrollbar_handle_mouse(term->scrollbar, x, y, mask)) {
|
if (guac_terminal_scrollbar_handle_mouse(term->scrollbar, x, y, mask)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user