#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused)]
use std::ffi::{c_long, c_void};
use objc2::encode::{Encode, Encoding, RefEncode};
pub type UInt32 = ::std::os::raw::c_uint;
pub type SInt32 = ::std::os::raw::c_int;
pub type OSStatus = SInt32;
pub type FourCharCode = UInt32;
pub type OSType = FourCharCode;
pub type ByteCount = ::std::os::raw::c_ulong;
pub type ItemCount = ::std::os::raw::c_ulong;
pub type OptionBits = UInt32;
pub type EventKind = UInt32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpaqueEventRef {
_unused: [u8; 0],
}
pub type EventRef = *mut OpaqueEventRef;
pub type EventParamName = OSType;
pub type EventParamType = OSType;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpaqueEventHandlerRef {
_unused: [u8; 0],
}
pub type EventHandlerRef = *mut OpaqueEventHandlerRef;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpaqueEventHandlerCallRef {
_unused: [u8; 0],
}
pub type EventHandlerCallRef = *mut OpaqueEventHandlerCallRef;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpaqueEventTargetRef {
_unused: [u8; 0],
}
pub type EventTargetRef = *mut OpaqueEventTargetRef;
pub type EventHandlerProcPtr = ::std::option::Option<
unsafe extern "C" fn(
inHandlerCallRef: EventHandlerCallRef,
inEvent: EventRef,
inUserData: *mut ::std::os::raw::c_void,
) -> OSStatus,
>;
pub type EventHandlerUPP = EventHandlerProcPtr;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OpaqueEventHotKeyRef {
_unused: [u8; 0],
}
pub type EventHotKeyRef = *mut OpaqueEventHotKeyRef;
pub type _bindgen_ty_1637 = ::std::os::raw::c_uint;
pub const kEventParamDirectObject: _bindgen_ty_1637 = 757935405;
pub const kEventParamDragRef: _bindgen_ty_1637 = 1685217639;
pub type _bindgen_ty_1921 = ::std::os::raw::c_uint;
pub const typeEventHotKeyID: _bindgen_ty_1921 = 1751869796;
pub type _bindgen_ty_1939 = ::std::os::raw::c_uint;
pub const kEventClassKeyboard: _bindgen_ty_1939 = 1801812322;
pub type _bindgen_ty_1980 = ::std::os::raw::c_uint;
pub const kEventHotKeyPressed: _bindgen_ty_1980 = 5;
pub type _bindgen_ty_1981 = ::std::os::raw::c_uint;
pub const kEventHotKeyReleased: _bindgen_ty_1981 = 6;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
pub const noErr: _bindgen_ty_1 = 0;
#[repr(C, packed(2))]
#[derive(Debug, Copy, Clone)]
pub struct EventHotKeyID {
pub signature: OSType,
pub id: UInt32,
}
#[repr(C, packed(2))]
#[derive(Debug, Copy, Clone)]
pub struct EventTypeSpec {
pub eventClass: OSType,
pub eventKind: EventKind,
}
#[link(name = "Carbon", kind = "framework")]
extern "C" {
pub fn GetEventParameter(
inEvent: EventRef,
inName: EventParamName,
inDesiredType: EventParamType,
outActualType: *mut EventParamType,
inBufferSize: ByteCount,
outActualSize: *mut ByteCount,
outData: *mut ::std::os::raw::c_void,
) -> OSStatus;
pub fn GetEventKind(inEvent: EventRef) -> EventKind;
pub fn GetApplicationEventTarget() -> EventTargetRef;
pub fn InstallEventHandler(
inTarget: EventTargetRef,
inHandler: EventHandlerUPP,
inNumTypes: ItemCount,
inList: *const EventTypeSpec,
inUserData: *mut ::std::os::raw::c_void,
outRef: *mut EventHandlerRef,
) -> OSStatus;
pub fn RemoveEventHandler(inHandlerRef: EventHandlerRef) -> OSStatus;
pub fn RegisterEventHotKey(
inHotKeyCode: UInt32,
inHotKeyModifiers: UInt32,
inHotKeyID: EventHotKeyID,
inTarget: EventTargetRef,
inOptions: OptionBits,
outRef: *mut EventHotKeyRef,
) -> OSStatus;
pub fn UnregisterEventHotKey(inHotKey: EventHotKeyRef) -> OSStatus;
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub enum CGEventTapLocation {
Hid,
Session,
AnnotatedSession,
}
#[repr(u32)]
#[derive(Clone, Copy, Debug)]
pub enum CGEventTapPlacement {
HeadInsertEventTap = 0,
TailAppendEventTap,
}
#[repr(u32)]
#[derive(Clone, Copy, Debug)]
pub enum CGEventTapOptions {
Default = 0x00000000,
ListenOnly = 0x00000001,
}
#[repr(u32)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CGEventType {
Null = 0,
LeftMouseDown = 1,
LeftMouseUp = 2,
RightMouseDown = 3,
RightMouseUp = 4,
MouseMoved = 5,
LeftMouseDragged = 6,
RightMouseDragged = 7,
KeyDown = 10,
KeyUp = 11,
FlagsChanged = 12,
AppKitDefined = 13,
SystemDefined = 14,
ApplicationDefined = 15,
ScrollWheel = 22,
TabletPointer = 23,
TabletProximity = 24,
OtherMouseDown = 25,
OtherMouseUp = 26,
OtherMouseDragged = 27,
TapDisabledByTimeout = 0xFFFFFFFE,
TapDisabledByUserInput = 0xFFFFFFFF,
}
pub type CGEventMask = u64;
#[macro_export]
macro_rules! CGEventMaskBit {
($eventType:expr) => {
1 << $eventType as CGEventMask
};
}
pub enum CGEvent {}
pub type CGEventRef = *const CGEvent;
unsafe impl RefEncode for CGEvent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("__CGEvent", &[]));
}
pub type CGEventTapProxy = *const c_void;
type CGEventTapCallBack = unsafe extern "C" fn(
proxy: CGEventTapProxy,
etype: CGEventType,
event: CGEventRef,
user_info: *const c_void,
) -> CGEventRef;
#[link(name = "CoreGraphics", kind = "framework")]
extern "C" {
pub fn CGEventTapCreate(
tap: CGEventTapLocation,
place: CGEventTapPlacement,
options: CGEventTapOptions,
events_of_interest: CGEventMask,
callback: CGEventTapCallBack,
user_info: *const c_void,
) -> CFMachPortRef;
pub fn CGEventTapEnable(tap: CFMachPortRef, enable: bool);
}
pub enum CFAllocator {}
pub type CFAllocatorRef = *mut CFAllocator;
pub enum CFRunLoop {}
pub type CFRunLoopRef = *mut CFRunLoop;
pub type CFRunLoopMode = CFStringRef;
pub enum CFRunLoopObserver {}
pub type CFRunLoopObserverRef = *mut CFRunLoopObserver;
pub enum CFRunLoopTimer {}
pub type CFRunLoopTimerRef = *mut CFRunLoopTimer;
pub enum CFRunLoopSource {}
pub type CFRunLoopSourceRef = *mut CFRunLoopSource;
pub enum CFString {}
pub type CFStringRef = *const CFString;
pub enum CFMachPort {}
pub type CFMachPortRef = *mut CFMachPort;
pub type CFIndex = c_long;
#[link(name = "CoreFoundation", kind = "framework")]
extern "C" {
pub static kCFRunLoopCommonModes: CFRunLoopMode;
pub static kCFAllocatorDefault: CFAllocatorRef;
pub fn CFRunLoopGetMain() -> CFRunLoopRef;
pub fn CFMachPortCreateRunLoopSource(
allocator: CFAllocatorRef,
port: CFMachPortRef,
order: CFIndex,
) -> CFRunLoopSourceRef;
pub fn CFMachPortInvalidate(port: CFMachPortRef);
pub fn CFRunLoopAddSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFRunLoopMode);
pub fn CFRunLoopRemoveSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFRunLoopMode);
pub fn CFRelease(cftype: *const c_void);
}