diff --git a/Cargo.toml b/Cargo.toml
index cc92d5bb..5c17cf82 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -78,14 +78,18 @@ features = ["egl", "build_dlls"]
optional = true
[target.'cfg(target_os = "windows")'.dependencies]
-wio = "0.2"
-winapi = { version = "0.3", features = [
- "d3d11",
- "libloaderapi",
- "winbase",
- "winerror",
- "wingdi",
- "winuser",
+windows = { version = "0.58", features = [
+ "Win32_Foundation",
+ "Win32_System_Com",
+ "Win32_UI_WindowsAndMessaging",
+ "Win32_Graphics_Dxgi",
+ "Win32_Graphics_Dxgi_Common",
+ "Win32_Graphics_OpenGL",
+ "Win32_Graphics_Gdi",
+ "Win32_Graphics_Direct3D",
+ "Win32_Graphics_Direct3D11",
+ "Win32_System_LibraryLoader",
+ "Win32_System_SystemServices",
] }
[target.'cfg(target_os = "android")'.dependencies]
diff --git a/examples/chaos_game.rs b/examples/chaos_game.rs
index cae27a57..1d0a1ee5 100644
--- a/examples/chaos_game.rs
+++ b/examples/chaos_game.rs
@@ -6,7 +6,7 @@ use euclid::default::Point2D;
use rand::{self, Rng};
use surfman::{SurfaceAccess, SurfaceType};
use winit::dpi::PhysicalSize;
-use winit::event::{DeviceEvent, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
+use winit::event::{DeviceEvent, Event, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::WindowBuilder;
diff --git a/src/platform/generic/egl/device.rs b/src/platform/generic/egl/device.rs
index 31f34aa1..ece4ec1c 100644
--- a/src/platform/generic/egl/device.rs
+++ b/src/platform/generic/egl/device.rs
@@ -11,11 +11,11 @@ use std::os::raw::{c_char, c_void};
#[cfg(not(target_os = "windows"))]
use libc::{dlopen, dlsym, RTLD_LAZY};
#[cfg(target_os = "windows")]
-use winapi::shared::minwindef::HMODULE;
+use windows::core::PCSTR;
#[cfg(target_os = "windows")]
-use winapi::shared::ntdef::LPCSTR;
+use windows::Win32::Foundation::HMODULE;
#[cfg(target_os = "windows")]
-use winapi::um::libloaderapi;
+use windows::Win32::System::LibraryLoader::{GetProcAddress, LoadLibraryA};
thread_local! {
pub static EGL_FUNCTIONS: Egl = Egl::load_with(get_proc_address);
@@ -25,7 +25,7 @@ thread_local! {
lazy_static! {
static ref EGL_LIBRARY: EGLLibraryWrapper = {
unsafe {
- let module = libloaderapi::LoadLibraryA(&b"libEGL.dll\0"[0] as *const u8 as LPCSTR);
+ let module = LoadLibraryA(PCSTR(&b"libEGL.dll\0"[0] as *const u8)).unwrap();
EGLLibraryWrapper(module)
}
};
@@ -58,8 +58,8 @@ unsafe impl Sync for EGLLibraryWrapper {}
fn get_proc_address(symbol_name: &str) -> *const c_void {
unsafe {
let symbol_name: CString = CString::new(symbol_name).unwrap();
- let symbol_ptr = symbol_name.as_ptr() as *const u8 as LPCSTR;
- libloaderapi::GetProcAddress(EGL_LIBRARY.0, symbol_ptr) as *const c_void
+ let symbol_ptr = PCSTR(symbol_name.as_ptr() as *const u8);
+ GetProcAddress(EGL_LIBRARY.0, symbol_ptr).unwrap() as *const c_void
}
}
diff --git a/src/platform/windows/angle/connection.rs b/src/platform/windows/angle/connection.rs
index a4015825..ca2bc520 100644
--- a/src/platform/windows/angle/connection.rs
+++ b/src/platform/windows/angle/connection.rs
@@ -14,13 +14,11 @@ use crate::Error;
use crate::GLApi;
use euclid::default::Size2D;
+use windows::Win32::Graphics::Direct3D::{D3D_DRIVER_TYPE_UNKNOWN, D3D_DRIVER_TYPE_WARP};
use std::os::raw::c_void;
-use winapi::shared::minwindef::UINT;
-use winapi::um::d3dcommon::{D3D_DRIVER_TYPE_UNKNOWN, D3D_DRIVER_TYPE_WARP};
-
-const INTEL_PCI_ID: UINT = 0x8086;
+const INTEL_PCI_ID: u32 = 0x8086;
/// A no-op connection.
///
diff --git a/src/platform/windows/angle/context.rs b/src/platform/windows/angle/context.rs
index 86daafff..b7ce8c30 100644
--- a/src/platform/windows/angle/context.rs
+++ b/src/platform/windows/angle/context.rs
@@ -17,11 +17,11 @@ use crate::{ContextAttributes, Error, Gl, SurfaceInfo};
use std::mem;
use std::os::raw::c_void;
use std::thread;
-use winapi::shared::winerror::S_OK;
-use winapi::um::winbase::INFINITE;
pub use crate::platform::generic::egl::context::{ContextDescriptor, NativeContext};
+const INFINITE: u32 = 0xFFFFFFFF;
+
thread_local! {
#[doc(hidden)]
pub static GL_FUNCTIONS: Gl = Gl::load_with(context::get_proc_address);
@@ -300,7 +300,7 @@ impl Device {
..
} => unsafe {
let result = keyed_mutex.AcquireSync(0, INFINITE);
- assert_eq!(result, S_OK);
+ assert!(result.is_ok());
},
_ => {}
}
@@ -340,7 +340,7 @@ impl Device {
..
} => unsafe {
let result = keyed_mutex.ReleaseSync(0);
- assert_eq!(result, S_OK);
+ assert!(result.is_ok());
},
_ => {}
}
diff --git a/src/platform/windows/angle/device.rs b/src/platform/windows/angle/device.rs
index d104f86b..6b1646fc 100644
--- a/src/platform/windows/angle/device.rs
+++ b/src/platform/windows/angle/device.rs
@@ -2,6 +2,18 @@
//
//! A thread-local handle to the device.
+use windows::core::Interface;
+use windows::Win32::Foundation::HMODULE;
+use windows::Win32::Graphics::Direct3D::{
+ D3D_DRIVER_TYPE, D3D_DRIVER_TYPE_UNKNOWN, D3D_DRIVER_TYPE_WARP, D3D_FEATURE_LEVEL_9_3,
+};
+use windows::Win32::Graphics::Direct3D11::{
+ D3D11CreateDevice, ID3D11Device, D3D11_CREATE_DEVICE_FLAG, D3D11_SDK_VERSION,
+};
+use windows::Win32::Graphics::Dxgi::{
+ CreateDXGIFactory1, IDXGIAdapter, IDXGIDevice, IDXGIFactory1,
+};
+
use super::connection::Connection;
use crate::egl;
use crate::egl::types::{EGLAttrib, EGLDeviceEXT, EGLDisplay, EGLint};
@@ -15,18 +27,9 @@ use std::cell::{RefCell, RefMut};
use std::mem;
use std::os::raw::c_void;
use std::ptr;
-use winapi::shared::dxgi::{self, IDXGIAdapter, IDXGIDevice, IDXGIFactory1};
-use winapi::shared::minwindef::UINT;
-use winapi::shared::winerror::{self, S_OK};
-use winapi::um::d3d11::{D3D11CreateDevice, ID3D11Device, D3D11_SDK_VERSION};
-use winapi::um::d3dcommon::{
- D3D_DRIVER_TYPE, D3D_DRIVER_TYPE_UNKNOWN, D3D_DRIVER_TYPE_WARP, D3D_FEATURE_LEVEL_9_3,
-};
-use winapi::Interface;
-use wio::com::ComPtr;
thread_local! {
- static DXGI_FACTORY: RefCell