From cb6e7c7a55923c3ba62fff2c36a224169443c33a Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 14 Apr 2024 00:14:04 -0500 Subject: wayland: check if scale actually changes in scaling events The protocol strongly implies that this only happens when the value changes, and it's also what you would naturally expect. But maybe it's worth guarding this in cause for some reason the same value twice in a row happens. --- video/out/wayland_common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'video/out') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 8211facf90..ab96ede166 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -996,7 +996,7 @@ static void surface_handle_preferred_buffer_scale(void *data, { struct vo_wayland_state *wl = data; - if (wl->fractional_scale_manager) + if (wl->fractional_scale_manager || wl->scaling == scale) return; wl->pending_scaling = scale; @@ -1221,7 +1221,11 @@ static void preferred_scale(void *data, uint32_t scale) { struct vo_wayland_state *wl = data; - wl->pending_scaling = (double)scale / 120; + double new_scale = (double)scale / 120; + if (wl->scaling == new_scale) + return; + + wl->pending_scaling = new_scale; wl->scale_configured = true; MP_VERBOSE(wl, "Obtained preferred scale, %f, from the compositor.\n", wl->pending_scaling); -- cgit v1.2.3