diff --git a/meson.build b/meson.build index 03e1e8255d51d..53b6ff88bd10e 100644 --- a/meson.build +++ b/meson.build @@ -1038,6 +1038,7 @@ foreach dep: wayland['deps'] endif endforeach features += {'wayland': wayland_deps and wayland['header'] and wayland['scanner'].found()} +features += {'wl_display_create_queue_with_name': wayland['deps'][0].version().version_compare('>=1.23.0')} if features['wayland'] subdir(join_paths('video', 'out')) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 007c5dcee3152..ef5a331cf6a00 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -302,6 +302,7 @@ struct vo_wayland_text_input { struct vo_wayland_preferred_description_info { struct vo_wayland_state *wl; bool is_parametric; + bool info_done; struct pl_color_space csp; float min_luma; float max_luma; @@ -346,6 +347,14 @@ static void update_output_geometry(struct vo_wayland_state *wl, struct mp_rect o struct mp_rect old_output_geometry); static void destroy_offer(struct vo_wayland_data_offer *o); +#ifndef HAVE_WL_DISPLAY_CREATE_QUEUE_WITH_NAME +struct wl_event_queue * +wl_display_create_queue_with_name(struct wl_display *display, const char *name) +{ + return wl_display_create_queue(display); +} +#endif + /* Wayland listener boilerplate */ static void pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, @@ -2152,6 +2161,7 @@ static void info_done(void *data, struct wp_image_description_info_v1 *image_des { struct vo_wayland_preferred_description_info *wd = data; struct vo_wayland_state *wl = wd->wl; + wd->info_done = true; wp_image_description_info_v1_destroy(image_description_info); if (wd->is_parametric) { wl->preferred_csp = wd->csp; @@ -3116,8 +3126,14 @@ static void get_compositor_preferred_description(struct vo_wayland_state *wl, bo } struct wp_image_description_info_v1 *description_info = wp_image_description_v1_get_information(image_description); + struct wl_event_queue *image_description_info_queue = wl_display_create_queue_with_name(wl->display, "image description info queue"); + wl_proxy_set_queue((struct wl_proxy *)description_info, image_description_info_queue); wp_image_description_info_v1_add_listener(description_info, &image_description_info_listener, wd); + while (wl_display_dispatch_queue(wl->display, image_description_info_queue) > 0) + if (wd->info_done) + break; wp_image_description_v1_destroy(image_description); + wl_event_queue_destroy(image_description_info_queue); #endif }