Start with blank pointer, show pointer when moving mouse, hide pointer when typing.
This commit is contained in:
parent
d3efaeee6e
commit
2eeb9263c5
@ -118,7 +118,6 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
client_data->clipboard_data = NULL;
|
||||
|
||||
/* Set up I-bar pointer */
|
||||
client_data->current_cursor =
|
||||
client_data->ibar_cursor = guac_ssh_create_ibar(client);
|
||||
|
||||
/* Set up blank pointer */
|
||||
@ -131,8 +130,9 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||
term->char_width * term->term_width,
|
||||
term->char_height * term->term_height);
|
||||
|
||||
/* Send I-bar pointer */
|
||||
guac_ssh_set_cursor(client, client_data->ibar_cursor);
|
||||
/* Initialize pointer */
|
||||
client_data->current_cursor = client_data->blank_cursor;
|
||||
guac_ssh_set_cursor(client, client_data->current_cursor);
|
||||
|
||||
guac_socket_flush(socket);
|
||||
|
||||
|
@ -151,6 +151,17 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) {
|
||||
int released_mask = client_data->mouse_mask & ~mask;
|
||||
client_data->mouse_mask = mask;
|
||||
|
||||
/* Show mouse cursor if not already shown */
|
||||
if (client_data->current_cursor != client_data->ibar_cursor) {
|
||||
pthread_mutex_lock(&(term->lock));
|
||||
|
||||
client_data->current_cursor = client_data->ibar_cursor;
|
||||
guac_ssh_set_cursor(client, client_data->ibar_cursor);
|
||||
guac_socket_flush(client->socket);
|
||||
|
||||
pthread_mutex_unlock(&(term->lock));
|
||||
}
|
||||
|
||||
/* Paste contents of clipboard on right mouse button up */
|
||||
if ((released_mask & GUAC_CLIENT_MOUSE_RIGHT)
|
||||
&& client_data->clipboard_data != NULL) {
|
||||
@ -185,6 +196,17 @@ int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {
|
||||
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
|
||||
guac_terminal* term = client_data->term;
|
||||
|
||||
/* Hide mouse cursor if not already hidden */
|
||||
if (client_data->current_cursor != client_data->blank_cursor) {
|
||||
pthread_mutex_lock(&(term->lock));
|
||||
|
||||
client_data->current_cursor = client_data->blank_cursor;
|
||||
guac_ssh_set_cursor(client, client_data->blank_cursor);
|
||||
guac_socket_flush(client->socket);
|
||||
|
||||
pthread_mutex_unlock(&(term->lock));
|
||||
}
|
||||
|
||||
/* Track modifiers */
|
||||
if (keysym == 0xFFE3) {
|
||||
client_data->mod_ctrl = pressed;
|
||||
|
Loading…
Reference in New Issue
Block a user