//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgeventmaskforallevents?language=objc)
pub const kCGEventMaskForAllEvents: c_uint = !0;
/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgnotifyeventtapadded?language=objc)
pub const kCGNotifyEventTapAdded: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.coregraphics.eventTapAdded\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgnotifyeventtapremoved?language=objc)
pub const kCGNotifyEventTapRemoved: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.coregraphics.eventTapRemoved\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgevent?language=objc)
#[doc(alias = "CGEventRef")]
#[repr(C)]
pub struct CGEvent {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CGEvent {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CGEvent"> for CGEvent {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgmousebutton?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGMouseButton(pub u32);
impl CGMouseButton {
    #[doc(alias = "kCGMouseButtonLeft")]
    pub const Left: Self = Self(0);
    #[doc(alias = "kCGMouseButtonRight")]
    pub const Right: Self = Self(1);
    #[doc(alias = "kCGMouseButtonCenter")]
    pub const Center: Self = Self(2);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGMouseButton {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGMouseButton {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscrolleventunit?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGScrollEventUnit(pub u32);
impl CGScrollEventUnit {
    #[doc(alias = "kCGScrollEventUnitPixel")]
    pub const Pixel: Self = Self(0);
    #[doc(alias = "kCGScrollEventUnitLine")]
    pub const Line: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGScrollEventUnit {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGScrollEventUnit {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgmomentumscrollphase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGMomentumScrollPhase(pub u32);
impl CGMomentumScrollPhase {
    #[doc(alias = "kCGMomentumScrollPhaseNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "kCGMomentumScrollPhaseBegin")]
    pub const Begin: Self = Self(1);
    #[doc(alias = "kCGMomentumScrollPhaseContinue")]
    pub const Continue: Self = Self(2);
    #[doc(alias = "kCGMomentumScrollPhaseEnd")]
    pub const End: Self = Self(3);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGMomentumScrollPhase {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGMomentumScrollPhase {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscrollphase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGScrollPhase(pub u32);
impl CGScrollPhase {
    #[doc(alias = "kCGScrollPhaseBegan")]
    pub const Began: Self = Self(1);
    #[doc(alias = "kCGScrollPhaseChanged")]
    pub const Changed: Self = Self(2);
    #[doc(alias = "kCGScrollPhaseEnded")]
    pub const Ended: Self = Self(4);
    #[doc(alias = "kCGScrollPhaseCancelled")]
    pub const Cancelled: Self = Self(8);
    #[doc(alias = "kCGScrollPhaseMayBegin")]
    pub const MayBegin: Self = Self(128);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGScrollPhase {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGScrollPhase {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cggesturephase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGGesturePhase(pub u32);
impl CGGesturePhase {
    #[doc(alias = "kCGGesturePhaseNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "kCGGesturePhaseBegan")]
    pub const Began: Self = Self(1);
    #[doc(alias = "kCGGesturePhaseChanged")]
    pub const Changed: Self = Self(2);
    #[doc(alias = "kCGGesturePhaseEnded")]
    pub const Ended: Self = Self(4);
    #[doc(alias = "kCGGesturePhaseCancelled")]
    pub const Cancelled: Self = Self(8);
    #[doc(alias = "kCGGesturePhaseMayBegin")]
    pub const MayBegin: Self = Self(128);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGGesturePhase {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGGesturePhase {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventflags?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventFlags(pub u64);
bitflags::bitflags! {
    impl CGEventFlags: u64 {
        #[doc(alias = "kCGEventFlagMaskAlphaShift")]
        const MaskAlphaShift = 65536;
        #[doc(alias = "kCGEventFlagMaskShift")]
        const MaskShift = 131072;
        #[doc(alias = "kCGEventFlagMaskControl")]
        const MaskControl = 262144;
        #[doc(alias = "kCGEventFlagMaskAlternate")]
        const MaskAlternate = 524288;
        #[doc(alias = "kCGEventFlagMaskCommand")]
        const MaskCommand = 1048576;
        #[doc(alias = "kCGEventFlagMaskHelp")]
        const MaskHelp = 4194304;
        #[doc(alias = "kCGEventFlagMaskSecondaryFn")]
        const MaskSecondaryFn = 8388608;
        #[doc(alias = "kCGEventFlagMaskNumericPad")]
        const MaskNumericPad = 2097152;
        #[doc(alias = "kCGEventFlagMaskNonCoalesced")]
        const MaskNonCoalesced = 256;
    }
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventFlags {
    const ENCODING: Encoding = u64::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventFlags {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventType(pub u32);
impl CGEventType {
    #[doc(alias = "kCGEventNull")]
    pub const Null: Self = Self(0);
    #[doc(alias = "kCGEventLeftMouseDown")]
    pub const LeftMouseDown: Self = Self(1);
    #[doc(alias = "kCGEventLeftMouseUp")]
    pub const LeftMouseUp: Self = Self(2);
    #[doc(alias = "kCGEventRightMouseDown")]
    pub const RightMouseDown: Self = Self(3);
    #[doc(alias = "kCGEventRightMouseUp")]
    pub const RightMouseUp: Self = Self(4);
    #[doc(alias = "kCGEventMouseMoved")]
    pub const MouseMoved: Self = Self(5);
    #[doc(alias = "kCGEventLeftMouseDragged")]
    pub const LeftMouseDragged: Self = Self(6);
    #[doc(alias = "kCGEventRightMouseDragged")]
    pub const RightMouseDragged: Self = Self(7);
    #[doc(alias = "kCGEventKeyDown")]
    pub const KeyDown: Self = Self(10);
    #[doc(alias = "kCGEventKeyUp")]
    pub const KeyUp: Self = Self(11);
    #[doc(alias = "kCGEventFlagsChanged")]
    pub const FlagsChanged: Self = Self(12);
    #[doc(alias = "kCGEventScrollWheel")]
    pub const ScrollWheel: Self = Self(22);
    #[doc(alias = "kCGEventTabletPointer")]
    pub const TabletPointer: Self = Self(23);
    #[doc(alias = "kCGEventTabletProximity")]
    pub const TabletProximity: Self = Self(24);
    #[doc(alias = "kCGEventOtherMouseDown")]
    pub const OtherMouseDown: Self = Self(25);
    #[doc(alias = "kCGEventOtherMouseUp")]
    pub const OtherMouseUp: Self = Self(26);
    #[doc(alias = "kCGEventOtherMouseDragged")]
    pub const OtherMouseDragged: Self = Self(27);
    #[doc(alias = "kCGEventTapDisabledByTimeout")]
    pub const TapDisabledByTimeout: Self = Self(4294967294);
    #[doc(alias = "kCGEventTapDisabledByUserInput")]
    pub const TapDisabledByUserInput: Self = Self(4294967295);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventType {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtimestamp?language=objc)
pub type CGEventTimestamp = u64;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventfield?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventField(pub u32);
impl CGEventField {
    #[doc(alias = "kCGMouseEventNumber")]
    pub const MouseEventNumber: Self = Self(0);
    #[doc(alias = "kCGMouseEventClickState")]
    pub const MouseEventClickState: Self = Self(1);
    #[doc(alias = "kCGMouseEventPressure")]
    pub const MouseEventPressure: Self = Self(2);
    #[doc(alias = "kCGMouseEventButtonNumber")]
    pub const MouseEventButtonNumber: Self = Self(3);
    #[doc(alias = "kCGMouseEventDeltaX")]
    pub const MouseEventDeltaX: Self = Self(4);
    #[doc(alias = "kCGMouseEventDeltaY")]
    pub const MouseEventDeltaY: Self = Self(5);
    #[doc(alias = "kCGMouseEventInstantMouser")]
    pub const MouseEventInstantMouser: Self = Self(6);
    #[doc(alias = "kCGMouseEventSubtype")]
    pub const MouseEventSubtype: Self = Self(7);
    #[doc(alias = "kCGKeyboardEventAutorepeat")]
    pub const KeyboardEventAutorepeat: Self = Self(8);
    #[doc(alias = "kCGKeyboardEventKeycode")]
    pub const KeyboardEventKeycode: Self = Self(9);
    #[doc(alias = "kCGKeyboardEventKeyboardType")]
    pub const KeyboardEventKeyboardType: Self = Self(10);
    #[doc(alias = "kCGScrollWheelEventDeltaAxis1")]
    pub const ScrollWheelEventDeltaAxis1: Self = Self(11);
    #[doc(alias = "kCGScrollWheelEventDeltaAxis2")]
    pub const ScrollWheelEventDeltaAxis2: Self = Self(12);
    #[doc(alias = "kCGScrollWheelEventDeltaAxis3")]
    pub const ScrollWheelEventDeltaAxis3: Self = Self(13);
    #[doc(alias = "kCGScrollWheelEventFixedPtDeltaAxis1")]
    pub const ScrollWheelEventFixedPtDeltaAxis1: Self = Self(93);
    #[doc(alias = "kCGScrollWheelEventFixedPtDeltaAxis2")]
    pub const ScrollWheelEventFixedPtDeltaAxis2: Self = Self(94);
    #[doc(alias = "kCGScrollWheelEventFixedPtDeltaAxis3")]
    pub const ScrollWheelEventFixedPtDeltaAxis3: Self = Self(95);
    #[doc(alias = "kCGScrollWheelEventPointDeltaAxis1")]
    pub const ScrollWheelEventPointDeltaAxis1: Self = Self(96);
    #[doc(alias = "kCGScrollWheelEventPointDeltaAxis2")]
    pub const ScrollWheelEventPointDeltaAxis2: Self = Self(97);
    #[doc(alias = "kCGScrollWheelEventPointDeltaAxis3")]
    pub const ScrollWheelEventPointDeltaAxis3: Self = Self(98);
    #[doc(alias = "kCGScrollWheelEventScrollPhase")]
    pub const ScrollWheelEventScrollPhase: Self = Self(99);
    #[doc(alias = "kCGScrollWheelEventScrollCount")]
    pub const ScrollWheelEventScrollCount: Self = Self(100);
    #[doc(alias = "kCGScrollWheelEventMomentumPhase")]
    pub const ScrollWheelEventMomentumPhase: Self = Self(123);
    #[doc(alias = "kCGScrollWheelEventInstantMouser")]
    pub const ScrollWheelEventInstantMouser: Self = Self(14);
    #[doc(alias = "kCGTabletEventPointX")]
    pub const TabletEventPointX: Self = Self(15);
    #[doc(alias = "kCGTabletEventPointY")]
    pub const TabletEventPointY: Self = Self(16);
    #[doc(alias = "kCGTabletEventPointZ")]
    pub const TabletEventPointZ: Self = Self(17);
    #[doc(alias = "kCGTabletEventPointButtons")]
    pub const TabletEventPointButtons: Self = Self(18);
    #[doc(alias = "kCGTabletEventPointPressure")]
    pub const TabletEventPointPressure: Self = Self(19);
    #[doc(alias = "kCGTabletEventTiltX")]
    pub const TabletEventTiltX: Self = Self(20);
    #[doc(alias = "kCGTabletEventTiltY")]
    pub const TabletEventTiltY: Self = Self(21);
    #[doc(alias = "kCGTabletEventRotation")]
    pub const TabletEventRotation: Self = Self(22);
    #[doc(alias = "kCGTabletEventTangentialPressure")]
    pub const TabletEventTangentialPressure: Self = Self(23);
    #[doc(alias = "kCGTabletEventDeviceID")]
    pub const TabletEventDeviceID: Self = Self(24);
    #[doc(alias = "kCGTabletEventVendor1")]
    pub const TabletEventVendor1: Self = Self(25);
    #[doc(alias = "kCGTabletEventVendor2")]
    pub const TabletEventVendor2: Self = Self(26);
    #[doc(alias = "kCGTabletEventVendor3")]
    pub const TabletEventVendor3: Self = Self(27);
    #[doc(alias = "kCGTabletProximityEventVendorID")]
    pub const TabletProximityEventVendorID: Self = Self(28);
    #[doc(alias = "kCGTabletProximityEventTabletID")]
    pub const TabletProximityEventTabletID: Self = Self(29);
    #[doc(alias = "kCGTabletProximityEventPointerID")]
    pub const TabletProximityEventPointerID: Self = Self(30);
    #[doc(alias = "kCGTabletProximityEventDeviceID")]
    pub const TabletProximityEventDeviceID: Self = Self(31);
    #[doc(alias = "kCGTabletProximityEventSystemTabletID")]
    pub const TabletProximityEventSystemTabletID: Self = Self(32);
    #[doc(alias = "kCGTabletProximityEventVendorPointerType")]
    pub const TabletProximityEventVendorPointerType: Self = Self(33);
    #[doc(alias = "kCGTabletProximityEventVendorPointerSerialNumber")]
    pub const TabletProximityEventVendorPointerSerialNumber: Self = Self(34);
    #[doc(alias = "kCGTabletProximityEventVendorUniqueID")]
    pub const TabletProximityEventVendorUniqueID: Self = Self(35);
    #[doc(alias = "kCGTabletProximityEventCapabilityMask")]
    pub const TabletProximityEventCapabilityMask: Self = Self(36);
    #[doc(alias = "kCGTabletProximityEventPointerType")]
    pub const TabletProximityEventPointerType: Self = Self(37);
    #[doc(alias = "kCGTabletProximityEventEnterProximity")]
    pub const TabletProximityEventEnterProximity: Self = Self(38);
    #[doc(alias = "kCGEventTargetProcessSerialNumber")]
    pub const EventTargetProcessSerialNumber: Self = Self(39);
    #[doc(alias = "kCGEventTargetUnixProcessID")]
    pub const EventTargetUnixProcessID: Self = Self(40);
    #[doc(alias = "kCGEventSourceUnixProcessID")]
    pub const EventSourceUnixProcessID: Self = Self(41);
    #[doc(alias = "kCGEventSourceUserData")]
    pub const EventSourceUserData: Self = Self(42);
    #[doc(alias = "kCGEventSourceUserID")]
    pub const EventSourceUserID: Self = Self(43);
    #[doc(alias = "kCGEventSourceGroupID")]
    pub const EventSourceGroupID: Self = Self(44);
    #[doc(alias = "kCGEventSourceStateID")]
    pub const EventSourceStateID: Self = Self(45);
    #[doc(alias = "kCGScrollWheelEventIsContinuous")]
    pub const ScrollWheelEventIsContinuous: Self = Self(88);
    #[doc(alias = "kCGMouseEventWindowUnderMousePointer")]
    pub const MouseEventWindowUnderMousePointer: Self = Self(91);
    #[doc(alias = "kCGMouseEventWindowUnderMousePointerThatCanHandleThisEvent")]
    pub const MouseEventWindowUnderMousePointerThatCanHandleThisEvent: Self = Self(92);
    #[doc(alias = "kCGEventUnacceleratedPointerMovementX")]
    pub const EventUnacceleratedPointerMovementX: Self = Self(170);
    #[doc(alias = "kCGEventUnacceleratedPointerMovementY")]
    pub const EventUnacceleratedPointerMovementY: Self = Self(171);
    #[doc(alias = "kCGScrollWheelEventMomentumOptionPhase")]
    pub const ScrollWheelEventMomentumOptionPhase: Self = Self(173);
    #[doc(alias = "kCGScrollWheelEventAcceleratedDeltaAxis1")]
    pub const ScrollWheelEventAcceleratedDeltaAxis1: Self = Self(176);
    #[doc(alias = "kCGScrollWheelEventAcceleratedDeltaAxis2")]
    pub const ScrollWheelEventAcceleratedDeltaAxis2: Self = Self(175);
    #[doc(alias = "kCGScrollWheelEventRawDeltaAxis1")]
    pub const ScrollWheelEventRawDeltaAxis1: Self = Self(178);
    #[doc(alias = "kCGScrollWheelEventRawDeltaAxis2")]
    pub const ScrollWheelEventRawDeltaAxis2: Self = Self(177);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventField {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventField {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventmousesubtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventMouseSubtype(pub u32);
impl CGEventMouseSubtype {
    #[doc(alias = "kCGEventMouseSubtypeDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "kCGEventMouseSubtypeTabletPoint")]
    pub const TabletPoint: Self = Self(1);
    #[doc(alias = "kCGEventMouseSubtypeTabletProximity")]
    pub const TabletProximity: Self = Self(2);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventMouseSubtype {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventMouseSubtype {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtaplocation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventTapLocation(pub u32);
impl CGEventTapLocation {
    #[doc(alias = "kCGHIDEventTap")]
    pub const HIDEventTap: Self = Self(0);
    #[doc(alias = "kCGSessionEventTap")]
    pub const SessionEventTap: Self = Self(1);
    #[doc(alias = "kCGAnnotatedSessionEventTap")]
    pub const AnnotatedSessionEventTap: Self = Self(2);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventTapLocation {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventTapLocation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtapplacement?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventTapPlacement(pub u32);
impl CGEventTapPlacement {
    #[doc(alias = "kCGHeadInsertEventTap")]
    pub const HeadInsertEventTap: Self = Self(0);
    #[doc(alias = "kCGTailAppendEventTap")]
    pub const TailAppendEventTap: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventTapPlacement {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventTapPlacement {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtapoptions?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventTapOptions(pub u32);
impl CGEventTapOptions {
    #[doc(alias = "kCGEventTapOptionDefault")]
    pub const Default: Self = Self(0x00000000);
    #[doc(alias = "kCGEventTapOptionListenOnly")]
    pub const ListenOnly: Self = Self(0x00000001);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventTapOptions {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventTapOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventmask?language=objc)
pub type CGEventMask = u64;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/__cgeventtapproxy?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct __CGEventTapProxy {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for __CGEventTapProxy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("__CGEventTapProxy", &[]));
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtapproxy?language=objc)
pub type CGEventTapProxy = *mut __CGEventTapProxy;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtapcallback?language=objc)
pub type CGEventTapCallBack = Option<
    unsafe extern "C-unwind" fn(
        CGEventTapProxy,
        CGEventType,
        NonNull<CGEvent>,
        *mut c_void,
    ) -> *mut CGEvent,
>;

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventtapinformation?language=objc)
#[cfg(feature = "libc")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CGEventTapInformation {
    pub eventTapID: u32,
    pub tapPoint: CGEventTapLocation,
    pub options: CGEventTapOptions,
    pub eventsOfInterest: CGEventMask,
    pub tappingProcess: libc::pid_t,
    pub processBeingTapped: libc::pid_t,
    pub enabled: bool,
    pub minUsecLatency: c_float,
    pub avgUsecLatency: c_float,
    pub maxUsecLatency: c_float,
}

#[cfg(all(feature = "libc", feature = "objc2"))]
unsafe impl Encode for CGEventTapInformation {
    const ENCODING: Encoding = Encoding::Struct(
        "__CGEventTapInformation",
        &[
            <u32>::ENCODING,
            <CGEventTapLocation>::ENCODING,
            <CGEventTapOptions>::ENCODING,
            <CGEventMask>::ENCODING,
            <libc::pid_t>::ENCODING,
            <libc::pid_t>::ENCODING,
            Encoding::Bool,
            <c_float>::ENCODING,
            <c_float>::ENCODING,
            <c_float>::ENCODING,
        ],
    );
}

#[cfg(all(feature = "libc", feature = "objc2"))]
unsafe impl RefEncode for CGEventTapInformation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventsource?language=objc)
#[doc(alias = "CGEventSourceRef")]
#[repr(C)]
pub struct CGEventSource {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

cf_type!(
    unsafe impl CGEventSource {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
    unsafe impl RefEncode<"__CGEventSource"> for CGEventSource {}
);

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventsourcestateid?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGEventSourceStateID(pub i32);
impl CGEventSourceStateID {
    #[doc(alias = "kCGEventSourceStatePrivate")]
    pub const Private: Self = Self(-1);
    #[doc(alias = "kCGEventSourceStateCombinedSessionState")]
    pub const CombinedSessionState: Self = Self(0);
    #[doc(alias = "kCGEventSourceStateHIDSystemState")]
    pub const HIDSystemState: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGEventSourceStateID {
    const ENCODING: Encoding = i32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGEventSourceStateID {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventsourcekeyboardtype?language=objc)
pub type CGEventSourceKeyboardType = u32;
