diff options
author | Julian Orth <ju.orth@gmail.com> | 2022-05-28 22:13:23 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-05-28 21:26:04 +0000 |
commit | afe29026edcb3104cd64764f79fe8630e3d37242 (patch) | |
tree | 506c071d911d336e10667f1a42eb86e7eed728c7 /video/out | |
parent | defb02daa461200f4de972c57c4ac8dc108feb5f (diff) | |
download | mpv-afe29026edcb3104cd64764f79fe8630e3d37242.tar.bz2 mpv-afe29026edcb3104cd64764f79fe8630e3d37242.tar.xz |
wayland: don't depend on the order of global announcements
E.g. wl_subcompositor could be announced before wl_compositor.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/wayland_common.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 93a44fde7a..00b3adaff2 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1098,8 +1098,6 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id if (!strcmp(interface, wl_subcompositor_interface.name) && (ver >= 1) && found++) { wl->subcompositor = wl_registry_bind(reg, id, &wl_subcompositor_interface, 1); - wl->video_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->video_surface, wl->surface); - wl_subsurface_set_desync (wl->video_subsurface); } if (!strcmp (interface, zwp_linux_dmabuf_v1_interface.name) && (ver >= 2) && found++) { @@ -1111,8 +1109,6 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id if (!strcmp (interface, wp_viewporter_interface.name) && (ver >= 1) && found++) { wl->viewporter = wl_registry_bind (reg, id, &wp_viewporter_interface, 1); - wl->viewport = wp_viewporter_get_viewport (wl->viewporter, wl->surface); - wl->video_viewport = wp_viewporter_get_viewport (wl->viewporter,wl->video_surface); } if (!strcmp(interface, wl_data_device_manager_interface.name) && (ver >= 3) && found++) { @@ -1843,6 +1839,16 @@ int vo_wayland_init(struct vo *vo) if (create_xdg_surface(wl)) return false; + if (wl->subcompositor) { + wl->video_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->video_surface, wl->surface); + wl_subsurface_set_desync(wl->video_subsurface); + } + + if (wl->viewporter) { + wl->viewport = wp_viewporter_get_viewport(wl->viewporter, wl->surface); + wl->video_viewport = wp_viewporter_get_viewport(wl->viewporter, wl->video_surface); + } + const char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP"); if (xdg_current_desktop != NULL && strstr(xdg_current_desktop, "GNOME")) MP_WARN(wl, "GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.\n"); |