mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-03-06 16:50:50 +00:00
[client] main: only copy the needed cursor data instead of everything
This commit is contained in:
parent
a8ba014b52
commit
dc918c55b6
1 changed files with 8 additions and 4 deletions
|
@ -412,7 +412,11 @@ int main_cursorThread(void * unused)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor && msg.size > cursorSize)
|
KVMFRCursor * tmp = (KVMFRCursor *)msg.mem;
|
||||||
|
const int neededSize = sizeof(*tmp) +
|
||||||
|
(msg.udata & CURSOR_FLAG_SHAPE ? tmp->height * tmp->pitch : 0);
|
||||||
|
|
||||||
|
if (cursor && neededSize > cursorSize)
|
||||||
{
|
{
|
||||||
free(cursor);
|
free(cursor);
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
|
@ -421,17 +425,17 @@ int main_cursorThread(void * unused)
|
||||||
/* copy and release the message ASAP */
|
/* copy and release the message ASAP */
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
{
|
{
|
||||||
cursor = malloc(msg.size);
|
cursor = malloc(neededSize);
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("failed to allocate %d bytes for cursor", msg.size);
|
DEBUG_ERROR("failed to allocate %d bytes for cursor", neededSize);
|
||||||
g_state.state = APP_STATE_SHUTDOWN;
|
g_state.state = APP_STATE_SHUTDOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cursorSize = msg.size;
|
cursorSize = msg.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(cursor, msg.mem, msg.size);
|
memcpy(cursor, msg.mem, neededSize);
|
||||||
lgmpClientMessageDone(g_state.pointerQueue);
|
lgmpClientMessageDone(g_state.pointerQueue);
|
||||||
|
|
||||||
g_cursor.guest.visible =
|
g_cursor.guest.visible =
|
||||||
|
|
Loading…
Add table
Reference in a new issue