Skip to content

Commit

Permalink
fix underlying type of HACCEL changed in the latest windows crate
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Aug 6, 2024
1 parent 4a88fb1 commit 4e521d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion v2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion v2/src/wry/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl Rendering for Wry {

#[cfg(target_os = "windows")]
fn new() -> Result<Self> {
use std::ffi::c_void;
use tao::platform::windows::EventLoopBuilderExtWindows;
use windows::Win32::UI::WindowsAndMessaging::{TranslateAcceleratorW, HACCEL, MSG};

Expand All @@ -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
Expand Down

0 comments on commit 4e521d0

Please sign in to comment.