Skip to content

Commit

Permalink
Add numpad and help keys support in modifer flags key event info
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenesvk committed Nov 14, 2024
1 parent 80116a0 commit 9e73241
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/appkit/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ pub enum EventModifierFlag {
Control,
Option,
Command,
Numpad,
Help,
Function,
DeviceIndependentFlagsMask
}
Expand All @@ -196,6 +198,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
}
Expand All @@ -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
}
Expand Down
10 changes: 10 additions & 0 deletions src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Function,

Expand All @@ -36,6 +42,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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 9e73241

Please sign in to comment.