Skip to content

Commit adff00c

Browse files
llyyrDudemanguy
authored andcommitted
wayland: don't use surface local coordinates if we haven't received them
vo_wayland_handle_scale may be called from reconfig, even before we get the first toplevel_configure. In this case, don't use the surface local coordinates because they will be initialized as 0.
1 parent de118fd commit adff00c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

video/out/wayland_common.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,10 +4361,15 @@ void vo_wayland_handle_color(struct vo_wayland_state *wl, struct mp_image_params
43614361

43624362
void vo_wayland_handle_scale(struct vo_wayland_state *wl)
43634363
{
4364-
int width = wl->override_surface_local ? lround(mp_rect_w(wl->geometry) / wl->scaling_factor) :
4365-
mp_rect_w(wl->surface_local);
4366-
int height = wl->override_surface_local ? lround(mp_rect_h(wl->geometry) / wl->scaling_factor) :
4367-
mp_rect_h(wl->surface_local);
4364+
int width, height;
4365+
if (!wl->override_surface_local && mp_rect_w(wl->surface_local) != 0 &&
4366+
mp_rect_h(wl->surface_local) != 0) {
4367+
width = mp_rect_w(wl->surface_local);
4368+
height = mp_rect_h(wl->surface_local);
4369+
} else {
4370+
width = lround(mp_rect_w(wl->geometry) / wl->scaling_factor);
4371+
height = lround(mp_rect_h(wl->geometry) / wl->scaling_factor);
4372+
}
43684373
wp_viewport_set_destination(wl->viewport, width, height);
43694374
}
43704375

0 commit comments

Comments
 (0)