Force a wayland round-trip after an output appears

This way outputs are always fully initialized.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
pull/200/head
Jim Ramsay 2022-12-24 07:36:03 -05:00
parent 5cf9ad6eab
commit 2f2f6f410b
1 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,7 @@ struct wayvnc {
struct aml_timer* capture_retry_timer; struct aml_timer* capture_retry_timer;
struct ctl* ctl; struct ctl* ctl;
bool is_initializing;
}; };
struct wayvnc_client { struct wayvnc_client {
@ -201,6 +202,10 @@ static void registry_add(void* data, struct wl_registry* registry,
return; return;
wl_list_insert(&self->outputs, &output->link); wl_list_insert(&self->outputs, &output->link);
if (!self->is_initializing) {
wl_display_dispatch(self->display);
wl_display_roundtrip(self->display);
}
return; return;
} }
@ -364,6 +369,7 @@ void wayvnc_destroy(struct wayvnc* self)
static int init_wayland(struct wayvnc* self) static int init_wayland(struct wayvnc* self)
{ {
self->is_initializing = true;
static const struct wl_registry_listener registry_listener = { static const struct wl_registry_listener registry_listener = {
.global = registry_add, .global = registry_add,
.global_remove = registry_remove, .global_remove = registry_remove,
@ -384,6 +390,7 @@ static int init_wayland(struct wayvnc* self)
wl_display_dispatch(self->display); wl_display_dispatch(self->display);
wl_display_roundtrip(self->display); wl_display_roundtrip(self->display);
self->is_initializing = false;
if (!self->pointer_manager && !self->disable_input) { if (!self->pointer_manager && !self->disable_input) {
nvnc_log(NVNC_LOG_ERROR, "Virtual Pointer protocol not supported by compositor."); nvnc_log(NVNC_LOG_ERROR, "Virtual Pointer protocol not supported by compositor.");