From 3fe5ff99c692e8bf9eaf353c20d1e78e375c92b2 Mon Sep 17 00:00:00 2001 From: Rostislav Pehlivanov Date: Fri, 29 Jul 2016 04:10:05 +0100 Subject: wayland_common: clip window size to the display output size With X11 it was usually left up to the window manager to prevent huge windows from being out of range, but no Wayland compositor will do this right now. Hugely improves usability when using mpv as an image viewer. --- video/out/wayland_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 3774e5f8b2..e04acc13ff 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -662,11 +662,13 @@ static void schedule_resize(struct vo_wayland_state *wl, MP_DBG(wl, "schedule resize: %dx%d\n", width, height); - if (width < minimum_size) - width = minimum_size; - - if (height < minimum_size) - height = minimum_size; + width = MPMAX(minimum_size, width); + height = MPMAX(minimum_size, height); + if (wl->display.current_output) { + int scale = wl->display.current_output->scale; + width = MPMIN(width, wl->display.current_output->width /scale); + height = MPMIN(height, wl->display.current_output->height/scale); + } // don't keep the aspect ration in fullscreen mode, because the compositor // shows the desktop in the border regions if the video has not the same -- cgit v1.2.3