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)]
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)]
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)]
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
1332extern "C-unwind" {
1333 #[cfg(feature = "libc")]
1334 pub fn IOHIDCreateSharedMemory(connect: io_connect_t, version: c_uint) -> libc::kern_return_t;
1335}
1336
1337#[cfg(feature = "libc")]
1338#[inline]
1339pub unsafe extern "C-unwind" fn IOHIDSetEventsEnable(
1340 connect: io_connect_t,
1341 enable: bool,
1342) -> libc::kern_return_t {
1343 extern "C-unwind" {
1344 fn IOHIDSetEventsEnable(
1345 connect: io_connect_t,
1346 enable: libc::boolean_t,
1347 ) -> libc::kern_return_t;
1348 }
1349 unsafe { IOHIDSetEventsEnable(connect, enable as _) }
1350}
1351
1352#[cfg(feature = "libc")]
1353#[deprecated]
1354#[inline]
1355pub unsafe extern "C-unwind" fn IOHIDSetCursorEnable(
1356 connect: io_connect_t,
1357 enable: bool,
1358) -> libc::kern_return_t {
1359 extern "C-unwind" {
1360 fn IOHIDSetCursorEnable(
1361 connect: io_connect_t,
1362 enable: libc::boolean_t,
1363 ) -> libc::kern_return_t;
1364 }
1365 unsafe { IOHIDSetCursorEnable(connect, enable as _) }
1366}
1367
1368pub const kIOHIDSetGlobalEventFlags: c_uint = 0x00000001;
1370pub const kIOHIDSetCursorPosition: c_uint = 0x00000002;
1372pub const kIOHIDSetRelativeCursorPosition: c_uint = 0x00000004;
1374pub const kIOHIDPostHIDManagerEvent: c_uint = 0x00000008;
1376
1377extern "C-unwind" {
1378 #[cfg(all(feature = "graphics", feature = "libc"))]
1379 #[deprecated = "Use CGSEventTap for posting HID events, IOHIDUserDevice for simulating HID device, IOPMAssertionDeclareUserActivity for reporting user activity"]
1380 pub fn IOHIDPostEvent(
1381 connect: io_connect_t,
1382 event_type: u32,
1383 location: IOGPoint,
1384 event_data: *const NXEventData,
1385 event_data_version: u32,
1386 event_flags: IOOptionBits,
1387 options: IOOptionBits,
1388 ) -> libc::kern_return_t;
1389}
1390
1391extern "C-unwind" {
1392 #[cfg(feature = "libc")]
1393 #[deprecated]
1394 pub fn IOHIDSetMouseLocation(connect: io_connect_t, x: c_int, y: c_int) -> libc::kern_return_t;
1395}
1396
1397extern "C-unwind" {
1398 #[cfg(feature = "libc")]
1399 pub fn IOHIDGetButtonEventNum(
1400 connect: io_connect_t,
1401 button: NXMouseButton,
1402 event_num: *mut c_int,
1403 ) -> libc::kern_return_t;
1404}
1405
1406extern "C-unwind" {
1407 #[cfg(feature = "libc")]
1408 #[deprecated]
1409 pub fn IOHIDGetScrollAcceleration(
1410 handle: io_connect_t,
1411 acceleration: *mut c_double,
1412 ) -> libc::kern_return_t;
1413}
1414
1415extern "C-unwind" {
1416 #[cfg(feature = "libc")]
1417 #[deprecated]
1418 pub fn IOHIDSetScrollAcceleration(
1419 handle: io_connect_t,
1420 acceleration: c_double,
1421 ) -> libc::kern_return_t;
1422}
1423
1424extern "C-unwind" {
1425 #[cfg(feature = "libc")]
1426 #[deprecated]
1427 pub fn IOHIDGetMouseAcceleration(
1428 handle: io_connect_t,
1429 acceleration: *mut c_double,
1430 ) -> libc::kern_return_t;
1431}
1432
1433extern "C-unwind" {
1434 #[cfg(feature = "libc")]
1435 #[deprecated]
1436 pub fn IOHIDSetMouseAcceleration(
1437 handle: io_connect_t,
1438 acceleration: c_double,
1439 ) -> libc::kern_return_t;
1440}
1441
1442extern "C-unwind" {
1443 #[cfg(feature = "libc")]
1444 #[deprecated]
1445 pub fn IOHIDGetMouseButtonMode(handle: io_connect_t, mode: *mut c_int) -> libc::kern_return_t;
1446}
1447
1448extern "C-unwind" {
1449 #[cfg(feature = "libc")]
1450 #[deprecated]
1451 pub fn IOHIDSetMouseButtonMode(handle: io_connect_t, mode: c_int) -> libc::kern_return_t;
1452}
1453
1454extern "C-unwind" {
1455 #[cfg(feature = "libc")]
1456 #[deprecated]
1457 pub fn IOHIDGetAccelerationWithKey(
1458 handle: io_connect_t,
1459 key: Option<&CFString>,
1460 acceleration: *mut c_double,
1461 ) -> libc::kern_return_t;
1462}
1463
1464extern "C-unwind" {
1465 #[cfg(feature = "libc")]
1466 #[deprecated]
1467 pub fn IOHIDSetAccelerationWithKey(
1468 handle: io_connect_t,
1469 key: Option<&CFString>,
1470 acceleration: c_double,
1471 ) -> libc::kern_return_t;
1472}
1473
1474extern "C-unwind" {
1475 #[cfg(feature = "libc")]
1476 #[deprecated]
1477 pub fn IOHIDGetParameter(
1478 handle: io_connect_t,
1479 key: Option<&CFString>,
1480 max_size: IOByteCount,
1481 bytes: *mut c_void,
1482 actual_size: *mut IOByteCount,
1483 ) -> libc::kern_return_t;
1484}
1485
1486extern "C-unwind" {
1487 #[cfg(feature = "libc")]
1488 #[deprecated]
1489 pub fn IOHIDSetParameter(
1490 handle: io_connect_t,
1491 key: Option<&CFString>,
1492 bytes: *const c_void,
1493 size: IOByteCount,
1494 ) -> libc::kern_return_t;
1495}
1496
1497extern "C-unwind" {
1498 #[cfg(feature = "libc")]
1499 pub fn IOHIDCopyCFTypeParameter(
1500 handle: io_connect_t,
1501 key: Option<&CFString>,
1502 parameter: *mut *const CFType,
1503 ) -> libc::kern_return_t;
1504}
1505
1506extern "C-unwind" {
1507 #[cfg(feature = "libc")]
1508 pub fn IOHIDSetCFTypeParameter(
1509 handle: io_connect_t,
1510 key: Option<&CFString>,
1511 parameter: Option<&CFType>,
1512 ) -> libc::kern_return_t;
1513}
1514
1515extern "C-unwind" {
1516 #[cfg(feature = "libc")]
1517 pub fn IOHIDGetStateForSelector(
1518 handle: io_connect_t,
1519 selector: c_int,
1520 state: *mut u32,
1521 ) -> libc::kern_return_t;
1522}
1523
1524extern "C-unwind" {
1525 #[cfg(feature = "libc")]
1526 pub fn IOHIDSetStateForSelector(
1527 handle: io_connect_t,
1528 selector: c_int,
1529 state: u32,
1530 ) -> libc::kern_return_t;
1531}
1532
1533extern "C-unwind" {
1534 #[cfg(feature = "libc")]
1535 pub fn IOHIDGetModifierLockState(
1536 handle: io_connect_t,
1537 selector: c_int,
1538 state: *mut bool,
1539 ) -> libc::kern_return_t;
1540}
1541
1542extern "C-unwind" {
1543 #[cfg(feature = "libc")]
1544 pub fn IOHIDSetModifierLockState(
1545 handle: io_connect_t,
1546 selector: c_int,
1547 state: bool,
1548 ) -> libc::kern_return_t;
1549}
1550
1551extern "C-unwind" {
1552 #[cfg(feature = "libc")]
1553 #[deprecated]
1554 pub fn IOHIDRegisterVirtualDisplay(
1555 handle: io_connect_t,
1556 display_token: *mut u32,
1557 ) -> libc::kern_return_t;
1558}
1559
1560extern "C-unwind" {
1561 #[cfg(feature = "libc")]
1562 #[deprecated]
1563 pub fn IOHIDUnregisterVirtualDisplay(
1564 handle: io_connect_t,
1565 display_token: u32,
1566 ) -> libc::kern_return_t;
1567}
1568
1569extern "C-unwind" {
1570 #[cfg(all(feature = "graphics", feature = "libc"))]
1571 #[deprecated]
1572 pub fn IOHIDSetVirtualDisplayBounds(
1573 handle: io_connect_t,
1574 display_token: u32,
1575 bounds: *const IOGBounds,
1576 ) -> libc::kern_return_t;
1577}
1578
1579extern "C-unwind" {
1580 #[cfg(feature = "libc")]
1581 #[deprecated]
1582 pub fn IOHIDGetActivityState(
1583 handle: io_connect_t,
1584 hid_activity_idle: *mut bool,
1585 ) -> libc::kern_return_t;
1586}
1587
1588#[repr(transparent)]
1590#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1591pub struct IOHIDRequestType(pub c_uint);
1592impl IOHIDRequestType {
1593 #[doc(alias = "kIOHIDRequestTypePostEvent")]
1594 pub const PostEvent: Self = Self(0);
1595 #[doc(alias = "kIOHIDRequestTypeListenEvent")]
1596 pub const ListenEvent: Self = Self(1);
1597}
1598
1599#[cfg(feature = "objc2")]
1600unsafe impl Encode for IOHIDRequestType {
1601 const ENCODING: Encoding = c_uint::ENCODING;
1602}
1603
1604#[cfg(feature = "objc2")]
1605unsafe impl RefEncode for IOHIDRequestType {
1606 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1607}
1608
1609#[repr(transparent)]
1611#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1612pub struct IOHIDAccessType(pub c_uint);
1613impl IOHIDAccessType {
1614 #[doc(alias = "kIOHIDAccessTypeGranted")]
1615 pub const Granted: Self = Self(0);
1616 #[doc(alias = "kIOHIDAccessTypeDenied")]
1617 pub const Denied: Self = Self(1);
1618 #[doc(alias = "kIOHIDAccessTypeUnknown")]
1619 pub const Unknown: Self = Self(2);
1620}
1621
1622#[cfg(feature = "objc2")]
1623unsafe impl Encode for IOHIDAccessType {
1624 const ENCODING: Encoding = c_uint::ENCODING;
1625}
1626
1627#[cfg(feature = "objc2")]
1628unsafe impl RefEncode for IOHIDAccessType {
1629 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1630}
1631
1632extern "C-unwind" {
1633 pub fn IOHIDCheckAccess(request_type: IOHIDRequestType) -> IOHIDAccessType;
1642}
1643
1644extern "C-unwind" {
1645 pub fn IOHIDRequestAccess(request_type: IOHIDRequestType) -> bool;
1659}
1660
1661#[cfg(feature = "libc")]
1663pub type NXEventHandle = libc::mach_port_t;
1664
1665extern "C-unwind" {
1666 #[cfg(feature = "libc")]
1667 #[deprecated]
1668 pub fn NXOpenEventStatus() -> NXEventHandle;
1669}
1670
1671extern "C-unwind" {
1672 #[cfg(feature = "libc")]
1673 #[deprecated]
1674 pub fn NXCloseEventStatus(handle: NXEventHandle);
1675}
1676
1677extern "C-unwind" {
1678 #[cfg(feature = "libc")]
1679 pub fn NXEventSystemInfo(
1680 handle: NXEventHandle,
1681 flavor: *mut c_char,
1682 evs_info: *mut c_int,
1683 evs_info_cnt: *mut c_uint,
1684 ) -> NXEventSystemInfoType;
1685}
1686
1687extern "C-unwind" {
1688 #[cfg(feature = "libc")]
1689 #[deprecated]
1690 pub fn NXSetKeyRepeatInterval(handle: NXEventHandle, seconds: c_double);
1691}
1692
1693extern "C-unwind" {
1694 #[cfg(feature = "libc")]
1695 #[deprecated]
1696 pub fn NXKeyRepeatInterval(handle: NXEventHandle) -> c_double;
1697}
1698
1699extern "C-unwind" {
1700 #[cfg(feature = "libc")]
1701 #[deprecated]
1702 pub fn NXSetKeyRepeatThreshold(handle: NXEventHandle, threshold: c_double);
1703}
1704
1705extern "C-unwind" {
1706 #[cfg(feature = "libc")]
1707 #[deprecated]
1708 pub fn NXKeyRepeatThreshold(handle: NXEventHandle) -> c_double;
1709}
1710
1711extern "C-unwind" {
1712 #[cfg(feature = "libc")]
1713 pub fn NXResetKeyboard(handle: NXEventHandle);
1714}
1715
1716extern "C-unwind" {
1717 #[cfg(feature = "libc")]
1718 #[deprecated]
1719 pub fn NXSetClickTime(handle: NXEventHandle, seconds: c_double);
1720}
1721
1722extern "C-unwind" {
1723 #[cfg(feature = "libc")]
1724 #[deprecated]
1725 pub fn NXClickTime(handle: NXEventHandle) -> c_double;
1726}
1727
1728extern "C-unwind" {
1729 #[cfg(feature = "libc")]
1730 #[deprecated]
1731 pub fn NXSetClickSpace(handle: NXEventHandle, area: *mut NXSize);
1732}
1733
1734extern "C-unwind" {
1735 #[cfg(feature = "libc")]
1736 #[deprecated]
1737 pub fn NXGetClickSpace(handle: NXEventHandle, area: *mut NXSize);
1738}
1739
1740extern "C-unwind" {
1741 #[cfg(feature = "libc")]
1742 pub fn NXResetMouse(handle: NXEventHandle);
1743}
1744
1745#[repr(C)]
1747#[derive(Clone, Copy, Debug, PartialEq)]
1748pub struct _NXParsedKeyMapping_ {
1749 pub shorts: c_short,
1750 pub keyBits: [c_char; 256],
1751 pub maxMod: c_int,
1752 pub modDefs: [*mut c_uchar; 16],
1753 pub numDefs: c_int,
1754 pub keyDefs: [*mut c_uchar; 256],
1755 pub numSeqs: c_int,
1756 pub seqDefs: [*mut c_uchar; 128],
1757 pub numSpecialKeys: c_int,
1758 pub specialKeys: [c_ushort; 24],
1759 pub mapping: *const c_uchar,
1760 pub mappingLen: c_int,
1761}
1762
1763#[cfg(feature = "objc2")]
1764unsafe impl Encode for _NXParsedKeyMapping_ {
1765 const ENCODING: Encoding = Encoding::Struct(
1766 "_NXParsedKeyMapping_",
1767 &[
1768 <c_short>::ENCODING,
1769 <[c_char; 256]>::ENCODING,
1770 <c_int>::ENCODING,
1771 <[*mut c_uchar; 16]>::ENCODING,
1772 <c_int>::ENCODING,
1773 <[*mut c_uchar; 256]>::ENCODING,
1774 <c_int>::ENCODING,
1775 <[*mut c_uchar; 128]>::ENCODING,
1776 <c_int>::ENCODING,
1777 <[c_ushort; 24]>::ENCODING,
1778 <*const c_uchar>::ENCODING,
1779 <c_int>::ENCODING,
1780 ],
1781 );
1782}
1783
1784#[cfg(feature = "objc2")]
1785unsafe impl RefEncode for _NXParsedKeyMapping_ {
1786 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1787}
1788
1789pub type NXParsedKeyMapping = _NXParsedKeyMapping_;
1791
1792#[repr(C)]
1808pub struct IOHIDEventSystemClient {
1809 inner: [u8; 0],
1810 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
1811}
1812
1813cf_type!(
1814 unsafe impl IOHIDEventSystemClient {}
1815);
1816#[cfg(feature = "objc2")]
1817cf_objc2_type!(
1818 unsafe impl RefEncode<"__IOHIDEventSystemClient"> for IOHIDEventSystemClient {}
1819);
1820
1821impl IOHIDEventSystemClient {
1822 #[doc(alias = "IOHIDEventSystemClientCreateSimpleClient")]
1844 #[inline]
1845 pub unsafe fn new_simple_client(
1846 allocator: Option<&CFAllocator>,
1847 ) -> CFRetained<IOHIDEventSystemClient> {
1848 extern "C-unwind" {
1849 fn IOHIDEventSystemClientCreateSimpleClient(
1850 allocator: Option<&CFAllocator>,
1851 ) -> Option<NonNull<IOHIDEventSystemClient>>;
1852 }
1853 let ret = unsafe { IOHIDEventSystemClientCreateSimpleClient(allocator) };
1854 let ret =
1855 ret.expect("function was marked as returning non-null, but actually returned NULL");
1856 unsafe { CFRetained::from_raw(ret) }
1857 }
1858
1859 #[doc(alias = "IOHIDEventSystemClientSetProperty")]
1881 #[inline]
1882 pub unsafe fn set_property(
1883 self: &IOHIDEventSystemClient,
1884 key: &CFString,
1885 property: &CFType,
1886 ) -> bool {
1887 extern "C-unwind" {
1888 fn IOHIDEventSystemClientSetProperty(
1889 client: &IOHIDEventSystemClient,
1890 key: &CFString,
1891 property: &CFType,
1892 ) -> Boolean;
1893 }
1894 let ret = unsafe { IOHIDEventSystemClientSetProperty(self, key, property) };
1895 ret != 0
1896 }
1897
1898 #[doc(alias = "IOHIDEventSystemClientCopyProperty")]
1918 #[inline]
1919 pub unsafe fn property(
1920 self: &IOHIDEventSystemClient,
1921 key: &CFString,
1922 ) -> Option<CFRetained<CFType>> {
1923 extern "C-unwind" {
1924 fn IOHIDEventSystemClientCopyProperty(
1925 client: &IOHIDEventSystemClient,
1926 key: &CFString,
1927 ) -> Option<NonNull<CFType>>;
1928 }
1929 let ret = unsafe { IOHIDEventSystemClientCopyProperty(self, key) };
1930 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1931 }
1932}
1933
1934unsafe impl ConcreteType for IOHIDEventSystemClient {
1935 #[doc(alias = "IOHIDEventSystemClientGetTypeID")]
1941 #[inline]
1942 fn type_id() -> CFTypeID {
1943 extern "C-unwind" {
1944 fn IOHIDEventSystemClientGetTypeID() -> CFTypeID;
1945 }
1946 unsafe { IOHIDEventSystemClientGetTypeID() }
1947 }
1948}
1949
1950impl IOHIDEventSystemClient {
1951 #[doc(alias = "IOHIDEventSystemClientCopyServices")]
1976 #[inline]
1977 pub unsafe fn services(self: &IOHIDEventSystemClient) -> Option<CFRetained<CFArray>> {
1978 extern "C-unwind" {
1979 fn IOHIDEventSystemClientCopyServices(
1980 client: &IOHIDEventSystemClient,
1981 ) -> Option<NonNull<CFArray>>;
1982 }
1983 let ret = unsafe { IOHIDEventSystemClientCopyServices(self) };
1984 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1985 }
1986}
1987
1988#[repr(C)]
2000pub struct IOHIDServiceClient {
2001 inner: [u8; 0],
2002 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
2003}
2004
2005cf_type!(
2006 unsafe impl IOHIDServiceClient {}
2007);
2008#[cfg(feature = "objc2")]
2009cf_objc2_type!(
2010 unsafe impl RefEncode<"__IOHIDServiceClient"> for IOHIDServiceClient {}
2011);
2012
2013impl IOHIDServiceClient {
2014 #[doc(alias = "IOHIDServiceClientSetProperty")]
2032 #[inline]
2033 pub unsafe fn set_property(
2034 self: &IOHIDServiceClient,
2035 key: &CFString,
2036 property: &CFType,
2037 ) -> bool {
2038 extern "C-unwind" {
2039 fn IOHIDServiceClientSetProperty(
2040 service: &IOHIDServiceClient,
2041 key: &CFString,
2042 property: &CFType,
2043 ) -> Boolean;
2044 }
2045 let ret = unsafe { IOHIDServiceClientSetProperty(self, key, property) };
2046 ret != 0
2047 }
2048
2049 #[doc(alias = "IOHIDServiceClientCopyProperty")]
2065 #[inline]
2066 pub unsafe fn property(
2067 self: &IOHIDServiceClient,
2068 key: &CFString,
2069 ) -> Option<CFRetained<CFType>> {
2070 extern "C-unwind" {
2071 fn IOHIDServiceClientCopyProperty(
2072 service: &IOHIDServiceClient,
2073 key: &CFString,
2074 ) -> Option<NonNull<CFType>>;
2075 }
2076 let ret = unsafe { IOHIDServiceClientCopyProperty(self, key) };
2077 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2078 }
2079}
2080
2081unsafe impl ConcreteType for IOHIDServiceClient {
2082 #[doc(alias = "IOHIDServiceClientGetTypeID")]
2088 #[inline]
2089 fn type_id() -> CFTypeID {
2090 extern "C-unwind" {
2091 fn IOHIDServiceClientGetTypeID() -> CFTypeID;
2092 }
2093 unsafe { IOHIDServiceClientGetTypeID() }
2094 }
2095}
2096
2097impl IOHIDServiceClient {
2098 #[doc(alias = "IOHIDServiceClientGetRegistryID")]
2103 #[inline]
2104 pub unsafe fn registry_id(self: &IOHIDServiceClient) -> CFRetained<CFType> {
2105 extern "C-unwind" {
2106 fn IOHIDServiceClientGetRegistryID(
2107 service: &IOHIDServiceClient,
2108 ) -> Option<NonNull<CFType>>;
2109 }
2110 let ret = unsafe { IOHIDServiceClientGetRegistryID(self) };
2111 let ret =
2112 ret.expect("function was marked as returning non-null, but actually returned NULL");
2113 unsafe { CFRetained::retain(ret) }
2114 }
2115
2116 #[doc(alias = "IOHIDServiceClientConformsTo")]
2135 #[cfg(feature = "libc")]
2136 #[inline]
2137 pub unsafe fn conforms_to(self: &IOHIDServiceClient, usage_page: u32, usage: u32) -> bool {
2138 extern "C-unwind" {
2139 fn IOHIDServiceClientConformsTo(
2140 service: &IOHIDServiceClient,
2141 usage_page: u32,
2142 usage: u32,
2143 ) -> libc::boolean_t;
2144 }
2145 let ret = unsafe { IOHIDServiceClientConformsTo(self, usage_page, usage) };
2146 ret != 0
2147 }
2148}
2149
2150#[repr(C)]
2152pub struct IOHIDUserDevice {
2153 inner: [u8; 0],
2154 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
2155}
2156
2157cf_type!(
2158 unsafe impl IOHIDUserDevice {}
2159);
2160#[cfg(feature = "objc2")]
2161cf_objc2_type!(
2162 unsafe impl RefEncode<"__IOHIDUserDevice"> for IOHIDUserDevice {}
2163);
2164
2165#[cfg(all(feature = "block2", feature = "hid"))]
2181pub type IOHIDUserDeviceSetReportBlock =
2182 *mut block2::DynBlock<dyn Fn(IOHIDReportType, u32, NonNull<u8>, CFIndex) -> IOReturn>;
2183
2184#[cfg(all(feature = "block2", feature = "hid"))]
2202pub type IOHIDUserDeviceGetReportBlock =
2203 *mut block2::DynBlock<dyn Fn(IOHIDReportType, u32, NonNull<u8>, NonNull<CFIndex>) -> IOReturn>;
2204
2205#[repr(transparent)]
2216#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2217pub struct IOHIDUserDeviceOptions(pub IOOptionBits);
2218impl IOHIDUserDeviceOptions {
2219 #[doc(alias = "IOHIDUserDeviceOptionsCreateOnActivate")]
2220 pub const CreateOnActivate: Self = Self(1 << 0);
2221}
2222
2223#[cfg(feature = "objc2")]
2224unsafe impl Encode for IOHIDUserDeviceOptions {
2225 const ENCODING: Encoding = IOOptionBits::ENCODING;
2226}
2227
2228#[cfg(feature = "objc2")]
2229unsafe impl RefEncode for IOHIDUserDeviceOptions {
2230 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2231}
2232
2233unsafe impl ConcreteType for IOHIDUserDevice {
2234 #[doc(alias = "IOHIDUserDeviceGetTypeID")]
2236 #[inline]
2237 fn type_id() -> CFTypeID {
2238 extern "C-unwind" {
2239 fn IOHIDUserDeviceGetTypeID() -> CFTypeID;
2240 }
2241 unsafe { IOHIDUserDeviceGetTypeID() }
2242 }
2243}
2244
2245impl IOHIDUserDevice {
2246 #[doc(alias = "IOHIDUserDeviceCreateWithProperties")]
2268 #[inline]
2269 pub unsafe fn with_properties(
2270 allocator: Option<&CFAllocator>,
2271 properties: &CFDictionary,
2272 options: IOOptionBits,
2273 ) -> Option<CFRetained<IOHIDUserDevice>> {
2274 extern "C-unwind" {
2275 fn IOHIDUserDeviceCreateWithProperties(
2276 allocator: Option<&CFAllocator>,
2277 properties: &CFDictionary,
2278 options: IOOptionBits,
2279 ) -> Option<NonNull<IOHIDUserDevice>>;
2280 }
2281 let ret = unsafe { IOHIDUserDeviceCreateWithProperties(allocator, properties, options) };
2282 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2283 }
2284
2285 #[doc(alias = "IOHIDUserDeviceRegisterGetReportBlock")]
2298 #[cfg(all(feature = "block2", feature = "hid"))]
2299 #[inline]
2300 pub unsafe fn register_get_report_block(
2301 self: &IOHIDUserDevice,
2302 block: IOHIDUserDeviceGetReportBlock,
2303 ) {
2304 extern "C-unwind" {
2305 fn IOHIDUserDeviceRegisterGetReportBlock(
2306 device: &IOHIDUserDevice,
2307 block: IOHIDUserDeviceGetReportBlock,
2308 );
2309 }
2310 unsafe { IOHIDUserDeviceRegisterGetReportBlock(self, block) }
2311 }
2312
2313 #[doc(alias = "IOHIDUserDeviceRegisterSetReportBlock")]
2326 #[cfg(all(feature = "block2", feature = "hid"))]
2327 #[inline]
2328 pub unsafe fn register_set_report_block(
2329 self: &IOHIDUserDevice,
2330 block: IOHIDUserDeviceSetReportBlock,
2331 ) {
2332 extern "C-unwind" {
2333 fn IOHIDUserDeviceRegisterSetReportBlock(
2334 device: &IOHIDUserDevice,
2335 block: IOHIDUserDeviceSetReportBlock,
2336 );
2337 }
2338 unsafe { IOHIDUserDeviceRegisterSetReportBlock(self, block) }
2339 }
2340
2341 #[doc(alias = "IOHIDUserDeviceSetDispatchQueue")]
2358 #[cfg(feature = "dispatch2")]
2359 #[inline]
2360 pub unsafe fn set_dispatch_queue(self: &IOHIDUserDevice, queue: &DispatchQueue) {
2361 extern "C-unwind" {
2362 fn IOHIDUserDeviceSetDispatchQueue(device: &IOHIDUserDevice, queue: &DispatchQueue);
2363 }
2364 unsafe { IOHIDUserDeviceSetDispatchQueue(self, queue) }
2365 }
2366
2367 #[doc(alias = "IOHIDUserDeviceSetCancelHandler")]
2392 #[cfg(feature = "dispatch2")]
2393 #[inline]
2394 pub unsafe fn set_cancel_handler(self: &IOHIDUserDevice, handler: dispatch_block_t) {
2395 extern "C-unwind" {
2396 fn IOHIDUserDeviceSetCancelHandler(device: &IOHIDUserDevice, handler: dispatch_block_t);
2397 }
2398 unsafe { IOHIDUserDeviceSetCancelHandler(self, handler) }
2399 }
2400
2401 #[doc(alias = "IOHIDUserDeviceActivate")]
2420 #[inline]
2421 pub unsafe fn activate(self: &IOHIDUserDevice) {
2422 extern "C-unwind" {
2423 fn IOHIDUserDeviceActivate(device: &IOHIDUserDevice);
2424 }
2425 unsafe { IOHIDUserDeviceActivate(self) }
2426 }
2427
2428 #[doc(alias = "IOHIDUserDeviceCancel")]
2455 #[inline]
2456 pub unsafe fn cancel(self: &IOHIDUserDevice) {
2457 extern "C-unwind" {
2458 fn IOHIDUserDeviceCancel(device: &IOHIDUserDevice);
2459 }
2460 unsafe { IOHIDUserDeviceCancel(self) }
2461 }
2462
2463 #[doc(alias = "IOHIDUserDeviceCopyProperty")]
2471 #[inline]
2472 pub unsafe fn property(self: &IOHIDUserDevice, key: &CFString) -> Option<CFRetained<CFType>> {
2473 extern "C-unwind" {
2474 fn IOHIDUserDeviceCopyProperty(
2475 device: &IOHIDUserDevice,
2476 key: &CFString,
2477 ) -> Option<NonNull<CFType>>;
2478 }
2479 let ret = unsafe { IOHIDUserDeviceCopyProperty(self, key) };
2480 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2481 }
2482
2483 #[doc(alias = "IOHIDUserDeviceSetProperty")]
2494 #[inline]
2495 pub unsafe fn set_property(self: &IOHIDUserDevice, key: &CFString, property: &CFType) -> bool {
2496 extern "C-unwind" {
2497 fn IOHIDUserDeviceSetProperty(
2498 device: &IOHIDUserDevice,
2499 key: &CFString,
2500 property: &CFType,
2501 ) -> Boolean;
2502 }
2503 let ret = unsafe { IOHIDUserDeviceSetProperty(self, key, property) };
2504 ret != 0
2505 }
2506
2507 #[doc(alias = "IOHIDUserDeviceHandleReportWithTimeStamp")]
2524 #[inline]
2525 pub unsafe fn handle_report_with_time_stamp(
2526 self: &IOHIDUserDevice,
2527 timestamp: u64,
2528 report: NonNull<u8>,
2529 report_length: CFIndex,
2530 ) -> IOReturn {
2531 extern "C-unwind" {
2532 fn IOHIDUserDeviceHandleReportWithTimeStamp(
2533 device: &IOHIDUserDevice,
2534 timestamp: u64,
2535 report: NonNull<u8>,
2536 report_length: CFIndex,
2537 ) -> IOReturn;
2538 }
2539 unsafe { IOHIDUserDeviceHandleReportWithTimeStamp(self, timestamp, report, report_length) }
2540 }
2541}
2542
2543#[deprecated = "renamed to `IOHIDEventSystemClient::new_simple_client`"]
2544#[inline]
2545pub unsafe extern "C-unwind" fn IOHIDEventSystemClientCreateSimpleClient(
2546 allocator: Option<&CFAllocator>,
2547) -> CFRetained<IOHIDEventSystemClient> {
2548 extern "C-unwind" {
2549 fn IOHIDEventSystemClientCreateSimpleClient(
2550 allocator: Option<&CFAllocator>,
2551 ) -> Option<NonNull<IOHIDEventSystemClient>>;
2552 }
2553 let ret = unsafe { IOHIDEventSystemClientCreateSimpleClient(allocator) };
2554 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2555 unsafe { CFRetained::from_raw(ret) }
2556}
2557
2558#[deprecated = "renamed to `IOHIDEventSystemClient::set_property`"]
2559#[inline]
2560pub unsafe extern "C-unwind" fn IOHIDEventSystemClientSetProperty(
2561 client: &IOHIDEventSystemClient,
2562 key: &CFString,
2563 property: &CFType,
2564) -> bool {
2565 extern "C-unwind" {
2566 fn IOHIDEventSystemClientSetProperty(
2567 client: &IOHIDEventSystemClient,
2568 key: &CFString,
2569 property: &CFType,
2570 ) -> Boolean;
2571 }
2572 let ret = unsafe { IOHIDEventSystemClientSetProperty(client, key, property) };
2573 ret != 0
2574}
2575
2576#[deprecated = "renamed to `IOHIDEventSystemClient::property`"]
2577#[inline]
2578pub unsafe extern "C-unwind" fn IOHIDEventSystemClientCopyProperty(
2579 client: &IOHIDEventSystemClient,
2580 key: &CFString,
2581) -> Option<CFRetained<CFType>> {
2582 extern "C-unwind" {
2583 fn IOHIDEventSystemClientCopyProperty(
2584 client: &IOHIDEventSystemClient,
2585 key: &CFString,
2586 ) -> Option<NonNull<CFType>>;
2587 }
2588 let ret = unsafe { IOHIDEventSystemClientCopyProperty(client, key) };
2589 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2590}
2591
2592#[deprecated = "renamed to `IOHIDEventSystemClient::services`"]
2593#[inline]
2594pub unsafe extern "C-unwind" fn IOHIDEventSystemClientCopyServices(
2595 client: &IOHIDEventSystemClient,
2596) -> Option<CFRetained<CFArray>> {
2597 extern "C-unwind" {
2598 fn IOHIDEventSystemClientCopyServices(
2599 client: &IOHIDEventSystemClient,
2600 ) -> Option<NonNull<CFArray>>;
2601 }
2602 let ret = unsafe { IOHIDEventSystemClientCopyServices(client) };
2603 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2604}
2605
2606#[deprecated = "renamed to `IOHIDServiceClient::set_property`"]
2607#[inline]
2608pub unsafe extern "C-unwind" fn IOHIDServiceClientSetProperty(
2609 service: &IOHIDServiceClient,
2610 key: &CFString,
2611 property: &CFType,
2612) -> bool {
2613 extern "C-unwind" {
2614 fn IOHIDServiceClientSetProperty(
2615 service: &IOHIDServiceClient,
2616 key: &CFString,
2617 property: &CFType,
2618 ) -> Boolean;
2619 }
2620 let ret = unsafe { IOHIDServiceClientSetProperty(service, key, property) };
2621 ret != 0
2622}
2623
2624#[deprecated = "renamed to `IOHIDServiceClient::property`"]
2625#[inline]
2626pub unsafe extern "C-unwind" fn IOHIDServiceClientCopyProperty(
2627 service: &IOHIDServiceClient,
2628 key: &CFString,
2629) -> Option<CFRetained<CFType>> {
2630 extern "C-unwind" {
2631 fn IOHIDServiceClientCopyProperty(
2632 service: &IOHIDServiceClient,
2633 key: &CFString,
2634 ) -> Option<NonNull<CFType>>;
2635 }
2636 let ret = unsafe { IOHIDServiceClientCopyProperty(service, key) };
2637 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2638}
2639
2640#[deprecated = "renamed to `IOHIDServiceClient::registry_id`"]
2641#[inline]
2642pub unsafe extern "C-unwind" fn IOHIDServiceClientGetRegistryID(
2643 service: &IOHIDServiceClient,
2644) -> CFRetained<CFType> {
2645 extern "C-unwind" {
2646 fn IOHIDServiceClientGetRegistryID(service: &IOHIDServiceClient)
2647 -> Option<NonNull<CFType>>;
2648 }
2649 let ret = unsafe { IOHIDServiceClientGetRegistryID(service) };
2650 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2651 unsafe { CFRetained::retain(ret) }
2652}
2653
2654#[cfg(feature = "libc")]
2655#[deprecated = "renamed to `IOHIDServiceClient::conforms_to`"]
2656#[inline]
2657pub unsafe extern "C-unwind" fn IOHIDServiceClientConformsTo(
2658 service: &IOHIDServiceClient,
2659 usage_page: u32,
2660 usage: u32,
2661) -> bool {
2662 extern "C-unwind" {
2663 fn IOHIDServiceClientConformsTo(
2664 service: &IOHIDServiceClient,
2665 usage_page: u32,
2666 usage: u32,
2667 ) -> libc::boolean_t;
2668 }
2669 let ret = unsafe { IOHIDServiceClientConformsTo(service, usage_page, usage) };
2670 ret != 0
2671}
2672
2673#[deprecated = "renamed to `IOHIDUserDevice::with_properties`"]
2674#[inline]
2675pub unsafe extern "C-unwind" fn IOHIDUserDeviceCreateWithProperties(
2676 allocator: Option<&CFAllocator>,
2677 properties: &CFDictionary,
2678 options: IOOptionBits,
2679) -> Option<CFRetained<IOHIDUserDevice>> {
2680 extern "C-unwind" {
2681 fn IOHIDUserDeviceCreateWithProperties(
2682 allocator: Option<&CFAllocator>,
2683 properties: &CFDictionary,
2684 options: IOOptionBits,
2685 ) -> Option<NonNull<IOHIDUserDevice>>;
2686 }
2687 let ret = unsafe { IOHIDUserDeviceCreateWithProperties(allocator, properties, options) };
2688 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2689}
2690
2691extern "C-unwind" {
2692 #[cfg(all(feature = "block2", feature = "hid"))]
2693 #[deprecated = "renamed to `IOHIDUserDevice::register_get_report_block`"]
2694 pub fn IOHIDUserDeviceRegisterGetReportBlock(
2695 device: &IOHIDUserDevice,
2696 block: IOHIDUserDeviceGetReportBlock,
2697 );
2698}
2699
2700extern "C-unwind" {
2701 #[cfg(all(feature = "block2", feature = "hid"))]
2702 #[deprecated = "renamed to `IOHIDUserDevice::register_set_report_block`"]
2703 pub fn IOHIDUserDeviceRegisterSetReportBlock(
2704 device: &IOHIDUserDevice,
2705 block: IOHIDUserDeviceSetReportBlock,
2706 );
2707}
2708
2709extern "C-unwind" {
2710 #[cfg(feature = "dispatch2")]
2711 #[deprecated = "renamed to `IOHIDUserDevice::set_dispatch_queue`"]
2712 pub fn IOHIDUserDeviceSetDispatchQueue(device: &IOHIDUserDevice, queue: &DispatchQueue);
2713}
2714
2715extern "C-unwind" {
2716 #[cfg(feature = "dispatch2")]
2717 #[deprecated = "renamed to `IOHIDUserDevice::set_cancel_handler`"]
2718 pub fn IOHIDUserDeviceSetCancelHandler(device: &IOHIDUserDevice, handler: dispatch_block_t);
2719}
2720
2721extern "C-unwind" {
2722 #[deprecated = "renamed to `IOHIDUserDevice::activate`"]
2723 pub fn IOHIDUserDeviceActivate(device: &IOHIDUserDevice);
2724}
2725
2726extern "C-unwind" {
2727 #[deprecated = "renamed to `IOHIDUserDevice::cancel`"]
2728 pub fn IOHIDUserDeviceCancel(device: &IOHIDUserDevice);
2729}
2730
2731#[deprecated = "renamed to `IOHIDUserDevice::property`"]
2732#[inline]
2733pub unsafe extern "C-unwind" fn IOHIDUserDeviceCopyProperty(
2734 device: &IOHIDUserDevice,
2735 key: &CFString,
2736) -> Option<CFRetained<CFType>> {
2737 extern "C-unwind" {
2738 fn IOHIDUserDeviceCopyProperty(
2739 device: &IOHIDUserDevice,
2740 key: &CFString,
2741 ) -> Option<NonNull<CFType>>;
2742 }
2743 let ret = unsafe { IOHIDUserDeviceCopyProperty(device, key) };
2744 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2745}
2746
2747#[deprecated = "renamed to `IOHIDUserDevice::set_property`"]
2748#[inline]
2749pub unsafe extern "C-unwind" fn IOHIDUserDeviceSetProperty(
2750 device: &IOHIDUserDevice,
2751 key: &CFString,
2752 property: &CFType,
2753) -> bool {
2754 extern "C-unwind" {
2755 fn IOHIDUserDeviceSetProperty(
2756 device: &IOHIDUserDevice,
2757 key: &CFString,
2758 property: &CFType,
2759 ) -> Boolean;
2760 }
2761 let ret = unsafe { IOHIDUserDeviceSetProperty(device, key, property) };
2762 ret != 0
2763}
2764
2765extern "C-unwind" {
2766 #[deprecated = "renamed to `IOHIDUserDevice::handle_report_with_time_stamp`"]
2767 pub fn IOHIDUserDeviceHandleReportWithTimeStamp(
2768 device: &IOHIDUserDevice,
2769 timestamp: u64,
2770 report: NonNull<u8>,
2771 report_length: CFIndex,
2772 ) -> IOReturn;
2773}