From 75b866b16eaa7d045ba594c158af92369157c6f5 Mon Sep 17 00:00:00 2001 From: eugenesvk Date: Thu, 14 Nov 2024 21:53:16 +0700 Subject: [PATCH] Add numpad and help keys support in modifer flags key event info --- src/appkit/event/mod.rs | 6 ++++++ src/events.rs | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/appkit/event/mod.rs b/src/appkit/event/mod.rs index 8dd8839..0119af1 100644 --- a/src/appkit/event/mod.rs +++ b/src/appkit/event/mod.rs @@ -184,6 +184,8 @@ pub enum EventModifierFlag { Control, Option, Command, + Numpad, + Help, Function, DeviceIndependentFlagsMask } @@ -196,6 +198,8 @@ impl From for NSUInteger { EventModifierFlag::Control => 1 << 18, EventModifierFlag::Option => 1 << 19, EventModifierFlag::Command => 1 << 20, + EventModifierFlag::Numpad => 1 << 21, + EventModifierFlag::Help => 1 << 22, EventModifierFlag::Function => 1 << 23, EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000 } @@ -210,6 +214,8 @@ impl From<&EventModifierFlag> for NSUInteger { EventModifierFlag::Control => 1 << 18, EventModifierFlag::Option => 1 << 19, EventModifierFlag::Command => 1 << 20, + EventModifierFlag::Numpad => 1 << 21, + EventModifierFlag::Help => 1 << 22, EventModifierFlag::Function => 1 << 23, EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000 } diff --git a/src/events.rs b/src/events.rs index d08afac..da2be19 100644 --- a/src/events.rs +++ b/src/events.rs @@ -21,6 +21,12 @@ pub enum EventModifierFlag { /// Command (CMD) is held. Command, + /// Nnumeric keypad or an arrow key has been pressed. + Numpad, + + /// The Help key has been pressed + Help, + /// Function (🌐) is held or a function key has been pressed. Function, @@ -36,6 +42,8 @@ impl From for NSUInteger { EventModifierFlag::Control => 1 << 18, EventModifierFlag::Option => 1 << 19, EventModifierFlag::Command => 1 << 20, + EventModifierFlag::Numpad => 1 << 21, + EventModifierFlag::Help => 1 << 22, EventModifierFlag::Function => 1 << 23, EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000 } @@ -50,6 +58,8 @@ impl From<&EventModifierFlag> for NSUInteger { EventModifierFlag::Control => 1 << 18, EventModifierFlag::Option => 1 << 19, EventModifierFlag::Command => 1 << 20, + EventModifierFlag::Numpad => 1 << 21, + EventModifierFlag::Help => 1 << 22, EventModifierFlag::Function => 1 << 23, EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000 }