aboutsummaryrefslogtreecommitdiffstats
path: root/src/win32
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-04-03 08:33:51 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-04-03 09:42:45 +0200
commit0f7bd9071e9b64acb9f13e253d49c3790e50d560 (patch)
treeb35fe22f55ef94a02ab01bf6f5271407ce4ad204 /src/win32
parent1c74614c4ace993e655e18dafdeb9d5ceef9ea06 (diff)
downloadglutin-0f7bd9071e9b64acb9f13e253d49c3790e50d560.tar.gz
glutin-0f7bd9071e9b64acb9f13e253d49c3790e50d560.zip
Remove all features for 1.0 beta
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/init.rs18
-rw-r--r--src/win32/make_current_guard.rs1
-rw-r--r--src/win32/mod.rs10
3 files changed, 16 insertions, 13 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs
index 0a77cb7..5cf4021 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -20,7 +20,8 @@ use CursorState;
use GlRequest;
use PixelFormat;
-use std::ffi::{CStr, CString};
+use std::ffi::{CStr, CString, OsStr};
+use std::os::windows::ffi::OsStrExt;
use std::sync::mpsc::channel;
use libc;
@@ -38,8 +39,9 @@ pub fn new_window(builder: BuilderAttribs<'static>, builder_sharelists: Option<C
-> Result<Window, CreationError>
{
// initializing variables to be sent to the task
- let title = builder.title.utf16_units()
- .chain(Some(0).into_iter()).collect::<Vec<u16>>(); // title to utf16
+
+ let title = OsStr::from_str(&builder.title).encode_wide().chain(Some(0).into_iter())
+ .collect::<Vec<_>>();
let (tx, rx) = channel();
@@ -265,8 +267,8 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
}
unsafe fn register_window_class() -> Vec<u16> {
- let class_name: Vec<u16> = "Window Class".utf16_units().chain(Some(0).into_iter())
- .collect::<Vec<u16>>();
+ let class_name = OsStr::from_str("Window Class").encode_wide().chain(Some(0).into_iter())
+ .collect::<Vec<_>>();
let class = winapi::WNDCLASSEXW {
cbSize: mem::size_of::<winapi::WNDCLASSEXW>() as winapi::UINT,
@@ -515,10 +517,10 @@ unsafe fn set_pixel_format(hdc: &WindowWrapper, id: libc::c_int) -> Result<(), C
}
unsafe fn load_opengl32_dll() -> Result<winapi::HMODULE, CreationError> {
- let name = "opengl32.dll".utf16_units().chain(Some(0).into_iter())
- .collect::<Vec<u16>>().as_ptr();
+ let name = OsStr::from_str("opengl32.dll").encode_wide().chain(Some(0).into_iter())
+ .collect::<Vec<_>>();
- let lib = kernel32::LoadLibraryW(name);
+ let lib = kernel32::LoadLibraryW(name.as_ptr());
if lib.is_null() {
return Err(OsError(format!("LoadLibrary function failed: {}",
diff --git a/src/win32/make_current_guard.rs b/src/win32/make_current_guard.rs
index 2435454..8983899 100644
--- a/src/win32/make_current_guard.rs
+++ b/src/win32/make_current_guard.rs
@@ -42,7 +42,6 @@ impl<'a, 'b> CurrentContextGuard<'a, 'b> {
}
}
-#[unsafe_destructor]
impl<'a, 'b> Drop for CurrentContextGuard<'a, 'b> {
fn drop(&mut self) {
unsafe {
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::<Vec<_>>();
+
unsafe {
- user32::SetWindowTextW(self.window.0,
- text.utf16_units().chain(Some(0).into_iter())
- .collect::<Vec<u16>>().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 {