From 0f7bd9071e9b64acb9f13e253d49c3790e50d560 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 3 Apr 2015 08:33:51 +0200 Subject: Remove all features for 1.0 beta --- src/win32/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/win32/mod.rs') diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 2769bf1..be72d53 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -2,6 +2,8 @@ use std::sync::atomic::AtomicBool; use std::mem; use std::ptr; use std::ffi::CString; +use std::ffi::OsStr; +use std::os::windows::ffi::OsStrExt; use std::sync::{ Arc, Mutex @@ -109,10 +111,11 @@ impl Window { /// /// Calls SetWindowText on the HWND. pub fn set_title(&self, text: &str) { + let text = OsStr::from_str(text).encode_wide().chain(Some(0).into_iter()) + .collect::>(); + unsafe { - user32::SetWindowTextW(self.window.0, - text.utf16_units().chain(Some(0).into_iter()) - .collect::>().as_ptr() as winapi::LPCWSTR); + user32::SetWindowTextW(self.window.0, text.as_ptr() as winapi::LPCWSTR); } } @@ -395,7 +398,6 @@ impl<'a> Iterator for WaitEventsIterator<'a> { } } -#[unsafe_destructor] impl Drop for Window { fn drop(&mut self) { unsafe { -- cgit v1.2.3