diff options
author | Alexander Preisinger <alexander.preisinger@gmail.com> | 2014-01-28 13:07:00 +0100 |
---|---|---|
committer | Alexander Preisinger <alexander.preisinger@gmail.com> | 2014-04-16 16:38:54 +0200 |
commit | 5528ad3031148ce19583ad8cd3c949fa4df4eb54 (patch) | |
tree | 220e9f1cbd6ca9799844c7df3c40db21e74570de /video/out/wayland_common.c | |
parent | 6fcec75baa6bb8b33be284aad108cf3f9920ef15 (diff) | |
download | mpv-5528ad3031148ce19583ad8cd3c949fa4df4eb54.tar.bz2 mpv-5528ad3031148ce19583ad8cd3c949fa4df4eb54.tar.xz |
wayland/shm: Use subsurfaces for OSD
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r-- | video/out/wayland_common.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index b60fa6fb0a..3d803ffb42 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -610,6 +610,12 @@ static void registry_handle_global (void *data, wl->input.devman, wl->input.seat); wl_data_device_add_listener(wl->input.datadev, &data_device_listener, wl); } + + else if (strcmp(interface, "wl_subcompositor") == 0) { + + wl->display.subcomp = wl_registry_bind(reg, id, + &wl_subcompositor_interface, 1); + } } static void registry_handle_global_remove (void *data, @@ -793,9 +799,23 @@ static void destroy_display (struct vo_wayland_state *wl) static bool create_window (struct vo_wayland_state *wl) { - wl->window.surface = wl_compositor_create_surface(wl->display.compositor); - wl->window.shell_surface = wl_shell_get_shell_surface(wl->display.shell, - wl->window.surface); + wl->window.video_surface = + wl_compositor_create_surface(wl->display.compositor); + wl->window.shell_surface = + wl_shell_get_shell_surface(wl->display.shell, wl->window.video_surface); + + // Commits on surfaces bound to a subsurface are cached until the parent + // surface is commited, in this case the video surface. + // Which means we can call commit anywhere. + for (int i = 0; i < MAX_OSD_PARTS; ++i) { + wl->window.osd_surfaces[i] = + wl_compositor_create_surface(wl->display.compositor); + wl->window.osd_subsurfaces[i] = + wl_subcompositor_get_subsurface(wl->display.subcomp, + wl->window.osd_surfaces[i], + wl->window.video_surface); // parent + wl_subsurface_set_sync(wl->window.osd_subsurfaces[i]); + } if (!wl->window.shell_surface) { MP_ERR(wl, "creating shell surface failed\n"); @@ -816,8 +836,8 @@ static void destroy_window (struct vo_wayland_state *wl) if (wl->window.shell_surface) wl_shell_surface_destroy(wl->window.shell_surface); - if (wl->window.surface) - wl_surface_destroy(wl->window.surface); + if (wl->window.video_surface) + wl_surface_destroy(wl->window.video_surface); } static bool create_cursor (struct vo_wayland_state *wl) |