Cleanup unused import stuff

Also support i686-pc-windows-msvc

Signed-off-by: Peter Atashian <retep998@gmail.com>
This commit is contained in:
Peter Atashian 2015-08-21 11:49:10 -04:00
parent 42949fb34b
commit 9d387b4f98
4 changed files with 18 additions and 17 deletions

View file

@ -57,6 +57,14 @@ user32-sys = "~0.1.1"
kernel32-sys = "0.1" kernel32-sys = "0.1"
dwmapi-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] [target.x86_64-pc-windows-gnu.dependencies]
winapi = "0.2" winapi = "0.2"
shell32-sys = "0.1" shell32-sys = "0.1"

View file

@ -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. /// 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. /// Returning 0 tells the Win32 API that the message has been processed.
// FIXME: detect WM_DWMCOMPOSITIONCHANGED and call DwmEnableBlurBehindWindow if necessary // FIXME: detect WM_DWMCOMPOSITIONCHANGED and call DwmEnableBlurBehindWindow if necessary
pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, 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 { if data.header.dwType == winapi::RIM_TYPEMOUSE {
let _x = data.mouse.lLastX; // FIXME: this is not always the relative movement let _x = data.mouse.lLastX; // FIXME: this is not always the relative movement
let _y = data.mouse.lLastY; let _y = data.mouse.lLastY;
// TODO: // TODO:
//send_event(window, Event::MouseRawMovement { x: x, y: y }); //send_event(window, Event::MouseRawMovement { x: x, y: y });
0 0
@ -230,7 +230,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
let cstash = cstash.as_ref(); let cstash = cstash.as_ref();
// there's a very bizarre borrow checker bug // there's a very bizarre borrow checker bug
// possibly related to rust-lang/rust/#23338 // 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() { if let Ok(cursor_state) = cstash.cursor_state.lock() {
match *cursor_state { match *cursor_state {
CursorState::Normal => { CursorState::Normal => {
@ -256,7 +256,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
use events::Event::DroppedFile; use events::Event::DroppedFile;
let hdrop = wparam as winapi::HDROP; 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); let num_drops = shell32::DragQueryFileW(hdrop, 0xFFFFFFFF, ptr::null_mut(), 0);
for i in 0..num_drops { for i in 0..num_drops {

View file

@ -1,10 +1,8 @@
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::io; use std::io;
use std::ptr; use std::ptr;
use std::mem; use std::mem;
use std::thread; use std::thread;
use libc;
use super::callback; use super::callback;
use super::Window; use super::Window;
@ -19,7 +17,7 @@ use CreationError::OsError;
use CursorState; use CursorState;
use GlRequest; use GlRequest;
use std::ffi::{CString, OsStr}; use std::ffi::{OsStr};
use std::os::windows::ffi::OsStrExt; use std::os::windows::ffi::OsStrExt;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
@ -28,7 +26,6 @@ use kernel32;
use dwmapi; use dwmapi;
use user32; use user32;
use api::wgl;
use api::wgl::Context as WglContext; use api::wgl::Context as WglContext;
use api::egl; use api::egl;
use api::egl::Context as EglContext; use api::egl::Context as EglContext;
@ -163,7 +160,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
// creating the OpenGL context // creating the OpenGL context
let context = match builder.gl_version { 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 Some(egl) = egl {
if let Ok(c) = EglContext::new(egl, &builder, if let Ok(c) = EglContext::new(egl, &builder,
egl::NativeDisplay::Other(Some(ptr::null()))) egl::NativeDisplay::Other(Some(ptr::null())))
@ -201,7 +198,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
_ => unimplemented!() _ => 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<u16>, builder: BuilderAttribs<'static>,
fTransitionOnMaximized: 0, fTransitionOnMaximized: 0,
}; };
unsafe { dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb);
dwmapi::DwmEnableBlurBehindWindow(real_window.0, &bb);
}
} }
// calling SetForegroundWindow if fullscreen // calling SetForegroundWindow if fullscreen
@ -254,7 +249,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
unsafe fn register_window_class() -> Vec<u16> { unsafe fn register_window_class() -> Vec<u16> {
let class_name = OsStr::new("Window Class").encode_wide().chain(Some(0).into_iter()) let class_name = OsStr::new("Window Class").encode_wide().chain(Some(0).into_iter())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let class = winapi::WNDCLASSEXW { let class = winapi::WNDCLASSEXW {
cbSize: mem::size_of::<winapi::WNDCLASSEXW>() as winapi::UINT, cbSize: mem::size_of::<winapi::WNDCLASSEXW>() as winapi::UINT,
style: winapi::CS_HREDRAW | winapi::CS_VREDRAW | winapi::CS_OWNDC, 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(), let result = user32::ChangeDisplaySettingsExW(monitor.get_adapter_name().as_ptr(),
&mut screen_settings, ptr::null_mut(), &mut screen_settings, ptr::null_mut(),
winapi::CDS_FULLSCREEN, ptr::null_mut()); winapi::CDS_FULLSCREEN, ptr::null_mut());
if result != winapi::DISP_CHANGE_SUCCESSFUL { if result != winapi::DISP_CHANGE_SUCCESSFUL {
return Err(OsError(format!("ChangeDisplaySettings failed: {}", result))); return Err(OsError(format!("ChangeDisplaySettings failed: {}", result)));
} }

View file

@ -1,6 +1,5 @@
#![cfg(target_os = "windows")] #![cfg(target_os = "windows")]
use std::sync::atomic::AtomicBool;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -26,7 +25,6 @@ use winapi;
use user32; use user32;
use kernel32; use kernel32;
use api::wgl;
use api::wgl::Context as WglContext; use api::wgl::Context as WglContext;
use api::egl::Context as EglContext; use api::egl::Context as EglContext;
use api::egl::ffi::egl::Egl; use api::egl::ffi::egl::Egl;