summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2016-07-29 04:10:05 +0100
committerwm4 <wm4@nowhere>2016-07-30 00:02:40 +0200
commit3fe5ff99c692e8bf9eaf353c20d1e78e375c92b2 (patch)
tree4db5bb9d8a668337a1e9e5a685f18bc506b02c6c /video/out/wayland_common.c
parentf918ec4b2b403f60cd534bb52df716af0686b84d (diff)
downloadmpv-3fe5ff99c692e8bf9eaf353c20d1e78e375c92b2.tar.bz2
mpv-3fe5ff99c692e8bf9eaf353c20d1e78e375c92b2.tar.xz
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.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c12
1 files changed, 7 insertions, 5 deletions
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