diff --git a/Cargo.toml b/Cargo.toml index e24b01cf..a952eea5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,14 @@ user32-sys = "~0.1.1" kernel32-sys = "0.1" dwmapi-sys = "0.1" +[target.i686-pc-windows-msvc.dependencies] +winapi = "0.2" +shell32-sys = "0.1" +gdi32-sys = "0.1" +user32-sys = "~0.1.1" +kernel32-sys = "0.1" +dwmapi-sys = "0.1" + [target.x86_64-pc-windows-gnu.dependencies] winapi = "0.2" shell32-sys = "0.1" diff --git a/src/api/win32/callback.rs b/src/api/win32/callback.rs index 25beb7bc..5667ca87 100644 --- a/src/api/win32/callback.rs +++ b/src/api/win32/callback.rs @@ -45,7 +45,7 @@ fn send_event(input_window: winapi::HWND, event: Event) { } /// This is the callback that is called by `DispatchMessage` in the events loop. -/// +/// /// Returning 0 tells the Win32 API that the message has been processed. // FIXME: detect WM_DWMCOMPOSITIONCHANGED and call DwmEnableBlurBehindWindow if necessary pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, @@ -202,7 +202,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, if data.header.dwType == winapi::RIM_TYPEMOUSE { let _x = data.mouse.lLastX; // FIXME: this is not always the relative movement let _y = data.mouse.lLastY; - // TODO: + // TODO: //send_event(window, Event::MouseRawMovement { x: x, y: y }); 0 @@ -230,7 +230,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, let cstash = cstash.as_ref(); // there's a very bizarre borrow checker bug // possibly related to rust-lang/rust/#23338 - let cursor_state = if let Some(cstash) = cstash { + let _cursor_state = if let Some(cstash) = cstash { if let Ok(cursor_state) = cstash.cursor_state.lock() { match *cursor_state { CursorState::Normal => { @@ -256,7 +256,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, use events::Event::DroppedFile; let hdrop = wparam as winapi::HDROP; - let mut pathbuf: [u16; winapi::MAX_PATH] = unsafe { mem::uninitialized() }; + let mut pathbuf: [u16; winapi::MAX_PATH] = mem::uninitialized(); let num_drops = shell32::DragQueryFileW(hdrop, 0xFFFFFFFF, ptr::null_mut(), 0); for i in 0..num_drops { diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs index 6ce36d09..c3225b67 100644 --- a/src/api/win32/init.rs +++ b/src/api/win32/init.rs @@ -1,10 +1,8 @@ -use std::sync::atomic::AtomicBool; use std::sync::{Arc, Mutex}; use std::io; use std::ptr; use std::mem; use std::thread; -use libc; use super::callback; use super::Window; @@ -19,7 +17,7 @@ use CreationError::OsError; use CursorState; use GlRequest; -use std::ffi::{CString, OsStr}; +use std::ffi::{OsStr}; use std::os::windows::ffi::OsStrExt; use std::sync::mpsc::channel; @@ -28,7 +26,6 @@ use kernel32; use dwmapi; use user32; -use api::wgl; use api::wgl::Context as WglContext; use api::egl; use api::egl::Context as EglContext; @@ -163,7 +160,7 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, // creating the OpenGL context let context = match builder.gl_version { - GlRequest::Specific(Api::OpenGlEs, (major, minor)) => { + GlRequest::Specific(Api::OpenGlEs, (_major, _minor)) => { if let Some(egl) = egl { if let Ok(c) = EglContext::new(egl, &builder, egl::NativeDisplay::Other(Some(ptr::null()))) @@ -201,7 +198,7 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, _ => unimplemented!() }; - try!(WglContext::new(&builder, real_window.0, builder_sharelists).map(Context::Wgl)) + try!(WglContext::new(&builder, real_window.0, builder_sharelists).map(Context::Wgl)) } }; @@ -214,9 +211,7 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, fTransitionOnMaximized: 0, }; - unsafe { - dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb); - } + dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb); } // calling SetForegroundWindow if fullscreen @@ -254,7 +249,7 @@ unsafe fn init(title: Vec, builder: BuilderAttribs<'static>, unsafe fn register_window_class() -> Vec { let class_name = OsStr::new("Window Class").encode_wide().chain(Some(0).into_iter()) .collect::>(); - + let class = winapi::WNDCLASSEXW { cbSize: mem::size_of::() as winapi::UINT, style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC, @@ -302,7 +297,7 @@ unsafe fn switch_to_fullscreen(rect: &mut winapi::RECT, monitor: &MonitorID) let result = user32::ChangeDisplaySettingsExW(monitor.get_adapter_name().as_ptr(), &mut screen_settings, ptr::null_mut(), winapi::CDS_FULLSCREEN, ptr::null_mut()); - + if result != winapi::DISP_CHANGE_SUCCESSFUL { return Err(OsError(format!("ChangeDisplaySettings failed: {}", result))); } diff --git a/src/api/win32/mod.rs b/src/api/win32/mod.rs index 9b03f648..dea63576 100644 --- a/src/api/win32/mod.rs +++ b/src/api/win32/mod.rs @@ -1,6 +1,5 @@ #![cfg(target_os = "windows")] -use std::sync::atomic::AtomicBool; use std::mem; use std::ptr; use std::ffi::OsStr; @@ -26,7 +25,6 @@ use winapi; use user32; use kernel32; -use api::wgl; use api::wgl::Context as WglContext; use api::egl::Context as EglContext; use api::egl::ffi::egl::Egl;