From 2f2f6f410b2d849236004ad16548c1e159c7b2c5 Mon Sep 17 00:00:00 2001 From: Jim Ramsay Date: Sat, 24 Dec 2022 07:36:03 -0500 Subject: [PATCH] Force a wayland round-trip after an output appears This way outputs are always fully initialized. Signed-off-by: Jim Ramsay --- src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.c b/src/main.c index b719f3d..9e7f64d 100644 --- a/src/main.c +++ b/src/main.c @@ -107,6 +107,7 @@ struct wayvnc { struct aml_timer* capture_retry_timer; struct ctl* ctl; + bool is_initializing; }; struct wayvnc_client { @@ -201,6 +202,10 @@ static void registry_add(void* data, struct wl_registry* registry, return; wl_list_insert(&self->outputs, &output->link); + if (!self->is_initializing) { + wl_display_dispatch(self->display); + wl_display_roundtrip(self->display); + } return; } @@ -364,6 +369,7 @@ void wayvnc_destroy(struct wayvnc* self) static int init_wayland(struct wayvnc* self) { + self->is_initializing = true; static const struct wl_registry_listener registry_listener = { .global = registry_add, .global_remove = registry_remove, @@ -384,6 +390,7 @@ static int init_wayland(struct wayvnc* self) wl_display_dispatch(self->display); wl_display_roundtrip(self->display); + self->is_initializing = false; if (!self->pointer_manager && !self->disable_input) { nvnc_log(NVNC_LOG_ERROR, "Virtual Pointer protocol not supported by compositor.");