From 6fecb8bf94158b0534e61723937f73ab794ed299 Mon Sep 17 00:00:00 2001 From: yolanda Date: Sat, 20 Jun 2026 12:30:26 +0200 Subject: [PATCH] fix(macos): track Fn flag bit in FlagsChanged handler v0.3.0 added Key::Function (kVK_Function, keycode 63) to the keycode table, but flag_bit_for_key() never got the matching branch, so every Fn FlagsChanged event fell through to the _ => 0 fallback arm and was silently dropped, making Fn unobservable on macOS. Map it to kCGEventFlagMaskSecondaryFn (0x800000), mirroring how the other modifiers are tracked. --- src/platform/macos/tap.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/macos/tap.rs b/src/platform/macos/tap.rs index c070c2a..502edf5 100644 --- a/src/platform/macos/tap.rs +++ b/src/platform/macos/tap.rs @@ -68,6 +68,7 @@ const CGEVENT_FLAG_ALT_RIGHT: u64 = 0x00080040; const CGEVENT_FLAG_META_LEFT: u64 = 0x00100008; const CGEVENT_FLAG_META_RIGHT: u64 = 0x00100010; const CGEVENT_FLAG_CAPS_LOCK: u64 = 0x00010000; +const CGEVENT_FLAG_FUNCTION: u64 = 0x800000; // kCGEventFlagMaskSecondaryFn — macOS Fn /// Heap-allocated context pointed to by the CGEventTap's `user_info`. /// Lives for the full lifetime of the tap. Freed in [`ShutdownGuard::drop`] @@ -373,6 +374,7 @@ fn flag_bit_for_key(key: Key) -> u64 { Key::MetaLeft => CGEVENT_FLAG_META_LEFT, Key::MetaRight => CGEVENT_FLAG_META_RIGHT, Key::CapsLock => CGEVENT_FLAG_CAPS_LOCK, + Key::Function => CGEVENT_FLAG_FUNCTION, _ => 0, } }