cursor-channel-client: Move all public functions to methods

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-05-25 08:27:17 +01:00 committed by Frediano Ziglio
parent 435ea33540
commit 0807ccea59
3 changed files with 17 additions and 17 deletions

View File

@ -50,14 +50,14 @@ struct CursorChannelClientPrivate
static int _cursor_count = 0;
#endif
void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc)
void CursorChannelClient::reset_cursor_cache()
{
red_cursor_cache_reset(ccc, CLIENT_CURSOR_CACHE_SIZE);
red_cursor_cache_reset(this, CLIENT_CURSOR_CACHE_SIZE);
}
void CursorChannelClient::on_disconnect()
{
cursor_channel_client_reset_cursor_cache(this);
reset_cursor_cache();
}
void CursorChannelClient::migrate()
@ -91,12 +91,12 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient
return rcc;
}
RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id)
RedCacheItem* CursorChannelClient::cache_find(uint64_t id)
{
return red_cursor_cache_find(ccc, id);
return red_cursor_cache_find(this, id);
}
int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size)
int CursorChannelClient::cache_add(uint64_t id, size_t size)
{
return red_cursor_cache_add(ccc, id, size);
return red_cursor_cache_add(this, id, size);
}

View File

@ -37,6 +37,10 @@ public:
RedClient *client,
RedStream *stream,
RedChannelCapabilities *caps);
void reset_cursor_cache();
RedCacheItem* cache_find(uint64_t id);
int cache_add(uint64_t id, size_t size);
protected:
virtual void on_disconnect() override;
void send_item(RedPipeItem *pipe_item) override;
@ -56,10 +60,6 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
int mig_target,
RedChannelCapabilities *caps);
void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc);
RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id);
int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size);
enum {
RED_PIPE_ITEM_TYPE_CURSOR = RED_PIPE_ITEM_TYPE_COMMON_LAST,
RED_PIPE_ITEM_TYPE_CURSOR_INIT,

View File

@ -95,11 +95,11 @@ static void cursor_fill(CursorChannelClient *ccc, RedCursorPipeItem *cursor,
*red_cursor = cursor_cmd->u.set.shape;
if (red_cursor->header.unique) {
if (cursor_channel_client_cache_find(ccc, red_cursor->header.unique)) {
if (ccc->cache_find(red_cursor->header.unique)) {
red_cursor->flags |= SPICE_CURSOR_FLAGS_FROM_CACHE;
return;
}
if (cursor_channel_client_cache_add(ccc, red_cursor->header.unique, 1)) {
if (ccc->cache_add(red_cursor->header.unique, 1)) {
red_cursor->flags |= SPICE_CURSOR_FLAGS_CACHE_ME;
}
}
@ -206,12 +206,12 @@ void CursorChannelClient::send_item(RedPipeItem *pipe_item)
red_marshall_inval(this, m, SPICE_CONTAINEROF(pipe_item, RedCacheItem, u.pipe_data));
break;
case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
cursor_channel_client_reset_cursor_cache(ccc);
red_marshall_cursor_init(ccc, m);
reset_cursor_cache();
red_marshall_cursor_init(this, m);
break;
case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
cursor_channel_client_reset_cursor_cache(ccc);
ccc->init_send_data(SPICE_MSG_CURSOR_INVAL_ALL);
reset_cursor_cache();
init_send_data(SPICE_MSG_CURSOR_INVAL_ALL);
break;
default:
spice_error("invalid pipe item type");