mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Fix various warnings
This commit is contained in:
parent
36619ee40e
commit
65d5589e3c
|
@ -2,6 +2,7 @@ use std::sync::atomic::AtomicBool;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::os;
|
use std::os;
|
||||||
|
use std::thread;
|
||||||
use super::callback;
|
use super::callback;
|
||||||
use super::Window;
|
use super::Window;
|
||||||
use super::MonitorID;
|
use super::MonitorID;
|
||||||
|
@ -39,7 +40,7 @@ pub fn new_window(builder: BuilderAttribs<'static>, builder_sharelists: Option<C
|
||||||
// GetMessage must be called in the same thread as CreateWindow,
|
// GetMessage must be called in the same thread as CreateWindow,
|
||||||
// so we create a new thread dedicated to this window.
|
// so we create a new thread dedicated to this window.
|
||||||
// This is the only safe method. Using `nosend` wouldn't work for non-native runtime.
|
// This is the only safe method. Using `nosend` wouldn't work for non-native runtime.
|
||||||
::std::thread::Thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
unsafe {
|
unsafe {
|
||||||
// sending
|
// sending
|
||||||
match init(title, builder, builder_sharelists) {
|
match init(title, builder, builder_sharelists) {
|
||||||
|
@ -151,7 +152,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
|
||||||
let extra_functions = gl::wgl_extra::Wgl::load_with(|addr| {
|
let extra_functions = gl::wgl_extra::Wgl::load_with(|addr| {
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
let addr = CString::from_slice(addr.as_bytes());
|
let addr = CString::new(addr.as_bytes()).unwrap();
|
||||||
let addr = addr.as_ptr();
|
let addr = addr.as_ptr();
|
||||||
|
|
||||||
gl::wgl::GetProcAddress(addr) as *const libc::c_void
|
gl::wgl::GetProcAddress(addr) as *const libc::c_void
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl Window {
|
||||||
|
|
||||||
/// See the docs in the crate root file.
|
/// See the docs in the crate root file.
|
||||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||||
let addr = CString::from_slice(addr.as_bytes());
|
let addr = CString::new(addr.as_bytes()).unwrap();
|
||||||
let addr = addr.as_ptr();
|
let addr = addr.as_ptr();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -224,7 +224,7 @@ impl Window {
|
||||||
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
|
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_cursor(&self, cursor: MouseCursor) {
|
pub fn set_cursor(&self, _cursor: MouseCursor) {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,6 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
use std::ptr;
|
|
||||||
// we don't call MakeCurrent(0, 0) because we are not sure that the context
|
// we don't call MakeCurrent(0, 0) because we are not sure that the context
|
||||||
// is still the current one
|
// is still the current one
|
||||||
unsafe { user32::PostMessageW(self.window, winapi::WM_DESTROY, 0, 0); }
|
unsafe { user32::PostMessageW(self.window, winapi::WM_DESTROY, 0, 0); }
|
||||||
|
|
Loading…
Reference in a new issue