From 6f551c770c578986d56e026d6d83b9026406cca7 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 9 Jan 2020 21:18:35 +1100 Subject: [PATCH] [client] handle pointer visibility properly --- VERSION | 2 +- client/src/main.c | 78 +++++++++++++++++++---------------------------- 2 files changed, 32 insertions(+), 48 deletions(-) diff --git a/VERSION b/VERSION index 4c4ccd63..57cd0bbd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-61-g7a98a886b6+1 \ No newline at end of file +B1-62-g2d755a45e0+1 \ No newline at end of file diff --git a/client/src/main.c b/client/src/main.c index 87ca70ef..ef744c4a 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -279,62 +279,46 @@ static int cursorThread(void * unused) KVMFRCursor * cursor = (KVMFRCursor *)msg.mem; state.cursor.x = cursor->x; state.cursor.y = cursor->y; + state.cursorVisible = cursor->visible; state.haveCursorPos = true; - // if this was only a move event - if (msg.udata == 0) + if (msg.udata == 1) { - state.lgr->on_mouse_event - ( - state.lgrData, - state.cursorVisible, - state.cursor.x, - state.cursor.y - ); - lgmpClientMessageDone(queue); - continue; - } + switch(cursor->type) + { + case CURSOR_TYPE_COLOR : cursorType = LG_CURSOR_COLOR ; break; + case CURSOR_TYPE_MONOCHROME : cursorType = LG_CURSOR_MONOCHROME ; break; + case CURSOR_TYPE_MASKED_COLOR: cursorType = LG_CURSOR_MASKED_COLOR; break; + default: + DEBUG_ERROR("Invalid cursor type"); + lgmpClientMessageDone(queue); + continue; + } - switch(cursor->type) - { - case CURSOR_TYPE_COLOR : cursorType = LG_CURSOR_COLOR ; break; - case CURSOR_TYPE_MONOCHROME : cursorType = LG_CURSOR_MONOCHROME ; break; - case CURSOR_TYPE_MASKED_COLOR: cursorType = LG_CURSOR_MASKED_COLOR; break; - default: - DEBUG_ERROR("Invalid cursor type"); + const uint8_t * data = (const uint8_t *)(cursor + 1); + if (!state.lgr->on_mouse_shape( + state.lgrData, + cursorType, + cursor->width, + cursor->height, + cursor->pitch, + data) + ) + { + DEBUG_ERROR("Failed to update mouse shape"); lgmpClientMessageDone(queue); continue; + } } - const uint8_t * data = (const uint8_t *)(cursor + 1); - if (!state.lgr->on_mouse_shape( - state.lgrData, - cursorType, - cursor->width, - cursor->height, - cursor->pitch, - data) - ) - { - DEBUG_ERROR("Failed to update mouse shape"); - lgmpClientMessageDone(queue); - continue; - } - - bool showCursor = cursor->visible; lgmpClientMessageDone(queue); - - if (showCursor != state.cursorVisible) - { - state.cursorVisible = showCursor; - state.lgr->on_mouse_event - ( - state.lgrData, - state.cursorVisible, - state.cursor.x, - state.cursor.y - ); - } + state.lgr->on_mouse_event + ( + state.lgrData, + state.cursorVisible, + state.cursor.x, + state.cursor.y + ); } lgmpClientUnsubscribe(&queue);