Skip to content

Commit

Permalink
macos: Fix regression with special keys such as VolumeUp
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv committed Sep 10, 2024
1 parent 7fb1a28 commit 7d92afa
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/macos/macos_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,14 +577,12 @@ impl Enigo {
}

fn special_keys(&self, code: isize, direction: Direction) -> InputResult<()> {
let flags = NSEventModifierFlags::NSEventModifierFlagCapsLock
.union(NSEventModifierFlags::NSEventModifierFlagOption);
if direction == Direction::Press || direction == Direction::Click {
let event = unsafe {
NSEvent::otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
NSEventType::SystemDefined, // 14
NSPoint::ZERO,
flags,
NSEventModifierFlags::empty(),
0.0,
0,
None,
Expand All @@ -609,12 +607,11 @@ impl Enigo {
}

if direction == Direction::Release || direction == Direction::Click {
let flags = flags.union(NSEventModifierFlags::NSEventModifierFlagShift);
let event = unsafe {
NSEvent::otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
NSEventType::SystemDefined, // 14
NSPoint::ZERO,
flags,
NSEventModifierFlags::empty(),
0.0,
0,
None,
Expand Down

0 comments on commit 7d92afa

Please sign in to comment.