summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-01-18 19:45:27 -0600
committerDudemanguy <random342@airmail.cc>2022-01-24 15:07:00 +0000
commit5b16fe41346ba129b5f2bbe0288a466ffac14d0a (patch)
treeadff62f091c3e728dc508a186df518a3e9679901
parentd16defac27fcfe3e5fc43af6e42c2e590988cd3d (diff)
downloadmpv-5b16fe41346ba129b5f2bbe0288a466ffac14d0a.tar.bz2
mpv-5b16fe41346ba129b5f2bbe0288a466ffac14d0a.tar.xz
wayland: sanitize toplevel title to UTF-8
The xdg-shell protocol requires that the toplevel title is UTF-8*. Go ahead and leverage existing mpv tools to sanitize the title. Fixes #9694 *: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/0aaf12157ede8fdf6eda49963da313bd1a7d930f/stable/xdg-shell/xdg-shell.xml#L638
-rw-r--r--video/out/wayland_common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 0806e048ed..c77015de2f 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -1490,7 +1490,11 @@ static int update_window_title(struct vo_wayland_state *wl, const char *title)
{
if (!wl->xdg_toplevel)
return VO_NOTAVAIL;
- xdg_toplevel_set_title(wl->xdg_toplevel, title);
+ /* The xdg-shell protocol requires that the title is UTF-8. */
+ void *tmp = talloc_new(NULL);
+ struct bstr b_title = bstr_sanitize_utf8_latin1(tmp, bstr0(title));
+ xdg_toplevel_set_title(wl->xdg_toplevel, b_title.start);
+ talloc_free(tmp);
return VO_TRUE;
}