From 642ce2bfa78176a5aba0cbfe72f91b057bc5b468 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 3 Jun 2023 15:02:37 -0700 Subject: [PATCH] Port to windows-sys v0.48.0 (#2842) --- CHANGELOG.md | 1 + Cargo.toml | 2 +- src/platform_impl/windows/event_loop.rs | 5 ++++- src/platform_impl/windows/util.rs | 4 ++-- src/platform_impl/windows/window.rs | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c98cfaef38..5ec503f4ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ And please only add new entries to the top of this list, right below the `# Unre - **Breaking:** Updated `bitflags` crate version to `2`, which changes the API on exposed types. - On Web, handle coalesced pointer events, which increases the resolution of pointer inputs. - **Breaking:** On Web, `instant` is now replaced by `web_time`. +- On Windows, port to `windows-sys` version 0.48.0. # 0.28.6 diff --git a/Cargo.toml b/Cargo.toml index 571ab6989c..44f1d1534e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,7 +81,7 @@ dispatch = "0.2.0" unicode-segmentation = "1.7.1" [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.45" +version = "0.48" features = [ "Win32_Devices_HumanInterfaceDevice", "Win32_Foundation", diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index fd9a87f17c..7ed5b820db 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -30,7 +30,10 @@ use windows_sys::Win32::{ SC_SCREENSAVE, }, Media::{timeBeginPeriod, timeEndPeriod, timeGetDevCaps, TIMECAPS, TIMERR_NOERROR}, - System::{Ole::RevokeDragDrop, Threading::GetCurrentThreadId, WindowsProgramming::INFINITE}, + System::{ + Ole::RevokeDragDrop, + Threading::{GetCurrentThreadId, INFINITE}, + }, UI::{ Controls::{HOVER_DEFAULT, WM_MOUSELEAVE}, Input::{ diff --git a/src/platform_impl/windows/util.rs b/src/platform_impl/windows/util.rs index 06d2728f18..355b366a19 100644 --- a/src/platform_impl/windows/util.rs +++ b/src/platform_impl/windows/util.rs @@ -13,7 +13,7 @@ use once_cell::sync::Lazy; use windows_sys::{ core::{HRESULT, PCWSTR}, Win32::{ - Foundation::{BOOL, HINSTANCE, HWND, RECT}, + Foundation::{BOOL, HMODULE, HWND, RECT}, Graphics::Gdi::{ClientToScreen, HMONITOR}, System::{ LibraryLoader::{GetProcAddress, LoadLibraryA}, @@ -149,7 +149,7 @@ pub fn is_minimized(window: HWND) -> bool { unsafe { IsIconic(window) != false.into() } } -pub fn get_instance_handle() -> HINSTANCE { +pub fn get_instance_handle() -> HMODULE { // Gets the instance handle by taking the address of the // pseudo-variable created by the microsoft linker: // https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483 diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 7115b30650..1556c1bbf1 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -14,7 +14,7 @@ use std::{ use windows_sys::Win32::{ Foundation::{ - HINSTANCE, HWND, LPARAM, OLE_E_WRONGCOMPOBJ, POINT, POINTS, RECT, RPC_E_CHANGED_MODE, S_OK, + HMODULE, HWND, LPARAM, OLE_E_WRONGCOMPOBJ, POINT, POINTS, RECT, RPC_E_CHANGED_MODE, S_OK, WPARAM, }, Graphics::{ @@ -315,7 +315,7 @@ impl Window { } #[inline] - pub fn hinstance(&self) -> HINSTANCE { + pub fn hinstance(&self) -> HMODULE { unsafe { super::get_window_long(self.hwnd(), GWLP_HINSTANCE) } }