diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2016-02-09 15:20:06 +0100 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2016-02-09 15:20:06 +0100 |
commit | 9238a48ffca5be87b27bca9c6bc391930871b823 (patch) | |
tree | cfca45fed6902d43703ff70d183572e1a0b787f3 /src/api/x11 | |
parent | 5cce3f9640b9ec3e78619d3e8f41f0e7b316dde0 (diff) | |
parent | 75a940d4f1240fff9adeed9b0ff869e9aa0f5814 (diff) | |
download | glutin-9238a48ffca5be87b27bca9c6bc391930871b823.tar.gz glutin-9238a48ffca5be87b27bca9c6bc391930871b823.zip |
Merge branch 'master' of http://github.com/tomaka/gl-init-rs
Diffstat (limited to 'src/api/x11')
-rw-r--r-- | src/api/x11/window.rs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index 4b78c4a..8cae2be 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -469,10 +469,6 @@ impl Window { display.check_errors().expect("Failed to call XInternAtom"); (display.xlib.XSetWMProtocols)(display.display, window, &mut wm_delete_window, 1); 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.check_errors().expect("Failed to call XFlush"); @@ -636,6 +632,8 @@ impl Window { input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs)) }; + window.set_title(&window_attrs.title); + if window_attrs.visible { unsafe { let ref x_window: &XWindow = window.x.borrow(); @@ -669,12 +667,27 @@ impl Window { } pub fn set_title(&self, title: &str) { - with_c_str(title, |title| unsafe { - (self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, title); + let wm_name = unsafe { + (self.x.display.xlib.XInternAtom)(self.x.display.display, b"_NET_WM_NAME\0".as_ptr() as *const _, 0) + }; + self.x.display.check_errors().expect("Failed to call XInternAtom"); + + let wm_utf8_string = unsafe { + (self.x.display.xlib.XInternAtom)(self.x.display.display, b"UTF8_STRING\0".as_ptr() as *const _, 0) + }; + self.x.display.check_errors().expect("Failed to call XInternAtom"); + + with_c_str(title, |c_title| unsafe { + (self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, c_title); + + let len = title.as_bytes().len(); + (self.x.display.xlib.XChangeProperty)(self.x.display.display, self.x.window, + wm_name, wm_utf8_string, 8, ffi::PropModeReplace, + c_title as *const u8, len as libc::c_int); (self.x.display.xlib.XFlush)(self.x.display.display); }); + self.x.display.check_errors().expect("Failed to set window title"); - self.x.display.check_errors().expect("Failed to call XStoreName"); } pub fn show(&self) { |