summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-12 15:16:11 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:19 +0900
commit6a9cdfa7718535bbc0d1c1a4bd5009775429dacd (patch)
treecf462ff48c1ac4410a529feace19ba0e64f7cccf
parent399e74627587b24b7dcc56c7210e296118e283ac (diff)
downloadmpv-6a9cdfa7718535bbc0d1c1a4bd5009775429dacd.tar.bz2
mpv-6a9cdfa7718535bbc0d1c1a4bd5009775429dacd.tar.xz
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.)
-rw-r--r--video/out/wayland_common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 4eb7eb2d45..d0a37a66ce 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -717,6 +717,9 @@ static void schedule_resize(struct vo_wayland_state *wl,
int32_t minimum_size = 150;
int32_t x, y;
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);
@@ -734,7 +737,7 @@ static void schedule_resize(struct vo_wayland_state *wl,
switch (edges) {
case WL_SHELL_SURFACE_RESIZE_TOP:
case WL_SHELL_SURFACE_RESIZE_BOTTOM:
- width = wl->window.aspect * height;
+ width = win_aspect * height;
break;
case WL_SHELL_SURFACE_RESIZE_LEFT:
case WL_SHELL_SURFACE_RESIZE_RIGHT:
@@ -742,13 +745,13 @@ static void schedule_resize(struct vo_wayland_state *wl,
case WL_SHELL_SURFACE_RESIZE_TOP_RIGHT:
case WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT:
case WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT:
- height = (1 / wl->window.aspect) * width;
+ height = (1 / win_aspect) * width;
break;
default:
if (wl->window.aspect < temp_aspect)
width = wl->window.aspect * height;
else
- height = (1 / wl->window.aspect) * width;
+ height = (1 / win_aspect) * width;
break;
}