0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

vo_dmabuf_wayland: don't use -ve margins in window size calculation

This happens with a positive --video-zoom value. We send invalid
toplevel size and get killed by the compositor.
This commit is contained in:
llyyr 2024-07-09 21:04:52 +05:30 committed by Dudemanguy
parent 18b557c1c7
commit 14571f0f77

View File

@ -523,8 +523,8 @@ static void resize(struct vo *vo)
vo->opts->pan_x = 0;
vo->opts->pan_y = 0;
vo_get_src_dst_rects(vo, &src, &dst, &p->screen_osd_res);
int window_w = p->screen_osd_res.ml + p->screen_osd_res.mr + mp_rect_w(dst);
int window_h = p->screen_osd_res.mt + p->screen_osd_res.mb + mp_rect_h(dst);
int window_w = MPMAX(0, p->screen_osd_res.ml + p->screen_osd_res.mr) + mp_rect_w(dst);
int window_h = MPMAX(0, p->screen_osd_res.mt + p->screen_osd_res.mb) + mp_rect_h(dst);
wp_viewport_set_destination(wl->viewport, lround(window_w / wl->scaling),
lround(window_h / wl->scaling));