From 4e521d04ea27da6c4362f7ea99dc84129980e19e Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 6 Aug 2024 22:47:19 +0900 Subject: [PATCH] fix underlying type of `HACCEL` changed in the latest `windows` crate --- v2/Cargo.toml | 2 +- v2/src/wry/event_loop.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/v2/Cargo.toml b/v2/Cargo.toml index 05728d4..1397d84 100644 --- a/v2/Cargo.toml +++ b/v2/Cargo.toml @@ -36,7 +36,7 @@ env_logger = { version = "0.11.3", default-features = false, features = ["auto-c lexopt = "0.3.0" log = "0.4.20" memchr = "2.7.1" -muda = "0.13.4" +muda = "0.13.5" notify = "6.1.1" once_cell = "1.19.0" open = "5.0.1" diff --git a/v2/src/wry/event_loop.rs b/v2/src/wry/event_loop.rs index d25cede..cf353f0 100644 --- a/v2/src/wry/event_loop.rs +++ b/v2/src/wry/event_loop.rs @@ -34,6 +34,7 @@ impl Rendering for Wry { #[cfg(target_os = "windows")] fn new() -> Result { + use std::ffi::c_void; use tao::platform::windows::EventLoopBuilderExtWindows; use windows::Win32::UI::WindowsAndMessaging::{TranslateAcceleratorW, HACCEL, MSG}; @@ -44,7 +45,8 @@ impl Rendering for Wry { EventLoopBuilder::with_user_event() .with_msg_hook(move |msg| { let msg = msg as *const MSG; - let haccel = HACCEL(menu.haccel()); + // Note: windows-sys v0.52 (depended by muda) returns `isize` but windows v0.58 requires `*mut c_void` + let haccel = HACCEL(menu.haccel() as *mut c_void); // SAFETY: `msg` pointer was given by `EventLoopBuilder::with_msg_hook` which internally receives // events via message loop. `haccel` is validated by muda's API. // Ref: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-translateacceleratorw