From d289b1ee35bff9744ae6c5388d43a11b081b16fe Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Fri, 4 Feb 2022 21:54:10 +0100 Subject: [PATCH] Update to windows-sys 0.32 --- Cargo.toml | 6 +++--- src/platform_impl/windows/dark_mode.rs | 6 +++--- src/platform_impl/windows/event_loop.rs | 20 ++++++++++---------- src/platform_impl/windows/icon.rs | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c00f1a367d..d19ded7c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,10 +55,10 @@ default_features = false features = ["display_link"] [target.'cfg(target_os = "windows")'.dependencies] -parking_lot = "0.11" +parking_lot = "0.12" [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.29" +version = "0.32" features = [ "Win32_Devices_HumanInterfaceDevice", "Win32_Foundation", @@ -93,7 +93,7 @@ sctk = { package = "smithay-client-toolkit", version = "0.15.1", default_feature mio = { version = "0.8", features = ["os-ext"], optional = true } x11-dl = { version = "2.18.5", optional = true } percent-encoding = { version = "2.0", optional = true } -parking_lot = { version = "0.11.0", optional = true } +parking_lot = { version = "0.12.0", optional = true } libc = "0.2.64" [target.'cfg(target_arch = "wasm32")'.dependencies.web_sys] diff --git a/src/platform_impl/windows/dark_mode.rs b/src/platform_impl/windows/dark_mode.rs index 36f7892368..93adc52d7b 100644 --- a/src/platform_impl/windows/dark_mode.rs +++ b/src/platform_impl/windows/dark_mode.rs @@ -3,7 +3,7 @@ use std::{ffi, ptr}; use windows_sys::Win32::{ - Foundation::{BOOL, HWND, NTSTATUS, PSTR, PWSTR, S_OK}, + Foundation::{BOOL, HWND, NTSTATUS, PSTR, S_OK}, System::{ LibraryLoader::{GetProcAddress, LoadLibraryA}, SystemInformation::OSVERSIONINFOW, @@ -80,7 +80,7 @@ pub fn try_theme(hwnd: HWND, preferred_theme: Option) -> Theme { Theme::Light => LIGHT_THEME_NAME.as_ptr(), }; - let status = unsafe { SetWindowTheme(hwnd, theme_name as PWSTR, ptr::null_mut()) }; + let status = unsafe { SetWindowTheme(hwnd, theme_name, ptr::null_mut()) }; if status == S_OK && set_dark_mode_for_window(hwnd, is_dark_mode) { return theme; @@ -146,7 +146,7 @@ fn should_apps_use_dark_mode() -> bool { unsafe { const UXTHEME_SHOULDAPPSUSEDARKMODE_ORDINAL: PSTR = 132 as PSTR; - let module = LoadLibraryA("uxtheme.dll\0".as_ptr() as PSTR); + let module = LoadLibraryA("uxtheme.dll\0".as_ptr()); if module == 0 { return None; diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 90b68e003a..afb8d37d42 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -580,7 +580,7 @@ lazy_static! { // WPARAM and LPARAM are unused. static ref USER_EVENT_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::WakeupMsg\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::WakeupMsg\0".as_ptr()) } }; // Message sent when we want to execute a closure in the thread. @@ -588,43 +588,43 @@ lazy_static! { // and LPARAM is unused. static ref EXEC_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::ExecMsg\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::ExecMsg\0".as_ptr()) } }; static ref PROCESS_NEW_EVENTS_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::ProcessNewEvents\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::ProcessNewEvents\0".as_ptr()) } }; /// lparam is the wait thread's message id. static ref SEND_WAIT_THREAD_ID_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::SendWaitThreadId\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::SendWaitThreadId\0".as_ptr()) } }; /// lparam points to a `Box` signifying the time `PROCESS_NEW_EVENTS_MSG_ID` should /// be sent. static ref WAIT_UNTIL_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::WaitUntil\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::WaitUntil\0".as_ptr()) } }; static ref CANCEL_WAIT_UNTIL_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::CancelWaitUntil\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::CancelWaitUntil\0".as_ptr()) } }; // Message sent by a `Window` when it wants to be destroyed by the main thread. // WPARAM and LPARAM are unused. pub static ref DESTROY_MSG_ID: u32 = { unsafe { - RegisterWindowMessageA("Winit::DestroyMsg\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::DestroyMsg\0".as_ptr()) } }; // WPARAM is a bool specifying the `WindowFlags::MARKER_RETAIN_STATE_ON_SIZE` flag. See the // documentation in the `window_state` module for more information. pub static ref SET_RETAIN_STATE_ON_SIZE_MSG_ID: u32 = unsafe { - RegisterWindowMessageA("Winit::SetRetainMaximized\0".as_ptr() as PSTR) + RegisterWindowMessageA("Winit::SetRetainMaximized\0".as_ptr()) }; static ref THREAD_EVENT_TARGET_WINDOW_CLASS: Vec = util::encode_wide("Winit Thread Event Target"); } @@ -642,7 +642,7 @@ fn create_event_target_window() -> HWND { hCursor: 0, // must be null in order for cursor state to work properly hbrBackground: 0, lpszMenuName: ptr::null_mut(), - lpszClassName: THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr() as PWSTR, + lpszClassName: THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr(), hIconSm: 0, }; @@ -662,7 +662,7 @@ fn create_event_target_window() -> HWND { // `explorer.exe` and then starting the process back up. // It is unclear why the bug is triggered by waiting for several hours. | WS_EX_TOOLWINDOW, - THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr() as PWSTR, + THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr(), ptr::null_mut(), WS_OVERLAPPED, 0, diff --git a/src/platform_impl/windows/icon.rs b/src/platform_impl/windows/icon.rs index 387f44aff4..eba349969b 100644 --- a/src/platform_impl/windows/icon.rs +++ b/src/platform_impl/windows/icon.rs @@ -93,7 +93,7 @@ impl WinIcon { LR_DEFAULTSIZE | LR_LOADFROMFILE, ) }; - if !handle.is_null() { + if handle != 0 { Ok(WinIcon::from_handle(handle as HICON)) } else { Err(BadIcon::OsError(io::Error::last_os_error())) @@ -116,7 +116,7 @@ impl WinIcon { LR_DEFAULTSIZE, ) }; - if !handle.is_null() { + if handle != 0 { Ok(WinIcon::from_handle(handle as HICON)) } else { Err(BadIcon::OsError(io::Error::last_os_error()))