vnc: Set a variable to tell that a framebuffer update is in progress

pull/12/head
Andri Yngvason 2022-07-03 10:46:29 +00:00
parent 73310b5669
commit d4d5f2e75b
2 changed files with 25 additions and 4 deletions

View File

@ -49,6 +49,7 @@ struct vnc_client {
struct pixman_region16 damage; struct pixman_region16 damage;
bool handler_lock; bool handler_lock;
bool is_updating;
}; };
struct vnc_client* vnc_client_create(void); struct vnc_client* vnc_client_create(void);

View File

@ -94,6 +94,26 @@ static void vnc_client_clear_av_frames(struct vnc_client* self)
self->n_av_frames = 0; self->n_av_frames = 0;
} }
static void vnc_client_start_update(rfbClient* client)
{
struct vnc_client* self = rfbClientGetClientData(client, NULL);
assert(self);
self->pts = NO_PTS;
pixman_region_clear(&self->damage);
vnc_client_clear_av_frames(self);
self->is_updating = true;
}
static void vnc_client_cancel_update(rfbClient* client)
{
struct vnc_client* self = rfbClientGetClientData(client, NULL);
assert(self);
self->is_updating = false;
}
static void vnc_client_finish_update(rfbClient* client) static void vnc_client_finish_update(rfbClient* client)
{ {
struct vnc_client* self = rfbClientGetClientData(client, NULL); struct vnc_client* self = rfbClientGetClientData(client, NULL);
@ -101,11 +121,9 @@ static void vnc_client_finish_update(rfbClient* client)
DTRACE_PROBE2(wlvncc, vnc_client_finish_update, client, self->pts); DTRACE_PROBE2(wlvncc, vnc_client_finish_update, client, self->pts);
self->update_fb(self); self->is_updating = false;
self->pts = NO_PTS; self->update_fb(self);
pixman_region_clear(&self->damage);
vnc_client_clear_av_frames(self);
} }
static void vnc_client_got_cut_text(rfbClient* client, const char* text, static void vnc_client_got_cut_text(rfbClient* client, const char* text,
@ -225,6 +243,8 @@ struct vnc_client* vnc_client_create(void)
client->MallocFrameBuffer = vnc_client_alloc_fb; client->MallocFrameBuffer = vnc_client_alloc_fb;
client->GotFrameBufferUpdate = vnc_client_update_box; client->GotFrameBufferUpdate = vnc_client_update_box;
client->FinishedFrameBufferUpdate = vnc_client_finish_update; client->FinishedFrameBufferUpdate = vnc_client_finish_update;
client->StartingFrameBufferUpdate = vnc_client_start_update;
client->CancelledFrameBufferUpdate = vnc_client_cancel_update;
client->GotXCutText = vnc_client_got_cut_text; client->GotXCutText = vnc_client_got_cut_text;
self->pts = NO_PTS; self->pts = NO_PTS;