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.
This commit is contained in:
Dudemanguy 2024-04-14 00:14:04 -05:00
parent 895f40e150
commit cb6e7c7a55
1 changed files with 6 additions and 2 deletions

View File

@ -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);