From 5b16fe41346ba129b5f2bbe0288a466ffac14d0a Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 18 Jan 2022 19:45:27 -0600 Subject: 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 --- video/out/wayland_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3