Skip to content

Commit

Permalink
cursor: implement cursor channel reset
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum5 authored and gnif committed Sep 19, 2022
1 parent c7800d3 commit 5adeea0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/channel_cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,37 @@ static PS_STATUS onMessage_cursorInit(PSChannel * channel)
return PS_STATUS_OK;
}

static PS_STATUS onMessage_cursorReset(PSChannel * channel)
{
(void) channel;

g_ps.cursor.visible = false;
g_ps.cursor.current = NULL;

struct PSCursorImage * node;
struct PSCursorImage * next;
for (node = g_ps.cursor.cache; node; node = next)
{
next = node->next;
free(node);
}

g_ps.cursor.cache = NULL;
g_ps.cursor.cacheLast = NULL;

return PS_STATUS_OK;
}

PSHandlerFn channelCursor_onMessage(PSChannel * channel)
{
channel->initDone = true;
switch(channel->header.type)
{
case SPICE_MSG_CURSOR_INIT:
return onMessage_cursorInit;

case SPICE_MSG_CURSOR_RESET:
return onMessage_cursorReset;
}

return PS_HANDLER_DISCARD;
Expand Down

0 comments on commit 5adeea0

Please sign in to comment.