From 752cfd8a74d706ed71428a6157a91b46c31ee7d7 Mon Sep 17 00:00:00 2001
From: Andre Cipriani Bandarra
Date: Sat, 4 Apr 2026 09:20:15 +0100
Subject: [PATCH] Fix keyboard and mouse input on Windows ARM64
On aarch64, neither the x86_64 nor x86 cfg guards matched, so
SetWindowLongPtrA was never called to store the WindowsDisplay pointer
in the window's user data slot. win32_wndproc always read 0, hit the
early-return guard, and silently dropped every keyboard and mouse event.
Fix both affected sites (run() and set_fullscreen()) by extending the
x86_64 cfg to also cover aarch64, which is likewise a 64-bit platform
and uses SetWindowLongPtrA.
---
src/native/windows.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/native/windows.rs b/src/native/windows.rs
index de328aad..134cd98b 100644
--- a/src/native/windows.rs
+++ b/src/native/windows.rs
@@ -161,7 +161,7 @@ impl WindowsDisplay {
let win_style: DWORD = get_win_style(self.fullscreen, self.window_resizable);
unsafe {
- #[cfg(target_arch = "x86_64")]
+ #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
SetWindowLongPtrA(self.wnd, GWL_STYLE, win_style as _);
#[cfg(target_arch = "x86")]
SetWindowLong(self.wnd, GWL_STYLE, win_style as _);
@@ -942,7 +942,7 @@ where
display.event_handler = Some(f());
- #[cfg(target_arch = "x86_64")]
+ #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
SetWindowLongPtrA(wnd, GWLP_USERDATA, &mut display as *mut _ as isize);
#[cfg(target_arch = "x86")]
SetWindowLong(wnd, GWLP_USERDATA, &mut display as *mut _ as isize);