Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
pentamassiv committed Jan 6, 2024
1 parent 2d3cb88 commit 1b00c1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/macos/macos_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,13 @@ impl Enigo {
None,
8,
(code << 16) | (0xa << 8),
0 // this is -1 in all examples but due to the type, we can't use negative numbers
-1
)
};

if event.is_none() {
if let Some(event) = event {
unsafe { msg_send![event, lengthOfBytesUsingEncoding: UTF8_ENCODING] }
} else {
return Err(InputError::Simulate(
"failed creating event to press special key",
));
Expand All @@ -604,11 +606,13 @@ impl Enigo {
None,
8,
(code << 16) | (0xb << 8),
0 // this is -1 in all examples but due to the type, we can't use negative numbers
-1
)
};

if event.is_none() {
if let Some(event) = event {
unsafe { msg_send![event, post: objc::runtime::cghidEventTap()] }
} else {
return Err(InputError::Simulate(
"failed creating event to release special key",
));
Expand Down

0 comments on commit 1b00c1b

Please sign in to comment.