mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 14:20:05 -04:00
Fix warnings while compiling for win32
This commit is contained in:
@@ -24,7 +24,7 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
|
|||||||
|
|
||||||
// initializing variables to be sent to the task
|
// initializing variables to be sent to the task
|
||||||
let title = builder_title.as_slice().utf16_units()
|
let title = builder_title.as_slice().utf16_units()
|
||||||
.collect::<Vec<u16>>().append_one(0); // title to utf16
|
.chain(Some(0).into_iter()).collect::<Vec<u16>>(); // title to utf16
|
||||||
//let hints = hints.clone();
|
//let hints = hints.clone();
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
|
|||||||
TaskBuilder::new().native().spawn(proc() {
|
TaskBuilder::new().native().spawn(proc() {
|
||||||
// registering the window class
|
// registering the window class
|
||||||
let class_name = {
|
let class_name = {
|
||||||
let class_name: Vec<u16> = "Window Class".utf16_units().collect::<Vec<u16>>()
|
let class_name: Vec<u16> = "Window Class".utf16_units().chain(Some(0).into_iter())
|
||||||
.append_one(0);
|
.collect::<Vec<u16>>();
|
||||||
|
|
||||||
let class = ffi::WNDCLASSEX {
|
let class = ffi::WNDCLASSEX {
|
||||||
cbSize: mem::size_of::<ffi::WNDCLASSEX>() as ffi::UINT,
|
cbSize: mem::size_of::<ffi::WNDCLASSEX>() as ffi::UINT,
|
||||||
@@ -333,7 +333,8 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
|
|||||||
|
|
||||||
// loading the opengl32 module
|
// loading the opengl32 module
|
||||||
let gl_library = {
|
let gl_library = {
|
||||||
let name = "opengl32.dll".utf16_units().collect::<Vec<u16>>().append_one(0).as_ptr();
|
let name = "opengl32.dll".utf16_units().chain(Some(0).into_iter())
|
||||||
|
.collect::<Vec<u16>>().as_ptr();
|
||||||
let lib = unsafe { ffi::LoadLibraryW(name) };
|
let lib = unsafe { ffi::LoadLibraryW(name) };
|
||||||
if lib.is_null() {
|
if lib.is_null() {
|
||||||
tx.send(Err(format!("LoadLibrary function failed: {}",
|
tx.send(Err(format!("LoadLibrary function failed: {}",
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ impl Window {
|
|||||||
pub fn set_title(&self, text: &str) {
|
pub fn set_title(&self, text: &str) {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::SetWindowTextW(self.window,
|
ffi::SetWindowTextW(self.window,
|
||||||
text.utf16_units().collect::<Vec<u16>>().append_one(0).as_ptr() as ffi::LPCWSTR);
|
text.utf16_units().chain(Some(0).into_iter())
|
||||||
|
.collect::<Vec<u16>>().as_ptr() as ffi::LPCWSTR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user