x11: attempt to fix UTF-8 window titles (see #209)

This commit is contained in:
rdb 2024-05-16 20:28:26 +02:00
parent 2436a06527
commit a655784d8d
3 changed files with 11 additions and 0 deletions

View File

@ -340,6 +340,7 @@ x11GraphicsPipe(const std::string &display) :
// Get some X atom numbers.
_wm_delete_window = XInternAtom(_display, "WM_DELETE_WINDOW", false);
_net_wm_name = XInternAtom(_display, "_NET_WM_NAME", false);
_net_wm_pid = XInternAtom(_display, "_NET_WM_PID", false);
_net_wm_window_type = XInternAtom(_display, "_NET_WM_WINDOW_TYPE", false);
_net_wm_window_type_splash = XInternAtom(_display, "_NET_WM_WINDOW_TYPE_SPLASH", false);

View File

@ -125,6 +125,7 @@ public:
public:
// Atom specifications.
Atom _wm_delete_window;
Atom _net_wm_name;
Atom _net_wm_pid;
Atom _net_wm_window_type;
Atom _net_wm_window_type_splash;

View File

@ -1188,6 +1188,15 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) {
if (XStringListToTextProperty((char **)&name, 1, &window_name) != 0) {
window_name_p = &window_name;
}
#ifdef X_HAVE_UTF8_STRING
XTextProperty wm_name;
if (Xutf8TextListToTextProperty(_display, (char **)&name, 1,
XUTF8StringStyle, &wm_name) == Success) {
XSetTextProperty(_display, _xwindow, &wm_name, x11_pipe->_net_wm_name);
XFree(wm_name.value);
}
#endif
}
// The size hints request a window of a particular size andor a particular