#![allow(non_upper_case_globals, non_snake_case, dead_code)]
use std::os::raw::c_void;
pub(crate) type CGEventRef = *mut c_void;
pub(crate) type CGEventSourceRef = *mut c_void;
pub(crate) type CFMachPortRef = *mut c_void;
pub(crate) type CFRunLoopSourceRef = *mut c_void;
pub(crate) type CFRunLoopRef = *mut c_void;
pub(crate) type CGEventTapProxy = *mut c_void;
pub(crate) type CGEventTapCallBack = unsafe extern "C" fn(
proxy: CGEventTapProxy,
etype: u32,
event: CGEventRef,
user_info: *mut c_void,
) -> CGEventRef;
pub(crate) const kCGHIDEventTap: u32 = 0;
pub(crate) const kCGSessionEventTap: u32 = 1;
pub(crate) const kCGAnnotatedSessionEventTap: u32 = 2;
pub(crate) const kCGHeadInsertEventTap: u32 = 0;
pub(crate) const kCGEventTapOptionDefault: u32 = 0;
pub(crate) const kCGEventTapOptionListenOnly: u32 = 1;
pub(crate) const kCGEventLeftMouseDown: u32 = 1;
pub(crate) const kCGEventKeyDown: u32 = 10;
pub(crate) const kCGEventKeyUp: u32 = 11;
pub(crate) const kCGEventFlagsChanged: u32 = 12;
pub(crate) const kCGEventTapDisabledByTimeout: u32 = 0xFFFF_FFFE;
pub(crate) const kCGEventTapDisabledByUserInput: u32 = 0xFFFF_FFFF;
pub(crate) const kCGKeyboardEventKeycode: u32 = 9;
pub(crate) const kCGEventSourceUserData: u32 = 42;
pub(crate) const SYNTHETIC_MARK: i64 = 0x6879_7072;
pub(crate) const kCGEventFlagMaskAlphaShift: u64 = 1 << 16;
pub(crate) const kCGEventFlagMaskShift: u64 = 1 << 17;
pub(crate) const kCGEventFlagMaskControl: u64 = 1 << 18;
pub(crate) const kCGEventFlagMaskAlternate: u64 = 1 << 19; pub(crate) const kCGEventFlagMaskCommand: u64 = 1 << 20;
pub(crate) const kCGEventFlagMaskSecondaryFn: u64 = 1 << 23;
pub(crate) const kCGEventFlagMaskNumericPad: u64 = 1 << 21;
pub(crate) const kCGEventSourceStateHIDSystemState: i32 = 1;
pub(crate) const fn event_mask_bit(event_type: u32) -> u64 {
1u64 << event_type
}
#[link(name = "CoreGraphics", kind = "framework")]
unsafe extern "C" {
pub(crate) fn CGEventTapCreate(
tap: u32,
place: u32,
options: u32,
events_of_interest: u64,
callback: CGEventTapCallBack,
user_info: *mut c_void,
) -> CFMachPortRef;
pub(crate) fn CGEventTapEnable(tap: CFMachPortRef, enable: bool);
pub(crate) fn CGEventGetIntegerValueField(event: CGEventRef, field: u32) -> i64;
pub(crate) fn CGEventSetIntegerValueField(event: CGEventRef, field: u32, value: i64);
pub(crate) fn CGEventGetFlags(event: CGEventRef) -> u64;
pub(crate) fn CGEventKeyboardGetUnicodeString(
event: CGEventRef,
max_len: usize,
actual_len: *mut usize,
unicode_string: *mut u16,
);
pub(crate) fn CGEventCreateKeyboardEvent(
source: CGEventSourceRef,
virtual_key: u16,
key_down: bool,
) -> CGEventRef;
pub(crate) fn CGEventKeyboardSetUnicodeString(
event: CGEventRef,
length: usize,
unicode_string: *const u16,
);
pub(crate) fn CGEventSetFlags(event: CGEventRef, flags: u64);
pub(crate) fn CGEventPost(tap: u32, event: CGEventRef);
pub(crate) fn CGEventSourceCreate(state_id: i32) -> CGEventSourceRef;
pub(crate) fn CGPreflightListenEventAccess() -> bool;
pub(crate) fn CGRequestListenEventAccess() -> bool;
pub(crate) fn CGPreflightPostEventAccess() -> bool;
pub(crate) fn CGRequestPostEventAccess() -> bool;
}
#[link(name = "CoreFoundation", kind = "framework")]
unsafe extern "C" {
pub(crate) fn CFRelease(cf: *const c_void);
pub(crate) fn CFRunLoopGetCurrent() -> CFRunLoopRef;
pub(crate) fn CFMachPortCreateRunLoopSource(
allocator: *const c_void,
port: CFMachPortRef,
order: isize,
) -> CFRunLoopSourceRef;
pub(crate) fn CFRunLoopAddSource(
rl: CFRunLoopRef,
source: CFRunLoopSourceRef,
mode: *const c_void,
);
pub(crate) fn CFRunLoopRun();
pub(crate) fn CFRunLoopStop(rl: CFRunLoopRef);
pub(crate) static kCFRunLoopCommonModes: *const c_void;
pub(crate) fn CFDictionaryCreate(
allocator: *const c_void,
keys: *const *const c_void,
values: *const *const c_void,
num_values: isize,
key_callbacks: *const c_void,
value_callbacks: *const c_void,
) -> *const c_void;
pub(crate) static kCFTypeDictionaryKeyCallBacks: c_void;
pub(crate) static kCFTypeDictionaryValueCallBacks: c_void;
pub(crate) static kCFBooleanTrue: *const c_void;
}
#[link(name = "ApplicationServices", kind = "framework")]
unsafe extern "C" {
pub(crate) fn AXIsProcessTrusted() -> bool;
pub(crate) fn AXIsProcessTrustedWithOptions(options: *const c_void) -> bool;
pub(crate) static kAXTrustedCheckOptionPrompt: *const c_void;
}