mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 11:21:30 +11:00
Fix X11 window names not supporting UTF-8 (#295)
This commit is contained in:
parent
aea92d0f6e
commit
3da7b7b22e
|
@ -440,6 +440,22 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
(d.lib.XStoreName)(d.display, handle, name.as_ptr());
|
(d.lib.XStoreName)(d.display, handle, name.as_ptr());
|
||||||
|
if let Ok(name_len) = c_int::try_from(name.to_bytes().len()) {
|
||||||
|
let net_wm_name = d.intern_atom("_NET_WM_NAME", false);
|
||||||
|
let utf8_string = d.intern_atom("UTF8_STRING", false);
|
||||||
|
(d.lib.XChangeProperty)(
|
||||||
|
d.display,
|
||||||
|
handle,
|
||||||
|
net_wm_name,
|
||||||
|
utf8_string,
|
||||||
|
8,
|
||||||
|
xlib::PropModeReplace,
|
||||||
|
name.as_ptr() as *const c_uchar,
|
||||||
|
name_len,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Err(Error::WindowCreate("Window name too long".to_owned()));
|
||||||
|
}
|
||||||
|
|
||||||
(d.lib.XSelectInput)(
|
(d.lib.XSelectInput)(
|
||||||
d.display,
|
d.display,
|
||||||
|
|
Loading…
Reference in a new issue