From 06fb3b5a2e3045eff853cf71166bb2515a6423ee Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 1 Apr 2013 01:59:15 -0700 Subject: [PATCH] Stub out scroll wheel handling. --- protocols/ssh/src/ssh_handlers.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/protocols/ssh/src/ssh_handlers.c b/protocols/ssh/src/ssh_handlers.c index 3d06d256..5c491d47 100644 --- a/protocols/ssh/src/ssh_handlers.c +++ b/protocols/ssh/src/ssh_handlers.c @@ -139,23 +139,35 @@ int ssh_guac_client_mouse_handler(guac_client* client, int x, int y, int mask) { ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data; - /* Mouse just changed from down to up */ - int mouse_up = - (client_data->mouse_mask & GUAC_CLIENT_MOUSE_RIGHT) - && !(mask & GUAC_CLIENT_MOUSE_RIGHT); - + /* Determine which buttons were just released */ + int released_mask = client_data->mouse_mask & ~mask; client_data->mouse_mask = mask; /* Paste contents of clipboard on right mouse button up */ - if(mouse_up && client_data->clipboard_data != NULL) { + if ((released_mask & GUAC_CLIENT_MOUSE_RIGHT) + && client_data->clipboard_data != NULL) { int length = strlen(client_data->clipboard_data); + if (length) + return channel_write(client_data->term_channel, + client_data->clipboard_data, length); - if(length) - return channel_write(client_data->term_channel, client_data->clipboard_data, length); + } + + /* Scroll up if wheel moved up */ + if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_UP) { + /* STUB */ + guac_client_log_info(client, "stub: scroll up"); + } + + /* Scroll down if wheel moved down */ + if (released_mask & GUAC_CLIENT_MOUSE_SCROLL_DOWN) { + /* STUB */ + guac_client_log_info(client, "stub: scroll down"); } return 0; + } int ssh_guac_client_key_handler(guac_client* client, int keysym, int pressed) {