mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
wayland: don't compute absurd window size
For some reason, schedule_resize() can be called with everything set to 0. The code couldn't handle wl->window.aspect set to 0, converting NaNs to integers. Just work this around. (I have no idea what I'm doing. This is probably a corner case caused by my broken-ish wayland setup.)
This commit is contained in:
parent
4a7c6aaedf
commit
10532b99e5
@ -731,6 +731,9 @@ static void schedule_resize(struct vo_wayland_state *wl,
|
|||||||
int32_t minimum_size = 150;
|
int32_t minimum_size = 150;
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
float temp_aspect = width / (float) MPMAX(height, 1);
|
float temp_aspect = width / (float) MPMAX(height, 1);
|
||||||
|
float win_aspect = wl->window.aspect;
|
||||||
|
if (win_aspect <= 0)
|
||||||
|
win_aspect = 1;
|
||||||
|
|
||||||
MP_DBG(wl, "schedule resize: %dx%d\n", width, height);
|
MP_DBG(wl, "schedule resize: %dx%d\n", width, height);
|
||||||
|
|
||||||
@ -748,7 +751,7 @@ static void schedule_resize(struct vo_wayland_state *wl,
|
|||||||
switch (edges) {
|
switch (edges) {
|
||||||
case WL_SHELL_SURFACE_RESIZE_TOP:
|
case WL_SHELL_SURFACE_RESIZE_TOP:
|
||||||
case WL_SHELL_SURFACE_RESIZE_BOTTOM:
|
case WL_SHELL_SURFACE_RESIZE_BOTTOM:
|
||||||
width = wl->window.aspect * height;
|
width = win_aspect * height;
|
||||||
break;
|
break;
|
||||||
case WL_SHELL_SURFACE_RESIZE_LEFT:
|
case WL_SHELL_SURFACE_RESIZE_LEFT:
|
||||||
case WL_SHELL_SURFACE_RESIZE_RIGHT:
|
case WL_SHELL_SURFACE_RESIZE_RIGHT:
|
||||||
@ -756,13 +759,13 @@ static void schedule_resize(struct vo_wayland_state *wl,
|
|||||||
case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT:
|
case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT:
|
||||||
case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT:
|
case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT:
|
||||||
case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT:
|
case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT:
|
||||||
height = (1 / wl->window.aspect) * width;
|
height = (1 / win_aspect) * width;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (wl->window.aspect < temp_aspect)
|
if (wl->window.aspect < temp_aspect)
|
||||||
width = wl->window.aspect * height;
|
width = wl->window.aspect * height;
|
||||||
else
|
else
|
||||||
height = (1 / wl->window.aspect) * width;
|
height = (1 / win_aspect) * width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user