GUACAMOLE-33: Merge mouse duplication user disconnect fix.

This commit is contained in:
James Muehlner 2016-05-23 20:45:18 -07:00
commit ec93a2989f
11 changed files with 84 additions and 2 deletions

View File

@ -367,3 +367,12 @@ void guac_common_cursor_set_blank(guac_common_cursor* cursor) {
} }
void guac_common_cursor_remove_user(guac_common_cursor* cursor,
guac_user* user) {
/* Disassociate from given user */
if (cursor->user == user)
cursor->user = NULL;
}

View File

@ -249,4 +249,19 @@ void guac_common_cursor_set_ibar(guac_common_cursor* cursor);
*/ */
void guac_common_cursor_set_blank(guac_common_cursor* cursor); void guac_common_cursor_set_blank(guac_common_cursor* cursor);
/**
* Removes the given user, such that future synchronization will not occur.
* This is necessary when a user leaves the connection. If a user leaves the
* connection and this is not called, the mouse cursor state may not update
* correctly in response to mouse events.
*
* @param cursor
* The cursor to remove the user from.
*
* @param user
* The user to remove.
*/
void guac_common_cursor_remove_user(guac_common_cursor* cursor,
guac_user* user);
#endif #endif

View File

@ -122,3 +122,12 @@ int guac_rdp_user_file_handler(guac_user* user, guac_stream* stream,
return 0; return 0;
} }
int guac_rdp_user_leave_handler(guac_user* user) {
guac_rdp_client* rdp_client = (guac_rdp_client*) user->client->data;
guac_common_cursor_remove_user(rdp_client->display->cursor, user);
return 0;
}

View File

@ -27,6 +27,11 @@
*/ */
guac_user_join_handler guac_rdp_user_join_handler; guac_user_join_handler guac_rdp_user_join_handler;
/**
* Handler for leaving users.
*/
guac_user_leave_handler guac_rdp_user_leave_handler;
/** /**
* Handler for received simple file uploads. This handler will automatically * Handler for received simple file uploads. This handler will automatically
* select between RDPDR and SFTP depending on which is available and which has * select between RDPDR and SFTP depending on which is available and which has

View File

@ -82,3 +82,12 @@ int guac_ssh_user_join_handler(guac_user* user, int argc, char** argv) {
} }
int guac_ssh_user_leave_handler(guac_user* user) {
guac_ssh_client* ssh_client = (guac_ssh_client*) user->client->data;
guac_common_cursor_remove_user(ssh_client->term->cursor, user);
return 0;
}

View File

@ -17,8 +17,8 @@
* under the License. * under the License.
*/ */
#ifndef GUAC_VNC_USER_H #ifndef GUAC_SSH_USER_H
#define GUAC_VNC_USER_H #define GUAC_SSH_USER_H
#include "config.h" #include "config.h"
@ -29,5 +29,10 @@
*/ */
guac_user_join_handler guac_ssh_user_join_handler; guac_user_join_handler guac_ssh_user_join_handler;
/**
* Handler for leaving users.
*/
guac_user_leave_handler guac_ssh_user_leave_handler;
#endif #endif

View File

@ -78,3 +78,13 @@ int guac_telnet_user_join_handler(guac_user* user, int argc, char** argv) {
} }
int guac_telnet_user_leave_handler(guac_user* user) {
guac_telnet_client* telnet_client =
(guac_telnet_client*) user->client->data;
guac_common_cursor_remove_user(telnet_client->term->cursor, user);
return 0;
}

View File

@ -29,5 +29,10 @@
*/ */
guac_user_join_handler guac_telnet_user_join_handler; guac_user_join_handler guac_telnet_user_join_handler;
/**
* Handler for leaving users.
*/
guac_user_leave_handler guac_telnet_user_leave_handler;
#endif #endif

View File

@ -52,6 +52,7 @@ int guac_client_init(guac_client* client) {
/* Set handlers */ /* Set handlers */
client->join_handler = guac_vnc_user_join_handler; client->join_handler = guac_vnc_user_join_handler;
client->leave_handler = guac_vnc_user_leave_handler;
client->free_handler = guac_vnc_client_free_handler; client->free_handler = guac_vnc_client_free_handler;
return 0; return 0;

View File

@ -97,3 +97,12 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) {
} }
int guac_vnc_user_leave_handler(guac_user* user) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
guac_common_cursor_remove_user(vnc_client->display->cursor, user);
return 0;
}

View File

@ -29,5 +29,10 @@
*/ */
guac_user_join_handler guac_vnc_user_join_handler; guac_user_join_handler guac_vnc_user_join_handler;
/**
* Handler for leaving users.
*/
guac_user_leave_handler guac_vnc_user_leave_handler;
#endif #endif