Detach instead of exiting when compositor goes away
parent
9647d1089a
commit
3af4851e4d
13
src/main.c
13
src/main.c
|
@ -119,6 +119,8 @@ struct wayvnc {
|
||||||
|
|
||||||
struct ctl* ctl;
|
struct ctl* ctl;
|
||||||
bool is_initializing;
|
bool is_initializing;
|
||||||
|
|
||||||
|
bool start_detached;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wayvnc_client {
|
struct wayvnc_client {
|
||||||
|
@ -456,14 +458,21 @@ void on_wayland_event(void* obj)
|
||||||
if (wl_display_read_events(self->display) < 0) {
|
if (wl_display_read_events(self->display) < 0) {
|
||||||
if (errno == EPIPE || errno == ECONNRESET) {
|
if (errno == EPIPE || errno == ECONNRESET) {
|
||||||
nvnc_log(NVNC_LOG_ERROR, "Compositor has gone away. Exiting...");
|
nvnc_log(NVNC_LOG_ERROR, "Compositor has gone away. Exiting...");
|
||||||
|
if (self->start_detached)
|
||||||
|
wayland_detach(self);
|
||||||
|
else
|
||||||
wayvnc_exit(self);
|
wayvnc_exit(self);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
nvnc_log(NVNC_LOG_ERROR, "Failed to read wayland events: %m");
|
nvnc_log(NVNC_LOG_ERROR, "Failed to read wayland events: %m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_display_dispatch_pending(self->display) < 0)
|
if (wl_display_dispatch_pending(self->display) < 0) {
|
||||||
nvnc_log(NVNC_LOG_ERROR, "Failed to dispatch pending");
|
nvnc_log(NVNC_LOG_ERROR, "Failed to dispatch pending");
|
||||||
|
wayland_detach(self);
|
||||||
|
// TODO: Re-attach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_wayland(struct wayvnc* self, const char* display)
|
static int init_wayland(struct wayvnc* self, const char* display)
|
||||||
|
@ -1693,6 +1702,8 @@ int main(int argc, char* argv[])
|
||||||
"transient-seat");
|
"transient-seat");
|
||||||
start_detached = !!option_parser_get_value(&option_parser, "detached");
|
start_detached = !!option_parser_get_value(&option_parser, "detached");
|
||||||
|
|
||||||
|
self.start_detached = start_detached;
|
||||||
|
|
||||||
keyboard_options = option_parser_get_value(&option_parser, "keyboard");
|
keyboard_options = option_parser_get_value(&option_parser, "keyboard");
|
||||||
if (keyboard_options)
|
if (keyboard_options)
|
||||||
parse_keyboard_option(&self, keyboard_options);
|
parse_keyboard_option(&self, keyboard_options);
|
||||||
|
|
Loading…
Reference in New Issue