cursor-channel: Turn cursor_channel_reset into method

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Rope <jrope@redhat.com>
This commit is contained in:
Frediano Ziglio 2020-05-06 19:55:52 +01:00
parent e044c5bd50
commit 4dbc6dae01
3 changed files with 15 additions and 18 deletions

View File

@ -254,21 +254,19 @@ void CursorChannel::process_cmd(RedCursorCmd *cursor_cmd)
}
}
void cursor_channel_reset(CursorChannel *cursor)
void CursorChannel::reset()
{
spice_return_if_fail(cursor);
cursor_channel_set_item(this, NULL);
cursor_visible = true;
cursor_position.x = cursor_position.y = 0;
cursor_trail_length = cursor_trail_frequency = 0;
cursor_channel_set_item(cursor, NULL);
cursor->cursor_visible = true;
cursor->cursor_position.x = cursor->cursor_position.y = 0;
cursor->cursor_trail_length = cursor->cursor_trail_frequency = 0;
if (cursor->is_connected()) {
cursor->pipes_add_type(RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!cursor->get_during_target_migrate()) {
cursor->pipes_add_empty_msg(SPICE_MSG_CURSOR_RESET);
if (is_connected()) {
pipes_add_type(RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!get_during_target_migrate()) {
pipes_add_empty_msg(SPICE_MSG_CURSOR_RESET);
}
cursor->wait_all_sent(COMMON_CLIENT_TIMEOUT);
wait_all_sent(COMMON_CLIENT_TIMEOUT);
}
}

View File

@ -36,6 +36,7 @@ struct CursorChannel final: public CommonGraphicsChannel
CursorChannel(RedsState *reds, uint32_t id,
SpiceCoreInterfaceInternal *core=nullptr, Dispatcher *dispatcher=nullptr);
~CursorChannel();
void reset();
void do_init();
void process_cmd(RedCursorCmd *cursor_cmd);
void set_mouse_mode(uint32_t mode);
@ -61,8 +62,6 @@ red::shared_ptr<CursorChannel> cursor_channel_new(RedsState *server, int id,
SpiceCoreInterfaceInternal *core,
Dispatcher *dispatcher);
void cursor_channel_reset (CursorChannel *cursor);
#include "pop-visibility.h"
#endif /* CURSOR_CHANNEL_H_ */

View File

@ -395,7 +395,7 @@ static void handle_dev_destroy_surfaces(void *opaque, void *payload)
flush_all_qxl_commands(worker);
display_channel_destroy_surfaces(worker->display_channel);
cursor_channel_reset(worker->cursor_channel);
worker->cursor_channel->reset();
}
static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
@ -478,7 +478,7 @@ static void destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
*/
spice_warn_if_fail(!display_channel_surface_has_canvas(display, surface_id));
cursor_channel_reset(worker->cursor_channel);
worker->cursor_channel->reset();
}
static void handle_dev_destroy_primary_surface(void *opaque, void *payload)
@ -583,7 +583,7 @@ static void handle_dev_reset_cursor(void *opaque, void *payload)
{
RedWorker *worker = (RedWorker*) opaque;
cursor_channel_reset(worker->cursor_channel);
worker->cursor_channel->reset();
}
static void handle_dev_reset_image_cache(void *opaque, void *payload)
@ -609,7 +609,7 @@ static void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
flush_all_qxl_commands(worker);
display_channel_destroy_surfaces(worker->display_channel);
cursor_channel_reset(worker->cursor_channel);
worker->cursor_channel->reset();
red_qxl_async_complete(worker->qxl, msg->base.cookie);
}