Skip to content

Commit

Permalink
wayland: always recalculate scaling if wl->current_output is not set
Browse files Browse the repository at this point in the history
If we lose the current output for any reason (unplug, turns off, etc.)
and then later it comes back, mpv should always recalculate all the
scaling stuff. The optimization to avoid needless scaling calculations
didn't consider this case and would always exit since the scaling is the
same. So just check wl->current_output's existence as well.

Fixes #15361.
  • Loading branch information
Dudemanguy committed Nov 24, 2024
1 parent 2d813de commit c089aaa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions video/out/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,9 @@ static void surface_handle_preferred_buffer_scale(void *data,
{
struct vo_wayland_state *wl = data;

if (wl->fractional_scale_manager || wl->scaling == scale * WAYLAND_SCALE_FACTOR)
if (wl->fractional_scale_manager ||
(wl->scaling == scale * WAYLAND_SCALE_FACTOR &&
wl->current_output && wl->current_output->has_surface))
return;

wl->pending_scaling = scale * WAYLAND_SCALE_FACTOR;
Expand Down Expand Up @@ -1248,7 +1250,7 @@ static void preferred_scale(void *data,
uint32_t scale)
{
struct vo_wayland_state *wl = data;
if (wl->scaling == scale)
if (wl->scaling == scale && wl->current_output && wl->current_output->has_surface)
return;

wl->pending_scaling = scale;
Expand Down

0 comments on commit c089aaa

Please sign in to comment.