diff options
Diffstat (limited to 'server/display-channel.c')
-rw-r--r-- | server/display-channel.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/server/display-channel.c b/server/display-channel.c index 8775496b..b5d8830a 100644 --- a/server/display-channel.c +++ b/server/display-channel.c @@ -226,6 +226,42 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc) red_channel_client_push(&dcc->common.base); } +static SurfaceDestroyItem *surface_destroy_item_new(RedChannel *channel, + uint32_t surface_id) +{ + SurfaceDestroyItem *destroy; + + destroy = spice_malloc(sizeof(SurfaceDestroyItem)); + destroy->surface_destroy.surface_id = surface_id; + red_channel_pipe_item_init(channel, &destroy->pipe_item, + PIPE_ITEM_TYPE_DESTROY_SURFACE); + + return destroy; +} + +void dcc_push_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id) +{ + DisplayChannel *display; + RedChannel *channel; + SurfaceDestroyItem *destroy; + + if (!dcc) { + return; + } + + display = DCC_TO_DC(dcc); + channel = RED_CHANNEL(display); + + if (COMMON_CHANNEL(display)->during_target_migrate || + !dcc->surface_client_created[surface_id]) { + return; + } + + dcc->surface_client_created[surface_id] = FALSE; + destroy = surface_destroy_item_new(channel, surface_id); + red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &destroy->pipe_item); +} + int display_channel_get_streams_timeout(DisplayChannel *display) { int timeout = INT_MAX; |