From 092ce61908d83ebfb0f590e729eab8a537aac775 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 12 Jul 2021 20:52:24 +1000 Subject: [PATCH] [client] main: copy & release KVMFR messages sooner The renderer may take time to process the cursor update due to various internal factors, as such it's best we copy the data and mark the message as done ASAP. This prevents the host from filling up the queue as easily when a high dpi mouse is in use. --- client/src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 2f692ec8..e2db46e8 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -286,7 +286,11 @@ static int cursorThread(void * unused) break; } - KVMFRCursor * cursor = (KVMFRCursor *)msg.mem; + /* copy and release the message ASAP */ + char buffer[msg.size]; + memcpy(buffer, msg.mem, msg.size); + KVMFRCursor * cursor = (KVMFRCursor *)buffer; + lgmpClientMessageDone(queue); g_cursor.guest.visible = msg.udata & CURSOR_FLAG_VISIBLE; @@ -318,7 +322,6 @@ static int cursorThread(void * unused) ) { DEBUG_ERROR("Failed to update mouse shape"); - lgmpClientMessageDone(queue); continue; } } @@ -341,7 +344,6 @@ static int cursorThread(void * unused) core_handleGuestMouseUpdate(); } - lgmpClientMessageDone(queue); g_cursor.redraw = false; g_state.lgr->on_mouse_event