summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-04-27 14:03:34 -0500
committerDudemanguy <random342@airmail.cc>2022-04-27 20:31:07 +0000
commit8a8580e05cbca61919e4ee431b7ec77cd11f6982 (patch)
treee180fa3045aab0d9e37a406c89c1de4e8f925b26 /video/out/wayland_common.c
parent6605b6d619b7812192823c5ac6a88def4e50da5e (diff)
downloadmpv-8a8580e05cbca61919e4ee431b7ec77cd11f6982.tar.bz2
mpv-8a8580e05cbca61919e4ee431b7ec77cd11f6982.tar.xz
wayland: use wl_surface_damage_buffer
Since 2018, wl_surface_damage_buffer has been explicitly preferred and recommended over wl_surface_damage*. mpv was still using the old function in a couple of spots. The only difference is that we need to pass buffer coordinates instead of surface coordinates. In vo_wlshm, this is done by using vo->dwidth/vo->dheight since that is always used whenever wl_buffers are created. In the case of the cursor surfaace, we actually already passed buffer coordinates to it (img->width/height) which was probablly technically wrong with wl_surface_damage, but it doesn't really matter in practice. This requires bumping wl_compositor to version 4 which is no problem since this dates back to 2015*. https://gitlab.freedesktop.org/wayland/wayland/-/commit/921d0548035673a1bf6aeb9396b9bc728133411e https://gitlab.freedesktop.org/wayland/wayland/-/commit/3384f69ecf043d62a4e036c0353c2daa01d7c4d0
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 6dc5dedb50..3f85b3d5e5 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1045,8 +1045,8 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
int found = 1;
struct vo_wayland_state *wl = data;
- if (!strcmp(interface, wl_compositor_interface.name) && (ver >= 3) && found++) {
- wl->compositor = wl_registry_bind(reg, id, &wl_compositor_interface, 3);
+ if (!strcmp(interface, wl_compositor_interface.name) && (ver >= 4) && found++) {
+ wl->compositor = wl_registry_bind(reg, id, &wl_compositor_interface, 4);
wl->surface = wl_compositor_create_surface(wl->compositor);
wl->cursor_surface = wl_compositor_create_surface(wl->compositor);
wl_surface_add_listener(wl->surface, &surface_listener, wl);
@@ -1395,7 +1395,7 @@ static int set_cursor_visibility(struct vo_wayland_state *wl, bool on)
img->hotspot_x/wl->scaling, img->hotspot_y/wl->scaling);
wl_surface_set_buffer_scale(wl->cursor_surface, wl->scaling);
wl_surface_attach(wl->cursor_surface, buffer, 0, 0);
- wl_surface_damage(wl->cursor_surface, 0, 0, img->width, img->height);
+ wl_surface_damage_buffer(wl->cursor_surface, 0, 0, img->width, img->height);
wl_surface_commit(wl->cursor_surface);
} else {
wl_pointer_set_cursor(wl->pointer, wl->pointer_id, NULL, 0, 0);