call set_title() in new()

…instead of low-level X11 calls that don't work with utf8
This commit is contained in:
Damjan Georgievski 2016-01-17 18:40:31 +01:00
parent c923b27cad
commit e9fc0eeb87

View file

@ -472,10 +472,6 @@ impl Window {
display.check_errors().expect("Failed to call XInternAtom"); display.check_errors().expect("Failed to call XInternAtom");
(display.xlib.XSetWMProtocols)(display.display, window, &mut wm_delete_window, 1); (display.xlib.XSetWMProtocols)(display.display, window, &mut wm_delete_window, 1);
display.check_errors().expect("Failed to call XSetWMProtocols"); display.check_errors().expect("Failed to call XSetWMProtocols");
with_c_str(&*window_attrs.title, |title| {;
(display.xlib.XStoreName)(display.display, window, title);
});
display.check_errors().expect("Failed to call XStoreName");
(display.xlib.XFlush)(display.display); (display.xlib.XFlush)(display.display);
display.check_errors().expect("Failed to call XFlush"); display.check_errors().expect("Failed to call XFlush");
@ -639,6 +635,8 @@ impl Window {
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs)) input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
}; };
window.set_title(&window_attrs.title);
if window_attrs.visible { if window_attrs.visible {
unsafe { unsafe {
let ref x_window: &XWindow = window.x.borrow(); let ref x_window: &XWindow = window.x.borrow();