summaryrefslogtreecommitdiffstats
path: root/video/out/vo_wlshm.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-08-20 10:24:52 -0500
committerDudemanguy <random342@airmail.cc>2020-08-20 16:57:37 +0000
commit30dcfbc9cb3f77dbb729fb6f95ffde7dbdddc4cb (patch)
treedbf0e27190bca5231f386714a4813a7ab7e9542a /video/out/vo_wlshm.c
parentc9474dc9ed6172a5f17f66f4b7d367da6b077909 (diff)
downloadmpv-30dcfbc9cb3f77dbb729fb6f95ffde7dbdddc4cb.tar.bz2
mpv-30dcfbc9cb3f77dbb729fb6f95ffde7dbdddc4cb.tar.xz
wayland: conditionally commit surface on resize
It was possible for sway to get incorrectly sized borders if you resized the mpv window in a creative manner (e.g. open a video in a non-floating mode, set window scale to 2, then float it and witness wrong border sizes). This is possibly a sway bug (Plasma doesn't have these border issues at least), but there's a reasonable workaround for this. The reason for the incorrect border size is because it is possible for mpv to ignore the width/height from the toplevel listener and set its own size. This new size can differ from what sway/wlroots believes the size is which is what causes the sever side decorations to be drawn on incorrect dimensions. A simple trick is to just explicitly commit the surface after a resize is performed. This is only done if mpv is not fullscreened or maximized since we always obey the compositor widths/heights in those cases. Sending the commit signals the compositor of the new change in the surface and thus sway/wlroots updates its internal coordinates appropriately and borders are no longer broken.
Diffstat (limited to 'video/out/vo_wlshm.c')
-rw-r--r--video/out/vo_wlshm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c
index 3583ce3e73..16669466dd 100644
--- a/video/out/vo_wlshm.c
+++ b/video/out/vo_wlshm.c
@@ -194,7 +194,10 @@ static int resize(struct vo *vo)
p->free_buffers = buf->next;
talloc_free(buf);
}
- return mp_sws_reinit(p->sws);
+ int ret = mp_sws_reinit(p->sws);
+ if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)
+ wl_surface_commit(wl->surface);
+ return ret;
}
static int control(struct vo *vo, uint32_t request, void *data)