[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.
This commit is contained in:
Geoffrey McRae 2021-07-12 20:52:24 +10:00
parent b9d7674b20
commit 092ce61908

View File

@ -286,7 +286,11 @@ static int cursorThread(void * unused)
break; 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 = g_cursor.guest.visible =
msg.udata & CURSOR_FLAG_VISIBLE; msg.udata & CURSOR_FLAG_VISIBLE;
@ -318,7 +322,6 @@ static int cursorThread(void * unused)
) )
{ {
DEBUG_ERROR("Failed to update mouse shape"); DEBUG_ERROR("Failed to update mouse shape");
lgmpClientMessageDone(queue);
continue; continue;
} }
} }
@ -341,7 +344,6 @@ static int cursorThread(void * unused)
core_handleGuestMouseUpdate(); core_handleGuestMouseUpdate();
} }
lgmpClientMessageDone(queue);
g_cursor.redraw = false; g_cursor.redraw = false;
g_state.lgr->on_mouse_event g_state.lgr->on_mouse_event