Exit when compositor goes away

shader-damage-experiments
Andri Yngvason 2020-03-22 20:29:13 +00:00
parent 32fa2a3d29
commit a12ce12ba6
1 changed files with 11 additions and 2 deletions

View File

@ -316,9 +316,18 @@ failure:
void on_wayland_event(void* obj) void on_wayland_event(void* obj)
{ {
struct wayvnc* self = aml_get_userdata(obj); struct wayvnc* self = aml_get_userdata(obj);
// TODO: Check if the compositor has gone away
wl_display_dispatch(self->display); if (wl_display_prepare_read(self->display) < 0) {
wl_display_cancel_read(self->display);
return;
}
if (wl_display_read_events(self->display) < 0 && errno == EPIPE) {
log_error("Compositor has gone away. Exiting...\n");
wayvnc_exit(self);
}
wl_display_dispatch_pending(self->display);
} }
void wayvnc_exit(struct wayvnc* self) void wayvnc_exit(struct wayvnc* self)