1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "dispatch2")]
8use dispatch2::*;
9#[cfg(feature = "objc2")]
10use objc2::__framework_prelude::*;
11use objc2_core_foundation::*;
12
13use crate::*;
14
15pub const EVENT_SYSTEM_VERSION: c_uint = 2;
17pub const kNXEventDataVersion: c_uint = 2;
19pub const kNXEventVersion: c_uint = 2;
21pub const kIOHIDKindKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKind\0") };
23pub const kIOHIDInterfaceIDKey: &CStr =
25 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDInterfaceID\0") };
26pub const kIOHIDSubinterfaceIDKey: &CStr =
28 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDSubinterfaceID\0") };
29pub const kIOHIDOriginalSubinterfaceIDKey: &CStr =
31 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDOriginalSubinterfaceID\0") };
32pub const kIOHIDParametersKey: &CStr =
34 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDParameters\0") };
35pub const kIOHIDVirtualHIDevice: &CStr =
37 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDVirtualDevice\0") };
38pub const kIOHIDKeyRepeatKey: &CStr =
40 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyRepeat\0") };
41pub const kIOHIDInitialKeyRepeatKey: &CStr =
43 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDInitialKeyRepeat\0") };
44pub const kIOHIDKeyMappingKey: &CStr =
46 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyMapping\0") };
47pub const kIOHIDResetKeyboardKey: &CStr =
49 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDResetKeyboard\0") };
50pub const kIOHIDKeyboardModifierMappingPairsKey: &CStr =
52 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardModifierMappingPairs\0") };
53pub const kIOHIDKeyboardModifierMappingSrcKey: &CStr =
55 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardModifierMappingSrc\0") };
56pub const kIOHIDKeyboardModifierMappingDstKey: &CStr =
58 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardModifierMappingDst\0") };
59pub const kIOHIDKeyboardCapsLockDoesLockKey: &CStr =
61 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardCapsLockDoesLock\0") };
62pub const kIOHIDKeyboardSupportsF12EjectKey: &CStr =
64 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardSupportsF12Eject\0") };
65pub const kIOHIDKeyboardSupportedModifiersKey: &CStr =
67 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardSupportedModifiers\0") };
68pub const kIOHIDKeyboardGlobalModifiersKey: &CStr =
70 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDKeyboardGlobalModifiers\0") };
71pub const kIOHIDServiceGlobalModifiersUsageKey: &CStr =
73 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDServiceGlobalModifiersUsage\0") };
74pub const kIOHIDPointerResolutionKey: &CStr =
76 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerResolution\0") };
77pub const kIOHIDResetPointerKey: &CStr =
79 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDResetPointer\0") };
80pub const kIOHIDPointerConvertAbsoluteKey: &CStr =
82 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerConvertAbsolute\0") };
83pub const kIOHIDPointerContactToMoveKey: &CStr =
85 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerContactToMove\0") };
86pub const kIOHIDPointerPressureToClickKey: &CStr =
88 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerPressureToClick\0") };
89pub const kIOHIDPointerButtonCountKey: &CStr =
91 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerButtonCount\0") };
92pub const kIOHIDPointerAccelerationSettingsKey: &CStr =
94 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerAccelerationSettings\0") };
95pub const kIOHIDPointerAccelerationTableKey: &CStr =
97 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDPointerAccelerationTable\0") };
98pub const kIOHIDScrollResetKey: &CStr =
100 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollReset\0") };
101pub const kIOHIDScrollAccelerationTableKey: &CStr =
103 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollAccelerationTable\0") };
104pub const kIOHIDScrollAccelerationTableXKey: &CStr =
106 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollAccelerationTableX\0") };
107pub const kIOHIDScrollAccelerationTableYKey: &CStr =
109 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollAccelerationTableY\0") };
110pub const kIOHIDScrollAccelerationTableZKey: &CStr =
112 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollAccelerationTableZ\0") };
113pub const kIOHIDScrollMouseButtonKey: &CStr =
115 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollMouseButton\0") };
116pub const kIOHIDScrollZoomModifierMaskKey: &CStr =
118 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollZoomModifierMask\0") };
119pub const kIOHIDClickTimeKey: &CStr =
121 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDClickTime\0") };
122pub const kIOHIDClickSpaceKey: &CStr =
124 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDClickSpace\0") };
125pub const kIOHIDWaitCursorFrameIntervalKey: &CStr =
127 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDWaitCursorFrameInterval\0") };
128pub const kIOHIDAutoDimThresholdKey: &CStr =
130 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAutoDimThreshold\0") };
131pub const kIOHIDAutoDimStateKey: &CStr =
133 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAutoDimState\0") };
134pub const kIOHIDAutoDimTimeKey: &CStr =
136 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAutoDimTime\0") };
137pub const kIOHIDIdleTimeKey: &CStr =
139 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDIdleTime\0") };
140pub const kIOHIDBrightnessKey: &CStr =
142 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDBrightness\0") };
143pub const kIOHIDAutoDimBrightnessKey: &CStr =
145 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAutoDimBrightness\0") };
146pub const kIOHIDFKeyModeKey: &CStr =
148 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDFKeyMode\0") };
149pub const kIOHIDStickyKeysDisabledKey: &CStr =
151 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDStickyKeysDisabled\0") };
152pub const kIOHIDStickyKeysOnKey: &CStr =
154 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDStickyKeysOn\0") };
155pub const kIOHIDStickyKeysShiftTogglesKey: &CStr =
157 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDStickyKeysShiftToggles\0") };
158pub const kIOHIDResetStickyKeyNotification: &CStr =
160 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDResetStickyKeyNotification\0") };
161pub const kIOHIDMouseKeysOptionTogglesKey: &CStr =
163 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDMouseKeysOptionToggles\0") };
164pub const kIOHIDSlowKeysDelayKey: &CStr =
166 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDSlowKeysDelay\0") };
167pub const kIOHIDF12EjectDelayKey: &CStr =
169 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDF12EjectDelay\0") };
170pub const kIOHIDMouseKeysOnKey: &CStr =
172 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDMouseKeysOn\0") };
173pub const kIOHIDUseKeyswitchKey: &CStr =
175 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDUseKeyswitch\0") };
176pub const kIOHIDDisallowRemappingOfPrimaryClickKey: &CStr =
178 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDDisallowRemappingOfPrimaryClick\0") };
179pub const kIOHIDMouseKeysEnablesVirtualNumPadKey: &CStr =
181 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDMouseKeysEnablesVirtualNumPad\0") };
182pub const kIOHIDResetLEDsKey: &CStr =
184 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDResetLEDs\0") };
185pub const kHIDTrackingAccelParametricCurvesKey: &CStr =
187 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDTrackingAccelCurves\0") };
188pub const kHIDAccelParametricCurvesDebugKey: &CStr =
190 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelCurvesDebug\0") };
191pub const kHIDScrollAccelParametricCurvesDebugKey: &CStr =
193 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollAccelCurvesDebug\0") };
194pub const kHIDAccelGainLinearKey: &CStr =
196 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelGainLinear\0") };
197pub const kHIDAccelGainParabolicKey: &CStr =
199 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelGainParabolic\0") };
200pub const kHIDAccelGainCubicKey: &CStr =
202 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelGainCubic\0") };
203pub const kHIDAccelGainQuarticKey: &CStr =
205 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelGainQuartic\0") };
206pub const kHIDAccelTangentSpeedLinearKey: &CStr =
208 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelTangentSpeedLinear\0") };
209pub const kHIDAccelTangentSpeedParabolicRootKey: &CStr =
211 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelTangentSpeedParabolicRoot\0") };
212pub const kHIDAccelTangentSpeedCubicRootKey: &CStr =
214 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelTangentSpeedCubicRoot\0") };
215pub const kHIDAccelTangentSpeedQuarticRootKey: &CStr =
217 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelTangentSpeedQuarticRoot\0") };
218pub const kHIDAccelIndexKey: &CStr =
220 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDAccelIndex\0") };
221pub const kIOHIDScrollCountMaxTimeDeltaBetweenKey: &CStr =
223 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMaxTimeDeltaBetween\0") };
224pub const kIOHIDScrollCountMaxTimeDeltaToSustainKey: &CStr =
226 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMaxTimeDeltaToSustain\0") };
227pub const kIOHIDScrollCountMinDeltaToStartKey: &CStr =
229 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMinDeltaToStart\0") };
230pub const kIOHIDScrollCountMinDeltaToSustainKey: &CStr =
232 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMinDeltaToSustain\0") };
233pub const kIOHIDScrollCountIgnoreMomentumScrollsKey: &CStr =
235 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountIgnoreMomentumScrolls\0") };
236pub const kIOHIDScrollCountMouseCanResetKey: &CStr =
238 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMouseCanReset\0") };
239pub const kIOHIDScrollCountMaxKey: &CStr =
241 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountMax\0") };
242pub const kIOHIDScrollCountAccelerationFactorKey: &CStr =
244 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountAccelerationFactor\0") };
245pub const kIOHIDScrollCountZeroKey: &CStr =
247 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountZero\0") };
248pub const kIOHIDScrollCountBootDefaultKey: &CStr =
250 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountBootDefault\0") };
251pub const kIOHIDScrollCountResetKey: &CStr =
253 unsafe { CStr::from_bytes_with_nul_unchecked(b"HIDScrollCountReset\0") };
254pub const kIOHIDActivityUserIdleKey: &CStr =
256 unsafe { CStr::from_bytes_with_nul_unchecked(b"IOHIDActivityUserIdle\0") };
257pub const kIOHIDSystemClass: &CStr =
259 unsafe { CStr::from_bytes_with_nul_unchecked(b"IOHIDSystem\0") };
260pub const kIOHIKeyboardClass: &CStr =
262 unsafe { CStr::from_bytes_with_nul_unchecked(b"IOHIKeyboard\0") };
263pub const kIOHIPointingClass: &CStr =
265 unsafe { CStr::from_bytes_with_nul_unchecked(b"IOHIPointing\0") };
266pub const kIOHIDCurrentShmemVersion: c_uint = 4;
268pub const kIOHIDLastCompatibleShmemVersion: c_uint = 3;
270pub const kIOHIDMessageRelayServiceInterfaceActive: c_uint = iokit_vendor_specific_msg!(2);
272#[repr(C)]
274#[derive(Clone, Copy, Debug, PartialEq)]
275pub struct evsioKeymapping {
276 pub size: c_int,
277 pub mapping: *mut c_char,
278}
279
280#[cfg(feature = "objc2")]
281unsafe impl Encode for evsioKeymapping {
282 const ENCODING: Encoding = Encoding::Struct(
283 "evsioKeymapping",
284 &[<c_int>::ENCODING, <*mut c_char>::ENCODING],
285 );
286}
287
288#[cfg(feature = "objc2")]
289unsafe impl RefEncode for evsioKeymapping {
290 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
291}
292
293pub type NXKeyMapping = evsioKeymapping;
295
296#[repr(C)]
298#[derive(Clone, Copy, Debug, PartialEq)]
299pub struct evsioMouseScaling {
300 pub numScaleLevels: c_int,
301 pub scaleThresholds: [c_short; 20],
302 pub scaleFactors: [c_short; 20],
303}
304
305#[cfg(feature = "objc2")]
306unsafe impl Encode for evsioMouseScaling {
307 const ENCODING: Encoding = Encoding::Struct(
308 "evsioMouseScaling",
309 &[
310 <c_int>::ENCODING,
311 <[c_short; 20]>::ENCODING,
312 <[c_short; 20]>::ENCODING,
313 ],
314 );
315}
316
317#[cfg(feature = "objc2")]
318unsafe impl RefEncode for evsioMouseScaling {
319 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
320}
321
322pub type NXMouseScaling = evsioMouseScaling;
324
325#[repr(transparent)]
327#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
328pub struct NXMouseButton(pub c_uint);
329impl NXMouseButton {
330 #[doc(alias = "NX_OneButton")]
331 pub const OneButton: Self = Self(0);
332 #[doc(alias = "NX_LeftButton")]
333 pub const LeftButton: Self = Self(1);
334 #[doc(alias = "NX_RightButton")]
335 pub const RightButton: Self = Self(2);
336}
337
338#[cfg(feature = "objc2")]
339unsafe impl Encode for NXMouseButton {
340 const ENCODING: Encoding = c_uint::ENCODING;
341}
342
343#[cfg(feature = "objc2")]
344unsafe impl RefEncode for NXMouseButton {
345 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
346}
347
348#[repr(C)]
350#[derive(Clone, Copy, Debug, PartialEq)]
351pub struct IOFixedPoint32 {
352 pub x: i32,
353 pub y: i32,
354}
355
356#[cfg(feature = "objc2")]
357unsafe impl Encode for IOFixedPoint32 {
358 const ENCODING: Encoding =
359 Encoding::Struct("__IOFixedPoint32", &[<i32>::ENCODING, <i32>::ENCODING]);
360}
361
362#[cfg(feature = "objc2")]
363unsafe impl RefEncode for IOFixedPoint32 {
364 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
365}
366
367pub type NXEventSystemInfoType = *mut c_int;
369
370#[repr(C)]
372#[derive(Clone, Copy, Debug, PartialEq)]
373pub struct NXEventSystemDevice {
374 pub interface: c_int,
375 pub interface_addr: c_int,
376 pub dev_type: c_int,
377 pub id: c_int,
378}
379
380#[cfg(feature = "objc2")]
381unsafe impl Encode for NXEventSystemDevice {
382 const ENCODING: Encoding = Encoding::Struct(
383 "?",
384 &[
385 <c_int>::ENCODING,
386 <c_int>::ENCODING,
387 <c_int>::ENCODING,
388 <c_int>::ENCODING,
389 ],
390 );
391}
392
393#[cfg(feature = "objc2")]
394unsafe impl RefEncode for NXEventSystemDevice {
395 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
396}
397
398#[repr(C)]
400#[derive(Clone, Copy, Debug, PartialEq)]
401pub struct NXEventSystemDeviceList {
402 pub dev: [NXEventSystemDevice; 16],
403}
404
405#[cfg(feature = "objc2")]
406unsafe impl Encode for NXEventSystemDeviceList {
407 const ENCODING: Encoding = Encoding::Struct("?", &[<[NXEventSystemDevice; 16]>::ENCODING]);
408}
409
410#[cfg(feature = "objc2")]
411unsafe impl RefEncode for NXEventSystemDeviceList {
412 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
413}
414
415#[repr(transparent)]
417#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
418pub struct EvCmd(pub c_uint);
419impl EvCmd {
420 pub const EVNOP: Self = Self(0);
421 pub const EVHIDE: Self = Self(1);
422 pub const EVSHOW: Self = Self(2);
423 pub const EVMOVE: Self = Self(3);
424 pub const EVLEVEL: Self = Self(4);
425}
426
427#[cfg(feature = "objc2")]
428unsafe impl Encode for EvCmd {
429 const ENCODING: Encoding = c_uint::ENCODING;
430}
431
432#[cfg(feature = "objc2")]
433unsafe impl RefEncode for EvCmd {
434 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
435}
436
437pub type NXCoord = c_float;
439
440#[repr(C)]
442#[derive(Clone, Copy, Debug, PartialEq)]
443pub struct NXPoint {
444 pub x: NXCoord,
445 pub y: NXCoord,
446}
447
448#[cfg(feature = "objc2")]
449unsafe impl Encode for NXPoint {
450 const ENCODING: Encoding =
451 Encoding::Struct("_NXPoint", &[<NXCoord>::ENCODING, <NXCoord>::ENCODING]);
452}
453
454#[cfg(feature = "objc2")]
455unsafe impl RefEncode for NXPoint {
456 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
457}
458
459#[repr(C)]
461#[derive(Clone, Copy, Debug, PartialEq)]
462pub struct NXSize {
463 pub width: NXCoord,
464 pub height: NXCoord,
465}
466
467#[cfg(feature = "objc2")]
468unsafe impl Encode for NXSize {
469 const ENCODING: Encoding =
470 Encoding::Struct("_NXSize", &[<NXCoord>::ENCODING, <NXCoord>::ENCODING]);
471}
472
473#[cfg(feature = "objc2")]
474unsafe impl RefEncode for NXSize {
475 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
476}
477
478#[repr(C)]
480#[derive(Clone, Copy, Debug, PartialEq)]
481pub struct _NXTabletPointData_tilt {
482 pub x: i16,
483 pub y: i16,
484}
485
486#[cfg(feature = "objc2")]
487unsafe impl Encode for _NXTabletPointData_tilt {
488 const ENCODING: Encoding = Encoding::Struct("?", &[<i16>::ENCODING, <i16>::ENCODING]);
489}
490
491#[cfg(feature = "objc2")]
492unsafe impl RefEncode for _NXTabletPointData_tilt {
493 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
494}
495
496#[repr(C)]
498#[derive(Clone, Copy, Debug, PartialEq)]
499pub struct NXTabletPointData {
500 pub x: i32,
501 pub y: i32,
502 pub z: i32,
503 pub buttons: u16,
504 pub pressure: u16,
505 pub tilt: _NXTabletPointData_tilt,
506 pub rotation: u16,
507 pub tangentialPressure: i16,
508 pub deviceID: u16,
509 pub vendor1: i16,
510 pub vendor2: i16,
511 pub vendor3: i16,
512}
513
514#[cfg(feature = "objc2")]
515unsafe impl Encode for NXTabletPointData {
516 const ENCODING: Encoding = Encoding::Struct(
517 "_NXTabletPointData",
518 &[
519 <i32>::ENCODING,
520 <i32>::ENCODING,
521 <i32>::ENCODING,
522 <u16>::ENCODING,
523 <u16>::ENCODING,
524 <_NXTabletPointData_tilt>::ENCODING,
525 <u16>::ENCODING,
526 <i16>::ENCODING,
527 <u16>::ENCODING,
528 <i16>::ENCODING,
529 <i16>::ENCODING,
530 <i16>::ENCODING,
531 ],
532 );
533}
534
535#[cfg(feature = "objc2")]
536unsafe impl RefEncode for NXTabletPointData {
537 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
538}
539
540#[repr(C, packed(4))]
542#[derive(Clone, Copy, Debug, PartialEq)]
543pub struct NXTabletProximityData {
544 pub vendorID: u16,
545 pub tabletID: u16,
546 pub pointerID: u16,
547 pub deviceID: u16,
548 pub systemTabletID: u16,
549 pub vendorPointerType: u16,
550 pub pointerSerialNumber: u32,
551 pub uniqueID: u64,
552 pub capabilityMask: u32,
553 pub pointerType: u8,
554 pub enterProximity: u8,
555 pub reserved1: i16,
556}
557
558#[cfg(feature = "objc2")]
559unsafe impl Encode for NXTabletProximityData {
560 const ENCODING: Encoding = Encoding::Struct(
561 "_NXTabletProximityData",
562 &[
563 <u16>::ENCODING,
564 <u16>::ENCODING,
565 <u16>::ENCODING,
566 <u16>::ENCODING,
567 <u16>::ENCODING,
568 <u16>::ENCODING,
569 <u32>::ENCODING,
570 <u64>::ENCODING,
571 <u32>::ENCODING,
572 <u8>::ENCODING,
573 <u8>::ENCODING,
574 <i16>::ENCODING,
575 ],
576 );
577}
578
579#[cfg(feature = "objc2")]
580unsafe impl RefEncode for NXTabletProximityData {
581 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
582}
583
584#[repr(C)]
586#[derive(Clone, Copy)]
587pub union NXEventData_mouse_tablet {
588 pub point: NXTabletPointData,
589 pub proximity: NXTabletProximityData,
590}
591
592#[cfg(feature = "objc2")]
593unsafe impl Encode for NXEventData_mouse_tablet {
594 const ENCODING: Encoding = Encoding::Union(
595 "?",
596 &[
597 <NXTabletPointData>::ENCODING,
598 <NXTabletProximityData>::ENCODING,
599 ],
600 );
601}
602
603#[cfg(feature = "objc2")]
604unsafe impl RefEncode for NXEventData_mouse_tablet {
605 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
606}
607
608#[repr(C)]
610#[derive(Clone, Copy)]
611pub struct NXEventData_mouse {
612 pub subx: u8,
613 pub suby: u8,
614 pub eventNum: i16,
615 pub click: i32,
616 pub pressure: u8,
617 pub buttonNumber: u8,
618 pub subType: u8,
619 pub reserved2: u8,
620 pub reserved3: i32,
621 pub tablet: NXEventData_mouse_tablet,
622}
623
624#[cfg(feature = "objc2")]
625unsafe impl Encode for NXEventData_mouse {
626 const ENCODING: Encoding = Encoding::Struct(
627 "?",
628 &[
629 <u8>::ENCODING,
630 <u8>::ENCODING,
631 <i16>::ENCODING,
632 <i32>::ENCODING,
633 <u8>::ENCODING,
634 <u8>::ENCODING,
635 <u8>::ENCODING,
636 <u8>::ENCODING,
637 <i32>::ENCODING,
638 <NXEventData_mouse_tablet>::ENCODING,
639 ],
640 );
641}
642
643#[cfg(feature = "objc2")]
644unsafe impl RefEncode for NXEventData_mouse {
645 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
646}
647
648#[repr(C)]
650#[derive(Clone, Copy)]
651pub union NXEventData_mouseMove_tablet {
652 pub point: NXTabletPointData,
653 pub proximity: NXTabletProximityData,
654}
655
656#[cfg(feature = "objc2")]
657unsafe impl Encode for NXEventData_mouseMove_tablet {
658 const ENCODING: Encoding = Encoding::Union(
659 "?",
660 &[
661 <NXTabletPointData>::ENCODING,
662 <NXTabletProximityData>::ENCODING,
663 ],
664 );
665}
666
667#[cfg(feature = "objc2")]
668unsafe impl RefEncode for NXEventData_mouseMove_tablet {
669 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
670}
671
672#[repr(C)]
674#[derive(Clone, Copy)]
675pub struct NXEventData_mouseMove {
676 pub dx: i32,
677 pub dy: i32,
678 pub subx: u8,
679 pub suby: u8,
680 pub subType: u8,
681 pub reserved1: u8,
682 pub reserved2: i32,
683 pub tablet: NXEventData_mouseMove_tablet,
684}
685
686#[cfg(feature = "objc2")]
687unsafe impl Encode for NXEventData_mouseMove {
688 const ENCODING: Encoding = Encoding::Struct(
689 "?",
690 &[
691 <i32>::ENCODING,
692 <i32>::ENCODING,
693 <u8>::ENCODING,
694 <u8>::ENCODING,
695 <u8>::ENCODING,
696 <u8>::ENCODING,
697 <i32>::ENCODING,
698 <NXEventData_mouseMove_tablet>::ENCODING,
699 ],
700 );
701}
702
703#[cfg(feature = "objc2")]
704unsafe impl RefEncode for NXEventData_mouseMove {
705 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
706}
707
708#[repr(C)]
710#[derive(Clone, Copy, Debug, PartialEq)]
711pub struct NXEventData_key {
712 pub origCharSet: u16,
713 pub repeat: i16,
714 pub charSet: u16,
715 pub charCode: u16,
716 pub keyCode: u16,
717 pub origCharCode: u16,
718 pub reserved1: i32,
719 pub keyboardType: u32,
720 pub reserved2: i32,
721 pub reserved3: i32,
722 pub reserved4: i32,
723 pub reserved5: [i32; 4],
724}
725
726#[cfg(feature = "objc2")]
727unsafe impl Encode for NXEventData_key {
728 const ENCODING: Encoding = Encoding::Struct(
729 "?",
730 &[
731 <u16>::ENCODING,
732 <i16>::ENCODING,
733 <u16>::ENCODING,
734 <u16>::ENCODING,
735 <u16>::ENCODING,
736 <u16>::ENCODING,
737 <i32>::ENCODING,
738 <u32>::ENCODING,
739 <i32>::ENCODING,
740 <i32>::ENCODING,
741 <i32>::ENCODING,
742 <[i32; 4]>::ENCODING,
743 ],
744 );
745}
746
747#[cfg(feature = "objc2")]
748unsafe impl RefEncode for NXEventData_key {
749 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
750}
751
752#[repr(C)]
754#[derive(Clone, Copy, Debug, PartialEq)]
755pub struct NXEventData_tracking {
756 pub reserved: i16,
757 pub eventNum: i16,
758 pub trackingNum: i32,
759 pub userData: i32,
760 pub reserved1: i32,
761 pub reserved2: i32,
762 pub reserved3: i32,
763 pub reserved4: i32,
764 pub reserved5: i32,
765 pub reserved6: [i32; 4],
766}
767
768#[cfg(feature = "objc2")]
769unsafe impl Encode for NXEventData_tracking {
770 const ENCODING: Encoding = Encoding::Struct(
771 "?",
772 &[
773 <i16>::ENCODING,
774 <i16>::ENCODING,
775 <i32>::ENCODING,
776 <i32>::ENCODING,
777 <i32>::ENCODING,
778 <i32>::ENCODING,
779 <i32>::ENCODING,
780 <i32>::ENCODING,
781 <i32>::ENCODING,
782 <[i32; 4]>::ENCODING,
783 ],
784 );
785}
786
787#[cfg(feature = "objc2")]
788unsafe impl RefEncode for NXEventData_tracking {
789 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
790}
791
792#[repr(C)]
794#[derive(Clone, Copy, Debug, PartialEq)]
795pub struct NXEventData_scrollWheel {
796 pub deltaAxis1: i16,
797 pub deltaAxis2: i16,
798 pub deltaAxis3: i16,
799 pub reserved1: i16,
800 pub fixedDeltaAxis1: i32,
801 pub fixedDeltaAxis2: i32,
802 pub fixedDeltaAxis3: i32,
803 pub pointDeltaAxis1: i32,
804 pub pointDeltaAxis2: i32,
805 pub pointDeltaAxis3: i32,
806 pub reserved8: [i32; 4],
807}
808
809#[cfg(feature = "objc2")]
810unsafe impl Encode for NXEventData_scrollWheel {
811 const ENCODING: Encoding = Encoding::Struct(
812 "?",
813 &[
814 <i16>::ENCODING,
815 <i16>::ENCODING,
816 <i16>::ENCODING,
817 <i16>::ENCODING,
818 <i32>::ENCODING,
819 <i32>::ENCODING,
820 <i32>::ENCODING,
821 <i32>::ENCODING,
822 <i32>::ENCODING,
823 <i32>::ENCODING,
824 <[i32; 4]>::ENCODING,
825 ],
826 );
827}
828
829#[cfg(feature = "objc2")]
830unsafe impl RefEncode for NXEventData_scrollWheel {
831 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
832}
833
834#[repr(C)]
836#[derive(Clone, Copy)]
837pub union NXEventData_compound_misc {
838 pub F: [c_float; 11],
839 pub L: [i32; 11],
840 pub S: [i16; 22],
841 pub C: [c_char; 44],
842}
843
844#[cfg(feature = "objc2")]
845unsafe impl Encode for NXEventData_compound_misc {
846 const ENCODING: Encoding = Encoding::Union(
847 "?",
848 &[
849 <[c_float; 11]>::ENCODING,
850 <[i32; 11]>::ENCODING,
851 <[i16; 22]>::ENCODING,
852 <[c_char; 44]>::ENCODING,
853 ],
854 );
855}
856
857#[cfg(feature = "objc2")]
858unsafe impl RefEncode for NXEventData_compound_misc {
859 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
860}
861
862#[repr(C)]
864#[derive(Clone, Copy)]
865pub struct NXEventData_compound {
866 pub reserved: i16,
867 pub subType: i16,
868 pub misc: NXEventData_compound_misc,
869}
870
871#[cfg(feature = "objc2")]
872unsafe impl Encode for NXEventData_compound {
873 const ENCODING: Encoding = Encoding::Struct(
874 "?",
875 &[
876 <i16>::ENCODING,
877 <i16>::ENCODING,
878 <NXEventData_compound_misc>::ENCODING,
879 ],
880 );
881}
882
883#[cfg(feature = "objc2")]
884unsafe impl RefEncode for NXEventData_compound {
885 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
886}
887
888#[repr(C)]
890#[derive(Clone, Copy, Debug, PartialEq)]
891pub struct NXEventData_tablet_tilt {
892 pub x: i16,
893 pub y: i16,
894}
895
896#[cfg(feature = "objc2")]
897unsafe impl Encode for NXEventData_tablet_tilt {
898 const ENCODING: Encoding = Encoding::Struct("?", &[<i16>::ENCODING, <i16>::ENCODING]);
899}
900
901#[cfg(feature = "objc2")]
902unsafe impl RefEncode for NXEventData_tablet_tilt {
903 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
904}
905
906#[repr(C)]
908#[derive(Clone, Copy, Debug, PartialEq)]
909pub struct NXEventData_tablet {
910 pub x: i32,
911 pub y: i32,
912 pub z: i32,
913 pub buttons: u16,
914 pub pressure: u16,
915 pub tilt: NXEventData_tablet_tilt,
916 pub rotation: u16,
917 pub tangentialPressure: i16,
918 pub deviceID: u16,
919 pub vendor1: i16,
920 pub vendor2: i16,
921 pub vendor3: i16,
922 pub reserved: [i32; 4],
923}
924
925#[cfg(feature = "objc2")]
926unsafe impl Encode for NXEventData_tablet {
927 const ENCODING: Encoding = Encoding::Struct(
928 "?",
929 &[
930 <i32>::ENCODING,
931 <i32>::ENCODING,
932 <i32>::ENCODING,
933 <u16>::ENCODING,
934 <u16>::ENCODING,
935 <NXEventData_tablet_tilt>::ENCODING,
936 <u16>::ENCODING,
937 <i16>::ENCODING,
938 <u16>::ENCODING,
939 <i16>::ENCODING,
940 <i16>::ENCODING,
941 <i16>::ENCODING,
942 <[i32; 4]>::ENCODING,
943 ],
944 );
945}
946
947#[cfg(feature = "objc2")]
948unsafe impl RefEncode for NXEventData_tablet {
949 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
950}
951
952#[repr(C, packed(4))]
954#[derive(Clone, Copy, Debug, PartialEq)]
955pub struct NXEventData_proximity {
956 pub vendorID: u16,
957 pub tabletID: u16,
958 pub pointerID: u16,
959 pub deviceID: u16,
960 pub systemTabletID: u16,
961 pub vendorPointerType: u16,
962 pub pointerSerialNumber: u32,
963 pub uniqueID: u64,
964 pub capabilityMask: u32,
965 pub pointerType: u8,
966 pub enterProximity: u8,
967 pub reserved1: i16,
968 pub reserved2: [i32; 4],
969}
970
971#[cfg(feature = "objc2")]
972unsafe impl Encode for NXEventData_proximity {
973 const ENCODING: Encoding = Encoding::Struct(
974 "?",
975 &[
976 <u16>::ENCODING,
977 <u16>::ENCODING,
978 <u16>::ENCODING,
979 <u16>::ENCODING,
980 <u16>::ENCODING,
981 <u16>::ENCODING,
982 <u32>::ENCODING,
983 <u64>::ENCODING,
984 <u32>::ENCODING,
985 <u8>::ENCODING,
986 <u8>::ENCODING,
987 <i16>::ENCODING,
988 <[i32; 4]>::ENCODING,
989 ],
990 );
991}
992
993#[cfg(feature = "objc2")]
994unsafe impl RefEncode for NXEventData_proximity {
995 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
996}
997
998#[repr(C)]
1000#[derive(Clone, Copy)]
1001pub union NXEventData {
1002 pub mouse: NXEventData_mouse,
1003 pub mouseMove: NXEventData_mouseMove,
1004 pub key: NXEventData_key,
1005 pub tracking: NXEventData_tracking,
1006 pub scrollWheel: NXEventData_scrollWheel,
1007 pub zoom: NXEventData_scrollWheel,
1008 pub compound: NXEventData_compound,
1009 pub tablet: NXEventData_tablet,
1010 pub proximity: NXEventData_proximity,
1011}
1012
1013#[cfg(feature = "objc2")]
1014unsafe impl Encode for NXEventData {
1015 const ENCODING: Encoding = Encoding::Union(
1016 "?",
1017 &[
1018 <NXEventData_mouse>::ENCODING,
1019 <NXEventData_mouseMove>::ENCODING,
1020 <NXEventData_key>::ENCODING,
1021 <NXEventData_tracking>::ENCODING,
1022 <NXEventData_scrollWheel>::ENCODING,
1023 <NXEventData_scrollWheel>::ENCODING,
1024 <NXEventData_compound>::ENCODING,
1025 <NXEventData_tablet>::ENCODING,
1026 <NXEventData_proximity>::ENCODING,
1027 ],
1028 );
1029}
1030
1031#[cfg(feature = "objc2")]
1032unsafe impl RefEncode for NXEventData {
1033 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1034}
1035
1036#[repr(C)]
1038#[derive(Clone, Copy, Debug, PartialEq)]
1039pub struct _NXEvent_location {
1040 pub x: i32,
1041 pub y: i32,
1042}
1043
1044#[cfg(feature = "objc2")]
1045unsafe impl Encode for _NXEvent_location {
1046 const ENCODING: Encoding = Encoding::Struct("?", &[<i32>::ENCODING, <i32>::ENCODING]);
1047}
1048
1049#[cfg(feature = "objc2")]
1050unsafe impl RefEncode for _NXEvent_location {
1051 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1052}
1053
1054#[repr(C, packed(4))]
1056#[derive(Clone, Copy)]
1057pub struct NXEvent {
1058 pub r#type: i32,
1059 pub location: _NXEvent_location,
1060 pub time: u64,
1061 pub flags: i32,
1062 pub window: u32,
1063 pub service_id: u64,
1064 pub ext_pid: i32,
1065 pub data: NXEventData,
1066}
1067
1068#[cfg(feature = "objc2")]
1069unsafe impl Encode for NXEvent {
1070 const ENCODING: Encoding = Encoding::Struct(
1071 "_NXEvent",
1072 &[
1073 <i32>::ENCODING,
1074 <_NXEvent_location>::ENCODING,
1075 <u64>::ENCODING,
1076 <i32>::ENCODING,
1077 <u32>::ENCODING,
1078 <u64>::ENCODING,
1079 <i32>::ENCODING,
1080 <NXEventData>::ENCODING,
1081 ],
1082 );
1083}
1084
1085#[cfg(feature = "objc2")]
1086unsafe impl RefEncode for NXEvent {
1087 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1088}
1089
1090#[repr(transparent)]
1092#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1093pub struct IOHIDButtonModes(pub c_uint);
1094impl IOHIDButtonModes {
1095 #[doc(alias = "kIOHIDButtonMode_BothLeftClicks")]
1096 pub const BothLeftClicks: Self = Self(0);
1097 #[doc(alias = "kIOHIDButtonMode_ReverseLeftRightClicks")]
1098 pub const ReverseLeftRightClicks: Self = Self(1);
1099 #[doc(alias = "kIOHIDButtonMode_EnableRightClick")]
1100 pub const EnableRightClick: Self = Self(2);
1101}
1102
1103#[cfg(feature = "objc2")]
1104unsafe impl Encode for IOHIDButtonModes {
1105 const ENCODING: Encoding = c_uint::ENCODING;
1106}
1107
1108#[cfg(feature = "objc2")]
1109unsafe impl RefEncode for IOHIDButtonModes {
1110 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1111}
1112
1113#[repr(transparent)]
1115#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1116pub struct evsioEVSIOSCSIndices(pub c_uint);
1117impl evsioEVSIOSCSIndices {
1118 pub const EVSIOSCS_X: Self = Self(0);
1119 pub const EVSIOSCS_Y: Self = Self(1);
1120}
1121
1122#[cfg(feature = "objc2")]
1123unsafe impl Encode for evsioEVSIOSCSIndices {
1124 const ENCODING: Encoding = c_uint::ENCODING;
1125}
1126
1127#[cfg(feature = "objc2")]
1128unsafe impl RefEncode for evsioEVSIOSCSIndices {
1129 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1130}
1131
1132#[repr(transparent)]
1134#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1135pub struct evsioEVSIOCCSIndices(pub c_uint);
1136impl evsioEVSIOCCSIndices {
1137 pub const EVSIOCCS_X: Self = Self(0);
1138 pub const EVSIOCCS_Y: Self = Self(1);
1139}
1140
1141#[cfg(feature = "objc2")]
1142unsafe impl Encode for evsioEVSIOCCSIndices {
1143 const ENCODING: Encoding = c_uint::ENCODING;
1144}
1145
1146#[cfg(feature = "objc2")]
1147unsafe impl RefEncode for evsioEVSIOCCSIndices {
1148 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1149}
1150
1151pub const kIOHIDCapsLockState: c_uint = 0x00000001;
1153pub const kIOHIDNumLockState: c_uint = 0x00000002;
1155pub const kIOHIDActivityUserIdle: c_uint = 0x00000003;
1157pub const kIOHIDActivityDisplayOn: c_uint = 0x00000004;
1159
1160#[repr(C)]
1205#[derive(Clone, Copy, Debug, PartialEq)]
1206pub struct _evOffsets {
1207 pub evGlobalsOffset: c_int,
1208 pub evShmemOffset: c_int,
1209}
1210
1211#[cfg(feature = "objc2")]
1212unsafe impl Encode for _evOffsets {
1213 const ENCODING: Encoding =
1214 Encoding::Struct("_evOffsets", &[<c_int>::ENCODING, <c_int>::ENCODING]);
1215}
1216
1217#[cfg(feature = "objc2")]
1218unsafe impl RefEncode for _evOffsets {
1219 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1220}
1221
1222pub type EvOffsets = _evOffsets;
1267
1268#[cfg(feature = "graphics")]
1270#[repr(C)]
1271#[derive(Clone, Copy)]
1272pub struct evioLLEvent {
1273 pub setCursor: c_int,
1274 pub r#type: c_int,
1275 pub location: IOGPoint,
1276 pub data: NXEventData,
1277 pub setFlags: c_int,
1278 pub flags: c_int,
1279}
1280
1281#[cfg(all(feature = "graphics", feature = "objc2"))]
1282unsafe impl Encode for evioLLEvent {
1283 const ENCODING: Encoding = Encoding::Struct(
1284 "evioLLEvent",
1285 &[
1286 <c_int>::ENCODING,
1287 <c_int>::ENCODING,
1288 <IOGPoint>::ENCODING,
1289 <NXEventData>::ENCODING,
1290 <c_int>::ENCODING,
1291 <c_int>::ENCODING,
1292 ],
1293 );
1294}
1295
1296#[cfg(all(feature = "graphics", feature = "objc2"))]
1297unsafe impl RefEncode for evioLLEvent {
1298 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1299}
1300
1301pub const kIOHIDEventNotification: c_uint = 0;
1303
1304pub const kIOHIDServerConnectType: c_uint = 0;
1306pub const kIOHIDParamConnectType: c_uint = 1;
1308pub const kIOHIDEventSystemConnectType: c_uint = 3;
1310
1311pub const kIOHIDGlobalMemory: c_uint = 0;
1313
1314pub const kIOHIDEventQueueTypeKernel: c_uint = 0;
1316pub const kIOHIDEventQueueTypeUser: c_uint = 1;
1318
1319pub const kIOHIDOpenedByEventSystem: c_uint = 0x10000;
1325pub const kIOHIDOpenedByFastPathClient: c_uint = 0x20000;
1331
1332#[cfg(feature = "libc")]
1333#[inline]
1334pub extern "C-unwind" fn IOHIDCreateSharedMemory(
1335 connect: io_connect_t,
1336 version: c_uint,
1337) -> libc::kern_return_t {
1338 extern "C-unwind" {
1339 fn IOHIDCreateSharedMemory(connect: io_connect_t, version: c_uint) -> libc::kern_return_t;
1340 }
1341 unsafe { IOHIDCreateSharedMemory(connect, version) }
1342}
1343
1344#[cfg(feature = "libc")]
1345#[inline]
1346pub extern "C-unwind" fn IOHIDSetEventsEnable(
1347 connect: io_connect_t,
1348 enable: bool,
1349) -> libc::kern_return_t {
1350 extern "C-unwind" {
1351 fn IOHIDSetEventsEnable(
1352 connect: io_connect_t,
1353 enable: libc::boolean_t,
1354 ) -> libc::kern_return_t;
1355 }
1356 unsafe { IOHIDSetEventsEnable(connect, enable as _) }
1357}
1358
1359#[cfg(feature = "libc")]
1360#[deprecated]
1361#[inline]
1362pub extern "C-unwind" fn IOHIDSetCursorEnable(
1363 connect: io_connect_t,
1364 enable: bool,
1365) -> libc::kern_return_t {
1366 extern "C-unwind" {
1367 fn IOHIDSetCursorEnable(
1368 connect: io_connect_t,
1369 enable: libc::boolean_t,
1370 ) -> libc::kern_return_t;
1371 }
1372 unsafe { IOHIDSetCursorEnable(connect, enable as _) }
1373}
1374
1375pub const kIOHIDSetGlobalEventFlags: c_uint = 0x00000001;
1377pub const kIOHIDSetCursorPosition: c_uint = 0x00000002;
1379pub const kIOHIDSetRelativeCursorPosition: c_uint = 0x00000004;
1381pub const kIOHIDPostHIDManagerEvent: c_uint = 0x00000008;
1383
1384extern "C-unwind" {
1385 #[cfg(all(feature = "graphics", feature = "libc"))]
1389 #[deprecated = "Use CGSEventTap for posting HID events, IOHIDUserDevice for simulating HID device, IOPMAssertionDeclareUserActivity for reporting user activity"]
1390 pub fn IOHIDPostEvent(
1391 connect: io_connect_t,
1392 event_type: u32,
1393 location: IOGPoint,
1394 event_data: *const NXEventData,
1395 event_data_version: u32,
1396 event_flags: IOOptionBits,
1397 options: IOOptionBits,
1398 ) -> libc::kern_return_t;
1399}
1400
1401#[cfg(feature = "libc")]
1402#[deprecated]
1403#[inline]
1404pub extern "C-unwind" fn IOHIDSetMouseLocation(
1405 connect: io_connect_t,
1406 x: c_int,
1407 y: c_int,
1408) -> libc::kern_return_t {
1409 extern "C-unwind" {
1410 fn IOHIDSetMouseLocation(connect: io_connect_t, x: c_int, y: c_int) -> libc::kern_return_t;
1411 }
1412 unsafe { IOHIDSetMouseLocation(connect, x, y) }
1413}
1414
1415extern "C-unwind" {
1416 #[cfg(feature = "libc")]
1420 #[deprecated]
1421 pub fn IOHIDGetButtonEventNum(
1422 connect: io_connect_t,
1423 button: NXMouseButton,
1424 event_num: *mut c_int,
1425 ) -> libc::kern_return_t;
1426}
1427
1428extern "C-unwind" {
1429 #[cfg(feature = "libc")]
1433 #[deprecated]
1434 pub fn IOHIDGetScrollAcceleration(
1435 handle: io_connect_t,
1436 acceleration: *mut c_double,
1437 ) -> libc::kern_return_t;
1438}
1439
1440#[cfg(feature = "libc")]
1441#[deprecated]
1442#[inline]
1443pub extern "C-unwind" fn IOHIDSetScrollAcceleration(
1444 handle: io_connect_t,
1445 acceleration: c_double,
1446) -> libc::kern_return_t {
1447 extern "C-unwind" {
1448 fn IOHIDSetScrollAcceleration(
1449 handle: io_connect_t,
1450 acceleration: c_double,
1451 ) -> libc::kern_return_t;
1452 }
1453 unsafe { IOHIDSetScrollAcceleration(handle, acceleration) }
1454}
1455
1456extern "C-unwind" {
1457 #[cfg(feature = "libc")]
1461 #[deprecated]
1462 pub fn IOHIDGetMouseAcceleration(
1463 handle: io_connect_t,
1464 acceleration: *mut c_double,
1465 ) -> libc::kern_return_t;
1466}
1467
1468#[cfg(feature = "libc")]
1469#[deprecated]
1470#[inline]
1471pub extern "C-unwind" fn IOHIDSetMouseAcceleration(
1472 handle: io_connect_t,
1473 acceleration: c_double,
1474) -> libc::kern_return_t {
1475 extern "C-unwind" {
1476 fn IOHIDSetMouseAcceleration(
1477 handle: io_connect_t,
1478 acceleration: c_double,
1479 ) -> libc::kern_return_t;
1480 }
1481 unsafe { IOHIDSetMouseAcceleration(handle, acceleration) }
1482}
1483
1484extern "C-unwind" {
1485 #[cfg(feature = "libc")]
1489 #[deprecated]
1490 pub fn IOHIDGetMouseButtonMode(handle: io_connect_t, mode: *mut c_int) -> libc::kern_return_t;
1491}
1492
1493#[cfg(feature = "libc")]
1494#[deprecated]
1495#[inline]
1496pub extern "C-unwind" fn IOHIDSetMouseButtonMode(
1497 handle: io_connect_t,
1498 mode: c_int,
1499) -> libc::kern_return_t {
1500 extern "C-unwind" {
1501 fn IOHIDSetMouseButtonMode(handle: io_connect_t, mode: c_int) -> libc::kern_return_t;
1502 }
1503 unsafe { IOHIDSetMouseButtonMode(handle, mode) }
1504}
1505
1506extern "C-unwind" {
1507 #[cfg(feature = "libc")]
1512 #[deprecated]
1513 pub fn IOHIDGetAccelerationWithKey(
1514 handle: io_connect_t,
1515 key: Option<&CFString>,
1516 acceleration: *mut c_double,
1517 ) -> libc::kern_return_t;
1518}
1519
1520extern "C-unwind" {
1521 #[cfg(feature = "libc")]
1525 #[deprecated]
1526 pub fn IOHIDSetAccelerationWithKey(
1527 handle: io_connect_t,
1528 key: Option<&CFString>,
1529 acceleration: c_double,
1530 ) -> libc::kern_return_t;
1531}
1532
1533extern "C-unwind" {
1534 #[cfg(feature = "libc")]
1540 #[deprecated]
1541 pub fn IOHIDGetParameter(
1542 handle: io_connect_t,
1543 key: Option<&CFString>,
1544 max_size: IOByteCount,
1545 bytes: *mut c_void,
1546 actual_size: *mut IOByteCount,
1547 ) -> libc::kern_return_t;
1548}
1549
1550extern "C-unwind" {
1551 #[cfg(feature = "libc")]
1556 #[deprecated]
1557 pub fn IOHIDSetParameter(
1558 handle: io_connect_t,
1559 key: Option<&CFString>,
1560 bytes: *const c_void,
1561 size: IOByteCount,
1562 ) -> libc::kern_return_t;
1563}
1564
1565extern "C-unwind" {
1566 #[cfg(feature = "libc")]
1571 pub fn IOHIDCopyCFTypeParameter(
1572 handle: io_connect_t,
1573 key: Option<&CFString>,
1574 parameter: *mut *const CFType,
1575 ) -> libc::kern_return_t;
1576}
1577
1578extern "C-unwind" {
1579 #[cfg(feature = "libc")]
1585 pub fn IOHIDSetCFTypeParameter(
1586 handle: io_connect_t,
1587 key: Option<&CFString>,
1588 parameter: Option<&CFType>,
1589 ) -> libc::kern_return_t;
1590}
1591
1592extern "C-unwind" {
1593 #[cfg(feature = "libc")]
1597 pub fn IOHIDGetStateForSelector(
1598 handle: io_connect_t,
1599 selector: c_int,
1600 state: *mut u32,
1601 ) -> libc::kern_return_t;
1602}
1603
1604#[cfg(feature = "libc")]
1605#[inline]
1606pub extern "C-unwind" fn IOHIDSetStateForSelector(
1607 handle: io_connect_t,
1608 selector: c_int,
1609 state: u32,
1610) -> libc::kern_return_t {
1611 extern "C-unwind" {
1612 fn IOHIDSetStateForSelector(
1613 handle: io_connect_t,
1614 selector: c_int,
1615 state: u32,
1616 ) -> libc::kern_return_t;
1617 }
1618 unsafe { IOHIDSetStateForSelector(handle, selector, state) }
1619}
1620
1621extern "C-unwind" {
1622 #[cfg(feature = "libc")]
1626 pub fn IOHIDGetModifierLockState(
1627 handle: io_connect_t,
1628 selector: c_int,
1629 state: *mut bool,
1630 ) -> libc::kern_return_t;
1631}
1632
1633#[cfg(feature = "libc")]
1634#[inline]
1635pub extern "C-unwind" fn IOHIDSetModifierLockState(
1636 handle: io_connect_t,
1637 selector: c_int,
1638 state: bool,
1639) -> libc::kern_return_t {
1640 extern "C-unwind" {
1641 fn IOHIDSetModifierLockState(
1642 handle: io_connect_t,
1643 selector: c_int,
1644 state: bool,
1645 ) -> libc::kern_return_t;
1646 }
1647 unsafe { IOHIDSetModifierLockState(handle, selector, state) }
1648}
1649
1650extern "C-unwind" {
1651 #[cfg(feature = "libc")]
1655 #[deprecated]
1656 pub fn IOHIDRegisterVirtualDisplay(
1657 handle: io_connect_t,
1658 display_token: *mut u32,
1659 ) -> libc::kern_return_t;
1660}
1661
1662#[cfg(feature = "libc")]
1663#[deprecated]
1664#[inline]
1665pub extern "C-unwind" fn IOHIDUnregisterVirtualDisplay(
1666 handle: io_connect_t,
1667 display_token: u32,
1668) -> libc::kern_return_t {
1669 extern "C-unwind" {
1670 fn IOHIDUnregisterVirtualDisplay(
1671 handle: io_connect_t,
1672 display_token: u32,
1673 ) -> libc::kern_return_t;
1674 }
1675 unsafe { IOHIDUnregisterVirtualDisplay(handle, display_token) }
1676}
1677
1678extern "C-unwind" {
1679 #[cfg(all(feature = "graphics", feature = "libc"))]
1683 #[deprecated]
1684 pub fn IOHIDSetVirtualDisplayBounds(
1685 handle: io_connect_t,
1686 display_token: u32,
1687 bounds: *const IOGBounds,
1688 ) -> libc::kern_return_t;
1689}
1690
1691extern "C-unwind" {
1692 #[cfg(feature = "libc")]
1696 #[deprecated]
1697 pub fn IOHIDGetActivityState(
1698 handle: io_connect_t,
1699 hid_activity_idle: *mut bool,
1700 ) -> libc::kern_return_t;
1701}
1702
1703#[repr(transparent)]
1705#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1706pub struct IOHIDRequestType(pub c_uint);
1707impl IOHIDRequestType {
1708 #[doc(alias = "kIOHIDRequestTypePostEvent")]
1709 pub const PostEvent: Self = Self(0);
1710 #[doc(alias = "kIOHIDRequestTypeListenEvent")]
1711 pub const ListenEvent: Self = Self(1);
1712}
1713
1714#[cfg(feature = "objc2")]
1715unsafe impl Encode for IOHIDRequestType {
1716 const ENCODING: Encoding = c_uint::ENCODING;
1717}
1718
1719#[cfg(feature = "objc2")]
1720unsafe impl RefEncode for IOHIDRequestType {
1721 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1722}
1723
1724#[repr(transparent)]
1726#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1727pub struct IOHIDAccessType(pub c_uint);
1728impl IOHIDAccessType {
1729 #[doc(alias = "kIOHIDAccessTypeGranted")]
1730 pub const Granted: Self = Self(0);
1731 #[doc(alias = "kIOHIDAccessTypeDenied")]
1732 pub const Denied: Self = Self(1);
1733 #[doc(alias = "kIOHIDAccessTypeUnknown")]
1734 pub const Unknown: Self = Self(2);
1735}
1736
1737#[cfg(feature = "objc2")]
1738unsafe impl Encode for IOHIDAccessType {
1739 const ENCODING: Encoding = c_uint::ENCODING;
1740}
1741
1742#[cfg(feature = "objc2")]
1743unsafe impl RefEncode for IOHIDAccessType {
1744 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1745}
1746
1747#[inline]
1756pub extern "C-unwind" fn IOHIDCheckAccess(request_type: IOHIDRequestType) -> IOHIDAccessType {
1757 extern "C-unwind" {
1758 fn IOHIDCheckAccess(request_type: IOHIDRequestType) -> IOHIDAccessType;
1759 }
1760 unsafe { IOHIDCheckAccess(request_type) }
1761}
1762
1763#[inline]
1777pub extern "C-unwind" fn IOHIDRequestAccess(request_type: IOHIDRequestType) -> bool {
1778 extern "C-unwind" {
1779 fn IOHIDRequestAccess(request_type: IOHIDRequestType) -> bool;
1780 }
1781 unsafe { IOHIDRequestAccess(request_type) }
1782}
1783
1784#[cfg(feature = "libc")]
1786pub type NXEventHandle = libc::mach_port_t;
1787
1788#[cfg(feature = "libc")]
1789#[deprecated]
1790#[inline]
1791pub extern "C-unwind" fn NXOpenEventStatus() -> NXEventHandle {
1792 extern "C-unwind" {
1793 fn NXOpenEventStatus() -> NXEventHandle;
1794 }
1795 unsafe { NXOpenEventStatus() }
1796}
1797
1798#[cfg(feature = "libc")]
1799#[deprecated]
1800#[inline]
1801pub extern "C-unwind" fn NXCloseEventStatus(handle: NXEventHandle) {
1802 extern "C-unwind" {
1803 fn NXCloseEventStatus(handle: NXEventHandle);
1804 }
1805 unsafe { NXCloseEventStatus(handle) }
1806}
1807
1808extern "C-unwind" {
1809 #[cfg(feature = "libc")]
1815 #[deprecated]
1816 pub fn NXEventSystemInfo(
1817 handle: NXEventHandle,
1818 flavor: *mut c_char,
1819 evs_info: *mut c_int,
1820 evs_info_cnt: *mut c_uint,
1821 ) -> NXEventSystemInfoType;
1822}
1823
1824#[cfg(feature = "libc")]
1825#[deprecated]
1826#[inline]
1827pub extern "C-unwind" fn NXSetKeyRepeatInterval(handle: NXEventHandle, seconds: c_double) {
1828 extern "C-unwind" {
1829 fn NXSetKeyRepeatInterval(handle: NXEventHandle, seconds: c_double);
1830 }
1831 unsafe { NXSetKeyRepeatInterval(handle, seconds) }
1832}
1833
1834#[cfg(feature = "libc")]
1835#[deprecated]
1836#[inline]
1837pub extern "C-unwind" fn NXKeyRepeatInterval(handle: NXEventHandle) -> c_double {
1838 extern "C-unwind" {
1839 fn NXKeyRepeatInterval(handle: NXEventHandle) -> c_double;
1840 }
1841 unsafe { NXKeyRepeatInterval(handle) }
1842}
1843
1844#[cfg(feature = "libc")]
1845#[deprecated]
1846#[inline]
1847pub extern "C-unwind" fn NXSetKeyRepeatThreshold(handle: NXEventHandle, threshold: c_double) {
1848 extern "C-unwind" {
1849 fn NXSetKeyRepeatThreshold(handle: NXEventHandle, threshold: c_double);
1850 }
1851 unsafe { NXSetKeyRepeatThreshold(handle, threshold) }
1852}
1853
1854#[cfg(feature = "libc")]
1855#[deprecated]
1856#[inline]
1857pub extern "C-unwind" fn NXKeyRepeatThreshold(handle: NXEventHandle) -> c_double {
1858 extern "C-unwind" {
1859 fn NXKeyRepeatThreshold(handle: NXEventHandle) -> c_double;
1860 }
1861 unsafe { NXKeyRepeatThreshold(handle) }
1862}
1863
1864#[cfg(feature = "libc")]
1865#[deprecated]
1866#[inline]
1867pub extern "C-unwind" fn NXResetKeyboard(handle: NXEventHandle) {
1868 extern "C-unwind" {
1869 fn NXResetKeyboard(handle: NXEventHandle);
1870 }
1871 unsafe { NXResetKeyboard(handle) }
1872}
1873
1874#[cfg(feature = "libc")]
1875#[deprecated]
1876#[inline]
1877pub extern "C-unwind" fn NXSetClickTime(handle: NXEventHandle, seconds: c_double) {
1878 extern "C-unwind" {
1879 fn NXSetClickTime(handle: NXEventHandle, seconds: c_double);
1880 }
1881 unsafe { NXSetClickTime(handle, seconds) }
1882}
1883
1884#[cfg(feature = "libc")]
1885#[deprecated]
1886#[inline]
1887pub extern "C-unwind" fn NXClickTime(handle: NXEventHandle) -> c_double {
1888 extern "C-unwind" {
1889 fn NXClickTime(handle: NXEventHandle) -> c_double;
1890 }
1891 unsafe { NXClickTime(handle) }
1892}
1893
1894extern "C-unwind" {
1895 #[cfg(feature = "libc")]
1899 #[deprecated]
1900 pub fn NXSetClickSpace(handle: NXEventHandle, area: *mut NXSize);
1901}
1902
1903extern "C-unwind" {
1904 #[cfg(feature = "libc")]
1908 #[deprecated]
1909 pub fn NXGetClickSpace(handle: NXEventHandle, area: *mut NXSize);
1910}
1911
1912#[cfg(feature = "libc")]
1913#[deprecated]
1914#[inline]
1915pub extern "C-unwind" fn NXResetMouse(handle: NXEventHandle) {
1916 extern "C-unwind" {
1917 fn NXResetMouse(handle: NXEventHandle);
1918 }
1919 unsafe { NXResetMouse(handle) }
1920}
1921
1922#[repr(C)]
1924#[derive(Clone, Copy, Debug, PartialEq)]
1925pub struct _NXParsedKeyMapping_ {
1926 pub shorts: c_short,
1927 pub keyBits: [c_char; 256],
1928 pub maxMod: c_int,
1929 pub modDefs: [*mut c_uchar; 16],
1930 pub numDefs: c_int,
1931 pub keyDefs: [*mut c_uchar; 256],
1932 pub numSeqs: c_int,
1933 pub seqDefs: [*mut c_uchar; 128],
1934 pub numSpecialKeys: c_int,
1935 pub specialKeys: [c_ushort; 24],
1936 pub mapping: *const c_uchar,
1937 pub mappingLen: c_int,
1938}
1939
1940#[cfg(feature = "objc2")]
1941unsafe impl Encode for _NXParsedKeyMapping_ {
1942 const ENCODING: Encoding = Encoding::Struct(
1943 "_NXParsedKeyMapping_",
1944 &[
1945 <c_short>::ENCODING,
1946 <[c_char; 256]>::ENCODING,
1947 <c_int>::ENCODING,
1948 <[*mut c_uchar; 16]>::ENCODING,
1949 <c_int>::ENCODING,
1950 <[*mut c_uchar; 256]>::ENCODING,
1951 <c_int>::ENCODING,
1952 <[*mut c_uchar; 128]>::ENCODING,
1953 <c_int>::ENCODING,
1954 <[c_ushort; 24]>::ENCODING,
1955 <*const c_uchar>::ENCODING,
1956 <c_int>::ENCODING,
1957 ],
1958 );
1959}
1960
1961#[cfg(feature = "objc2")]
1962unsafe impl RefEncode for _NXParsedKeyMapping_ {
1963 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1964}
1965
1966pub type NXParsedKeyMapping = _NXParsedKeyMapping_;
1968
1969#[doc(alias = "IOHIDEventSystemClientRef")]
1985#[repr(C)]
1986pub struct IOHIDEventSystemClient {
1987 inner: [u8; 0],
1988 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
1989}
1990
1991cf_type!(
1992 unsafe impl IOHIDEventSystemClient {}
1993);
1994#[cfg(feature = "objc2")]
1995cf_objc2_type!(
1996 unsafe impl RefEncode<"__IOHIDEventSystemClient"> for IOHIDEventSystemClient {}
1997);
1998
1999impl IOHIDEventSystemClient {
2000 #[doc(alias = "IOHIDEventSystemClientCreateSimpleClient")]
2022 #[inline]
2023 pub fn new_simple_client(
2024 allocator: Option<&CFAllocator>,
2025 ) -> CFRetained<IOHIDEventSystemClient> {
2026 extern "C-unwind" {
2027 fn IOHIDEventSystemClientCreateSimpleClient(
2028 allocator: Option<&CFAllocator>,
2029 ) -> Option<NonNull<IOHIDEventSystemClient>>;
2030 }
2031 let ret = unsafe { IOHIDEventSystemClientCreateSimpleClient(allocator) };
2032 let ret =
2033 ret.expect("function was marked as returning non-null, but actually returned NULL");
2034 unsafe { CFRetained::from_raw(ret) }
2035 }
2036
2037 #[doc(alias = "IOHIDEventSystemClientSetProperty")]
2063 #[inline]
2064 pub unsafe fn set_property(&self, key: &CFString, property: &CFType) -> bool {
2065 extern "C-unwind" {
2066 fn IOHIDEventSystemClientSetProperty(
2067 client: &IOHIDEventSystemClient,
2068 key: &CFString,
2069 property: &CFType,
2070 ) -> Boolean;
2071 }
2072 let ret = unsafe { IOHIDEventSystemClientSetProperty(self, key, property) };
2073 ret != 0
2074 }
2075
2076 #[doc(alias = "IOHIDEventSystemClientCopyProperty")]
2096 #[inline]
2097 pub fn property(&self, key: &CFString) -> Option<CFRetained<CFType>> {
2098 extern "C-unwind" {
2099 fn IOHIDEventSystemClientCopyProperty(
2100 client: &IOHIDEventSystemClient,
2101 key: &CFString,
2102 ) -> Option<NonNull<CFType>>;
2103 }
2104 let ret = unsafe { IOHIDEventSystemClientCopyProperty(self, key) };
2105 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2106 }
2107}
2108
2109unsafe impl ConcreteType for IOHIDEventSystemClient {
2110 #[doc(alias = "IOHIDEventSystemClientGetTypeID")]
2116 #[inline]
2117 fn type_id() -> CFTypeID {
2118 extern "C-unwind" {
2119 fn IOHIDEventSystemClientGetTypeID() -> CFTypeID;
2120 }
2121 unsafe { IOHIDEventSystemClientGetTypeID() }
2122 }
2123}
2124
2125impl IOHIDEventSystemClient {
2126 #[doc(alias = "IOHIDEventSystemClientCopyServices")]
2151 #[inline]
2152 pub fn services(&self) -> Option<CFRetained<CFArray>> {
2153 extern "C-unwind" {
2154 fn IOHIDEventSystemClientCopyServices(
2155 client: &IOHIDEventSystemClient,
2156 ) -> Option<NonNull<CFArray>>;
2157 }
2158 let ret = unsafe { IOHIDEventSystemClientCopyServices(self) };
2159 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2160 }
2161}
2162
2163#[doc(alias = "IOHIDServiceClientRef")]
2175#[repr(C)]
2176pub struct IOHIDServiceClient {
2177 inner: [u8; 0],
2178 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
2179}
2180
2181cf_type!(
2182 unsafe impl IOHIDServiceClient {}
2183);
2184#[cfg(feature = "objc2")]
2185cf_objc2_type!(
2186 unsafe impl RefEncode<"__IOHIDServiceClient"> for IOHIDServiceClient {}
2187);
2188
2189impl IOHIDServiceClient {
2190 #[doc(alias = "IOHIDServiceClientSetProperty")]
2212 #[inline]
2213 pub unsafe fn set_property(&self, key: &CFString, property: &CFType) -> bool {
2214 extern "C-unwind" {
2215 fn IOHIDServiceClientSetProperty(
2216 service: &IOHIDServiceClient,
2217 key: &CFString,
2218 property: &CFType,
2219 ) -> Boolean;
2220 }
2221 let ret = unsafe { IOHIDServiceClientSetProperty(self, key, property) };
2222 ret != 0
2223 }
2224
2225 #[doc(alias = "IOHIDServiceClientCopyProperty")]
2241 #[inline]
2242 pub fn property(&self, key: &CFString) -> Option<CFRetained<CFType>> {
2243 extern "C-unwind" {
2244 fn IOHIDServiceClientCopyProperty(
2245 service: &IOHIDServiceClient,
2246 key: &CFString,
2247 ) -> Option<NonNull<CFType>>;
2248 }
2249 let ret = unsafe { IOHIDServiceClientCopyProperty(self, key) };
2250 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2251 }
2252}
2253
2254unsafe impl ConcreteType for IOHIDServiceClient {
2255 #[doc(alias = "IOHIDServiceClientGetTypeID")]
2261 #[inline]
2262 fn type_id() -> CFTypeID {
2263 extern "C-unwind" {
2264 fn IOHIDServiceClientGetTypeID() -> CFTypeID;
2265 }
2266 unsafe { IOHIDServiceClientGetTypeID() }
2267 }
2268}
2269
2270impl IOHIDServiceClient {
2271 #[doc(alias = "IOHIDServiceClientGetRegistryID")]
2276 #[inline]
2277 pub fn registry_id(&self) -> CFRetained<CFType> {
2278 extern "C-unwind" {
2279 fn IOHIDServiceClientGetRegistryID(
2280 service: &IOHIDServiceClient,
2281 ) -> Option<NonNull<CFType>>;
2282 }
2283 let ret = unsafe { IOHIDServiceClientGetRegistryID(self) };
2284 let ret =
2285 ret.expect("function was marked as returning non-null, but actually returned NULL");
2286 unsafe { CFRetained::retain(ret) }
2287 }
2288
2289 #[doc(alias = "IOHIDServiceClientConformsTo")]
2308 #[cfg(feature = "libc")]
2309 #[inline]
2310 pub fn conforms_to(&self, usage_page: u32, usage: u32) -> bool {
2311 extern "C-unwind" {
2312 fn IOHIDServiceClientConformsTo(
2313 service: &IOHIDServiceClient,
2314 usage_page: u32,
2315 usage: u32,
2316 ) -> libc::boolean_t;
2317 }
2318 let ret = unsafe { IOHIDServiceClientConformsTo(self, usage_page, usage) };
2319 ret != 0
2320 }
2321}
2322
2323#[doc(alias = "IOHIDUserDeviceRef")]
2325#[repr(C)]
2326pub struct IOHIDUserDevice {
2327 inner: [u8; 0],
2328 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
2329}
2330
2331cf_type!(
2332 unsafe impl IOHIDUserDevice {}
2333);
2334#[cfg(feature = "objc2")]
2335cf_objc2_type!(
2336 unsafe impl RefEncode<"__IOHIDUserDevice"> for IOHIDUserDevice {}
2337);
2338
2339#[cfg(all(feature = "block2", feature = "hid"))]
2355pub type IOHIDUserDeviceSetReportBlock =
2356 *mut block2::DynBlock<dyn Fn(IOHIDReportType, u32, NonNull<u8>, CFIndex) -> IOReturn>;
2357
2358#[cfg(all(feature = "block2", feature = "hid"))]
2376pub type IOHIDUserDeviceGetReportBlock =
2377 *mut block2::DynBlock<dyn Fn(IOHIDReportType, u32, NonNull<u8>, NonNull<CFIndex>) -> IOReturn>;
2378
2379#[repr(transparent)]
2390#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2391pub struct IOHIDUserDeviceOptions(pub IOOptionBits);
2392impl IOHIDUserDeviceOptions {
2393 #[doc(alias = "IOHIDUserDeviceOptionsCreateOnActivate")]
2394 pub const CreateOnActivate: Self = Self(1 << 0);
2395}
2396
2397#[cfg(feature = "objc2")]
2398unsafe impl Encode for IOHIDUserDeviceOptions {
2399 const ENCODING: Encoding = IOOptionBits::ENCODING;
2400}
2401
2402#[cfg(feature = "objc2")]
2403unsafe impl RefEncode for IOHIDUserDeviceOptions {
2404 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2405}
2406
2407unsafe impl ConcreteType for IOHIDUserDevice {
2408 #[doc(alias = "IOHIDUserDeviceGetTypeID")]
2410 #[inline]
2411 fn type_id() -> CFTypeID {
2412 extern "C-unwind" {
2413 fn IOHIDUserDeviceGetTypeID() -> CFTypeID;
2414 }
2415 unsafe { IOHIDUserDeviceGetTypeID() }
2416 }
2417}
2418
2419impl IOHIDUserDevice {
2420 #[doc(alias = "IOHIDUserDeviceCreateWithProperties")]
2446 #[inline]
2447 pub unsafe fn with_properties(
2448 allocator: Option<&CFAllocator>,
2449 properties: &CFDictionary,
2450 options: IOOptionBits,
2451 ) -> Option<CFRetained<IOHIDUserDevice>> {
2452 extern "C-unwind" {
2453 fn IOHIDUserDeviceCreateWithProperties(
2454 allocator: Option<&CFAllocator>,
2455 properties: &CFDictionary,
2456 options: IOOptionBits,
2457 ) -> Option<NonNull<IOHIDUserDevice>>;
2458 }
2459 let ret = unsafe { IOHIDUserDeviceCreateWithProperties(allocator, properties, options) };
2460 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2461 }
2462
2463 #[doc(alias = "IOHIDUserDeviceRegisterGetReportBlock")]
2480 #[cfg(all(feature = "block2", feature = "hid"))]
2481 #[inline]
2482 pub unsafe fn register_get_report_block(&self, block: IOHIDUserDeviceGetReportBlock) {
2483 extern "C-unwind" {
2484 fn IOHIDUserDeviceRegisterGetReportBlock(
2485 device: &IOHIDUserDevice,
2486 block: IOHIDUserDeviceGetReportBlock,
2487 );
2488 }
2489 unsafe { IOHIDUserDeviceRegisterGetReportBlock(self, block) }
2490 }
2491
2492 #[doc(alias = "IOHIDUserDeviceRegisterSetReportBlock")]
2509 #[cfg(all(feature = "block2", feature = "hid"))]
2510 #[inline]
2511 pub unsafe fn register_set_report_block(&self, block: IOHIDUserDeviceSetReportBlock) {
2512 extern "C-unwind" {
2513 fn IOHIDUserDeviceRegisterSetReportBlock(
2514 device: &IOHIDUserDevice,
2515 block: IOHIDUserDeviceSetReportBlock,
2516 );
2517 }
2518 unsafe { IOHIDUserDeviceRegisterSetReportBlock(self, block) }
2519 }
2520
2521 #[doc(alias = "IOHIDUserDeviceSetDispatchQueue")]
2542 #[cfg(feature = "dispatch2")]
2543 #[inline]
2544 pub unsafe fn set_dispatch_queue(&self, queue: &DispatchQueue) {
2545 extern "C-unwind" {
2546 fn IOHIDUserDeviceSetDispatchQueue(device: &IOHIDUserDevice, queue: &DispatchQueue);
2547 }
2548 unsafe { IOHIDUserDeviceSetDispatchQueue(self, queue) }
2549 }
2550
2551 #[doc(alias = "IOHIDUserDeviceSetCancelHandler")]
2580 #[cfg(feature = "dispatch2")]
2581 #[inline]
2582 pub unsafe fn set_cancel_handler(&self, handler: dispatch_block_t) {
2583 extern "C-unwind" {
2584 fn IOHIDUserDeviceSetCancelHandler(device: &IOHIDUserDevice, handler: dispatch_block_t);
2585 }
2586 unsafe { IOHIDUserDeviceSetCancelHandler(self, handler) }
2587 }
2588
2589 #[doc(alias = "IOHIDUserDeviceActivate")]
2608 #[inline]
2609 pub fn activate(&self) {
2610 extern "C-unwind" {
2611 fn IOHIDUserDeviceActivate(device: &IOHIDUserDevice);
2612 }
2613 unsafe { IOHIDUserDeviceActivate(self) }
2614 }
2615
2616 #[doc(alias = "IOHIDUserDeviceCancel")]
2643 #[inline]
2644 pub fn cancel(&self) {
2645 extern "C-unwind" {
2646 fn IOHIDUserDeviceCancel(device: &IOHIDUserDevice);
2647 }
2648 unsafe { IOHIDUserDeviceCancel(self) }
2649 }
2650
2651 #[doc(alias = "IOHIDUserDeviceCopyProperty")]
2659 #[inline]
2660 pub fn property(&self, key: &CFString) -> Option<CFRetained<CFType>> {
2661 extern "C-unwind" {
2662 fn IOHIDUserDeviceCopyProperty(
2663 device: &IOHIDUserDevice,
2664 key: &CFString,
2665 ) -> Option<NonNull<CFType>>;
2666 }
2667 let ret = unsafe { IOHIDUserDeviceCopyProperty(self, key) };
2668 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2669 }
2670
2671 #[doc(alias = "IOHIDUserDeviceSetProperty")]
2686 #[inline]
2687 pub unsafe fn set_property(&self, key: &CFString, property: &CFType) -> bool {
2688 extern "C-unwind" {
2689 fn IOHIDUserDeviceSetProperty(
2690 device: &IOHIDUserDevice,
2691 key: &CFString,
2692 property: &CFType,
2693 ) -> Boolean;
2694 }
2695 let ret = unsafe { IOHIDUserDeviceSetProperty(self, key, property) };
2696 ret != 0
2697 }
2698
2699 #[doc(alias = "IOHIDUserDeviceHandleReportWithTimeStamp")]
2720 #[inline]
2721 pub unsafe fn handle_report_with_time_stamp(
2722 &self,
2723 timestamp: u64,
2724 report: NonNull<u8>,
2725 report_length: CFIndex,
2726 ) -> IOReturn {
2727 extern "C-unwind" {
2728 fn IOHIDUserDeviceHandleReportWithTimeStamp(
2729 device: &IOHIDUserDevice,
2730 timestamp: u64,
2731 report: NonNull<u8>,
2732 report_length: CFIndex,
2733 ) -> IOReturn;
2734 }
2735 unsafe { IOHIDUserDeviceHandleReportWithTimeStamp(self, timestamp, report, report_length) }
2736 }
2737}
2738
2739#[deprecated = "renamed to `IOHIDEventSystemClient::new_simple_client`"]
2740#[inline]
2741pub extern "C-unwind" fn IOHIDEventSystemClientCreateSimpleClient(
2742 allocator: Option<&CFAllocator>,
2743) -> CFRetained<IOHIDEventSystemClient> {
2744 extern "C-unwind" {
2745 fn IOHIDEventSystemClientCreateSimpleClient(
2746 allocator: Option<&CFAllocator>,
2747 ) -> Option<NonNull<IOHIDEventSystemClient>>;
2748 }
2749 let ret = unsafe { IOHIDEventSystemClientCreateSimpleClient(allocator) };
2750 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2751 unsafe { CFRetained::from_raw(ret) }
2752}
2753
2754#[deprecated = "renamed to `IOHIDEventSystemClient::set_property`"]
2755#[inline]
2756pub unsafe extern "C-unwind" fn IOHIDEventSystemClientSetProperty(
2757 client: &IOHIDEventSystemClient,
2758 key: &CFString,
2759 property: &CFType,
2760) -> bool {
2761 extern "C-unwind" {
2762 fn IOHIDEventSystemClientSetProperty(
2763 client: &IOHIDEventSystemClient,
2764 key: &CFString,
2765 property: &CFType,
2766 ) -> Boolean;
2767 }
2768 let ret = unsafe { IOHIDEventSystemClientSetProperty(client, key, property) };
2769 ret != 0
2770}
2771
2772#[deprecated = "renamed to `IOHIDEventSystemClient::property`"]
2773#[inline]
2774pub extern "C-unwind" fn IOHIDEventSystemClientCopyProperty(
2775 client: &IOHIDEventSystemClient,
2776 key: &CFString,
2777) -> Option<CFRetained<CFType>> {
2778 extern "C-unwind" {
2779 fn IOHIDEventSystemClientCopyProperty(
2780 client: &IOHIDEventSystemClient,
2781 key: &CFString,
2782 ) -> Option<NonNull<CFType>>;
2783 }
2784 let ret = unsafe { IOHIDEventSystemClientCopyProperty(client, key) };
2785 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2786}
2787
2788#[deprecated = "renamed to `IOHIDEventSystemClient::services`"]
2789#[inline]
2790pub extern "C-unwind" fn IOHIDEventSystemClientCopyServices(
2791 client: &IOHIDEventSystemClient,
2792) -> Option<CFRetained<CFArray>> {
2793 extern "C-unwind" {
2794 fn IOHIDEventSystemClientCopyServices(
2795 client: &IOHIDEventSystemClient,
2796 ) -> Option<NonNull<CFArray>>;
2797 }
2798 let ret = unsafe { IOHIDEventSystemClientCopyServices(client) };
2799 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2800}
2801
2802#[deprecated = "renamed to `IOHIDServiceClient::set_property`"]
2803#[inline]
2804pub unsafe extern "C-unwind" fn IOHIDServiceClientSetProperty(
2805 service: &IOHIDServiceClient,
2806 key: &CFString,
2807 property: &CFType,
2808) -> bool {
2809 extern "C-unwind" {
2810 fn IOHIDServiceClientSetProperty(
2811 service: &IOHIDServiceClient,
2812 key: &CFString,
2813 property: &CFType,
2814 ) -> Boolean;
2815 }
2816 let ret = unsafe { IOHIDServiceClientSetProperty(service, key, property) };
2817 ret != 0
2818}
2819
2820#[deprecated = "renamed to `IOHIDServiceClient::property`"]
2821#[inline]
2822pub extern "C-unwind" fn IOHIDServiceClientCopyProperty(
2823 service: &IOHIDServiceClient,
2824 key: &CFString,
2825) -> Option<CFRetained<CFType>> {
2826 extern "C-unwind" {
2827 fn IOHIDServiceClientCopyProperty(
2828 service: &IOHIDServiceClient,
2829 key: &CFString,
2830 ) -> Option<NonNull<CFType>>;
2831 }
2832 let ret = unsafe { IOHIDServiceClientCopyProperty(service, key) };
2833 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2834}
2835
2836#[deprecated = "renamed to `IOHIDServiceClient::registry_id`"]
2837#[inline]
2838pub extern "C-unwind" fn IOHIDServiceClientGetRegistryID(
2839 service: &IOHIDServiceClient,
2840) -> CFRetained<CFType> {
2841 extern "C-unwind" {
2842 fn IOHIDServiceClientGetRegistryID(service: &IOHIDServiceClient)
2843 -> Option<NonNull<CFType>>;
2844 }
2845 let ret = unsafe { IOHIDServiceClientGetRegistryID(service) };
2846 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2847 unsafe { CFRetained::retain(ret) }
2848}
2849
2850#[cfg(feature = "libc")]
2851#[deprecated = "renamed to `IOHIDServiceClient::conforms_to`"]
2852#[inline]
2853pub extern "C-unwind" fn IOHIDServiceClientConformsTo(
2854 service: &IOHIDServiceClient,
2855 usage_page: u32,
2856 usage: u32,
2857) -> bool {
2858 extern "C-unwind" {
2859 fn IOHIDServiceClientConformsTo(
2860 service: &IOHIDServiceClient,
2861 usage_page: u32,
2862 usage: u32,
2863 ) -> libc::boolean_t;
2864 }
2865 let ret = unsafe { IOHIDServiceClientConformsTo(service, usage_page, usage) };
2866 ret != 0
2867}
2868
2869#[deprecated = "renamed to `IOHIDUserDevice::with_properties`"]
2870#[inline]
2871pub unsafe extern "C-unwind" fn IOHIDUserDeviceCreateWithProperties(
2872 allocator: Option<&CFAllocator>,
2873 properties: &CFDictionary,
2874 options: IOOptionBits,
2875) -> Option<CFRetained<IOHIDUserDevice>> {
2876 extern "C-unwind" {
2877 fn IOHIDUserDeviceCreateWithProperties(
2878 allocator: Option<&CFAllocator>,
2879 properties: &CFDictionary,
2880 options: IOOptionBits,
2881 ) -> Option<NonNull<IOHIDUserDevice>>;
2882 }
2883 let ret = unsafe { IOHIDUserDeviceCreateWithProperties(allocator, properties, options) };
2884 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2885}
2886
2887extern "C-unwind" {
2888 #[cfg(all(feature = "block2", feature = "hid"))]
2889 #[deprecated = "renamed to `IOHIDUserDevice::register_get_report_block`"]
2890 pub fn IOHIDUserDeviceRegisterGetReportBlock(
2891 device: &IOHIDUserDevice,
2892 block: IOHIDUserDeviceGetReportBlock,
2893 );
2894}
2895
2896extern "C-unwind" {
2897 #[cfg(all(feature = "block2", feature = "hid"))]
2898 #[deprecated = "renamed to `IOHIDUserDevice::register_set_report_block`"]
2899 pub fn IOHIDUserDeviceRegisterSetReportBlock(
2900 device: &IOHIDUserDevice,
2901 block: IOHIDUserDeviceSetReportBlock,
2902 );
2903}
2904
2905extern "C-unwind" {
2906 #[cfg(feature = "dispatch2")]
2907 #[deprecated = "renamed to `IOHIDUserDevice::set_dispatch_queue`"]
2908 pub fn IOHIDUserDeviceSetDispatchQueue(device: &IOHIDUserDevice, queue: &DispatchQueue);
2909}
2910
2911extern "C-unwind" {
2912 #[cfg(feature = "dispatch2")]
2913 #[deprecated = "renamed to `IOHIDUserDevice::set_cancel_handler`"]
2914 pub fn IOHIDUserDeviceSetCancelHandler(device: &IOHIDUserDevice, handler: dispatch_block_t);
2915}
2916
2917#[deprecated = "renamed to `IOHIDUserDevice::activate`"]
2918#[inline]
2919pub extern "C-unwind" fn IOHIDUserDeviceActivate(device: &IOHIDUserDevice) {
2920 extern "C-unwind" {
2921 fn IOHIDUserDeviceActivate(device: &IOHIDUserDevice);
2922 }
2923 unsafe { IOHIDUserDeviceActivate(device) }
2924}
2925
2926#[deprecated = "renamed to `IOHIDUserDevice::cancel`"]
2927#[inline]
2928pub extern "C-unwind" fn IOHIDUserDeviceCancel(device: &IOHIDUserDevice) {
2929 extern "C-unwind" {
2930 fn IOHIDUserDeviceCancel(device: &IOHIDUserDevice);
2931 }
2932 unsafe { IOHIDUserDeviceCancel(device) }
2933}
2934
2935#[deprecated = "renamed to `IOHIDUserDevice::property`"]
2936#[inline]
2937pub extern "C-unwind" fn IOHIDUserDeviceCopyProperty(
2938 device: &IOHIDUserDevice,
2939 key: &CFString,
2940) -> Option<CFRetained<CFType>> {
2941 extern "C-unwind" {
2942 fn IOHIDUserDeviceCopyProperty(
2943 device: &IOHIDUserDevice,
2944 key: &CFString,
2945 ) -> Option<NonNull<CFType>>;
2946 }
2947 let ret = unsafe { IOHIDUserDeviceCopyProperty(device, key) };
2948 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2949}
2950
2951#[deprecated = "renamed to `IOHIDUserDevice::set_property`"]
2952#[inline]
2953pub unsafe extern "C-unwind" fn IOHIDUserDeviceSetProperty(
2954 device: &IOHIDUserDevice,
2955 key: &CFString,
2956 property: &CFType,
2957) -> bool {
2958 extern "C-unwind" {
2959 fn IOHIDUserDeviceSetProperty(
2960 device: &IOHIDUserDevice,
2961 key: &CFString,
2962 property: &CFType,
2963 ) -> Boolean;
2964 }
2965 let ret = unsafe { IOHIDUserDeviceSetProperty(device, key, property) };
2966 ret != 0
2967}
2968
2969extern "C-unwind" {
2970 #[deprecated = "renamed to `IOHIDUserDevice::handle_report_with_time_stamp`"]
2971 pub fn IOHIDUserDeviceHandleReportWithTimeStamp(
2972 device: &IOHIDUserDevice,
2973 timestamp: u64,
2974 report: NonNull<u8>,
2975 report_length: CFIndex,
2976 ) -> IOReturn;
2977}