mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 14:50:07 +00:00
x11: sanitize window title to UTF-8 for EWMH
Both _NET_WM_NAME and _NET_WM_ICON_NAME (part of Extended Window Manager Hints) require that the string is UTF-8*. mpv was not doing this and thus violating the spec. Just sanitize the title for these two atoms. Note that XA_WM_NAME and XA_WM_ICON_NAME have no such requirement so those atoms are left the same. Fixes #8812. *: https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html
This commit is contained in:
parent
5b16fe4134
commit
e809ef0441
@ -1363,8 +1363,13 @@ static void vo_x11_update_window_title(struct vo *vo)
|
||||
|
||||
vo_x11_set_property_string(vo, XA_WM_NAME, x11->window_title);
|
||||
vo_x11_set_property_string(vo, XA_WM_ICON_NAME, x11->window_title);
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_NAME), x11->window_title);
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_ICON_NAME), x11->window_title);
|
||||
|
||||
/* _NET_WM_NAME and _NET_WM_ICON_NAME must be sanitized to UTF-8. */
|
||||
void *tmp = talloc_new(NULL);
|
||||
struct bstr b_title = bstr_sanitize_utf8_latin1(tmp, bstr0(x11->window_title));
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_NAME), b_title.start);
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_ICON_NAME), b_title.start);
|
||||
talloc_free(tmp);
|
||||
}
|
||||
|
||||
static void vo_x11_xembed_update(struct vo_x11_state *x11, int flags)
|
||||
|
Loading…
Reference in New Issue
Block a user