objc2_core_graphics/generated/
CGRemoteOperation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgmousedowneventmaskingdeadswitchtimeout?language=objc)
12pub const kCGMouseDownEventMaskingDeadSwitchTimeout: c_float = 60.0;
13/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgeventfiltermaskpermitallevents?language=objc)
14pub const kCGEventFilterMaskPermitAllEvents: c_uint = CGEventFilterMask::PermitLocalMouseEvents.0
15    | CGEventFilterMask::PermitLocalKeyboardEvents.0
16    | CGEventFilterMask::PermitSystemDefinedEvents.0;
17/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgeventsupressionstatesupressioninterval?language=objc)
18pub const kCGEventSupressionStateSupressionInterval: c_uint =
19    CGEventSuppressionState::EventSuppressionStateSuppressionInterval.0;
20/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgeventsupressionstateremotemousedrag?language=objc)
21pub const kCGEventSupressionStateRemoteMouseDrag: c_uint =
22    CGEventSuppressionState::EventSuppressionStateRemoteMouseDrag.0;
23/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgnumberofeventsupressionstates?language=objc)
24pub const kCGNumberOfEventSupressionStates: c_uint =
25    CGEventSuppressionState::NumberOfEventSuppressionStates.0;
26/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventerr?language=objc)
27#[cfg(feature = "CGError")]
28pub type CGEventErr = CGError;
29
30/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgbuttoncount?language=objc)
31pub type CGButtonCount = u32;
32
33/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgwheelcount?language=objc)
34pub type CGWheelCount = u32;
35
36/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgcharcode?language=objc)
37pub type CGCharCode = u16;
38
39/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgkeycode?language=objc)
40pub type CGKeyCode = u16;
41
42/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscreenrefreshcallback?language=objc)
43pub type CGScreenRefreshCallback =
44    Option<unsafe extern "C-unwind" fn(u32, NonNull<CGRect>, *mut c_void)>;
45
46extern "C-unwind" {
47    /// # Safety
48    ///
49    /// - `callback` must be implemented correctly.
50    /// - `user_info` must be a valid pointer or null.
51    #[cfg(feature = "CGError")]
52    #[deprecated = "No longer supported"]
53    pub fn CGRegisterScreenRefreshCallback(
54        callback: CGScreenRefreshCallback,
55        user_info: *mut c_void,
56    ) -> CGError;
57}
58
59extern "C-unwind" {
60    /// # Safety
61    ///
62    /// - `callback` must be implemented correctly.
63    /// - `user_info` must be a valid pointer or null.
64    #[deprecated = "No longer supported"]
65    pub fn CGUnregisterScreenRefreshCallback(
66        callback: CGScreenRefreshCallback,
67        user_info: *mut c_void,
68    );
69}
70
71extern "C-unwind" {
72    /// # Safety
73    ///
74    /// - `rects` must be a valid pointer or null.
75    /// - `count` must be a valid pointer or null.
76    #[cfg(feature = "CGError")]
77    #[deprecated = "No longer supported"]
78    pub fn CGWaitForScreenRefreshRects(rects: *mut *mut CGRect, count: *mut u32) -> CGError;
79}
80
81/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscreenupdateoperation?language=objc)
82// NS_OPTIONS
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct CGScreenUpdateOperation(pub u32);
86bitflags::bitflags! {
87    impl CGScreenUpdateOperation: u32 {
88        #[doc(alias = "kCGScreenUpdateOperationRefresh")]
89        const Refresh = 0;
90        #[doc(alias = "kCGScreenUpdateOperationMove")]
91        const Move = 1<<0;
92        #[doc(alias = "kCGScreenUpdateOperationReducedDirtyRectangleCount")]
93        const ReducedDirtyRectangleCount = 1<<31;
94    }
95}
96
97#[cfg(feature = "objc2")]
98unsafe impl Encode for CGScreenUpdateOperation {
99    const ENCODING: Encoding = u32::ENCODING;
100}
101
102#[cfg(feature = "objc2")]
103unsafe impl RefEncode for CGScreenUpdateOperation {
104    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
105}
106
107/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscreenupdatemovedelta?language=objc)
108#[repr(C)]
109#[derive(Clone, Copy, Debug, PartialEq)]
110pub struct CGScreenUpdateMoveDelta {
111    pub dX: i32,
112    pub dY: i32,
113}
114
115#[cfg(feature = "objc2")]
116unsafe impl Encode for CGScreenUpdateMoveDelta {
117    const ENCODING: Encoding = Encoding::Struct(
118        "CGScreenUpdateMoveDelta",
119        &[<i32>::ENCODING, <i32>::ENCODING],
120    );
121}
122
123#[cfg(feature = "objc2")]
124unsafe impl RefEncode for CGScreenUpdateMoveDelta {
125    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
126}
127
128/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgscreenupdatemovecallback?language=objc)
129pub type CGScreenUpdateMoveCallback = Option<
130    unsafe extern "C-unwind" fn(CGScreenUpdateMoveDelta, usize, NonNull<CGRect>, *mut c_void),
131>;
132
133extern "C-unwind" {
134    /// # Safety
135    ///
136    /// - `callback` must be implemented correctly.
137    /// - `user_info` must be a valid pointer or null.
138    #[cfg(feature = "CGError")]
139    #[deprecated = "No longer supported"]
140    pub fn CGScreenRegisterMoveCallback(
141        callback: CGScreenUpdateMoveCallback,
142        user_info: *mut c_void,
143    ) -> CGError;
144}
145
146extern "C-unwind" {
147    /// # Safety
148    ///
149    /// - `callback` must be implemented correctly.
150    /// - `user_info` must be a valid pointer or null.
151    #[deprecated = "No longer supported"]
152    pub fn CGScreenUnregisterMoveCallback(
153        callback: CGScreenUpdateMoveCallback,
154        user_info: *mut c_void,
155    );
156}
157
158extern "C-unwind" {
159    /// # Safety
160    ///
161    /// - `current_operation` must be a valid pointer or null.
162    /// - `rects` must be a valid pointer or null.
163    /// - `rect_count` must be a valid pointer or null.
164    /// - `delta` must be a valid pointer or null.
165    #[cfg(feature = "CGError")]
166    #[deprecated = "No longer supported"]
167    pub fn CGWaitForScreenUpdateRects(
168        requested_operations: CGScreenUpdateOperation,
169        current_operation: *mut CGScreenUpdateOperation,
170        rects: *mut *mut CGRect,
171        rect_count: *mut usize,
172        delta: *mut CGScreenUpdateMoveDelta,
173    ) -> CGError;
174}
175
176extern "C-unwind" {
177    /// # Safety
178    ///
179    /// `rects` must be a valid pointer or null.
180    #[deprecated = "No longer supported"]
181    pub fn CGReleaseScreenRefreshRects(rects: *mut CGRect);
182}
183
184#[cfg(feature = "libc")]
185#[deprecated = "No longer supported"]
186#[inline]
187pub extern "C-unwind" fn CGCursorIsVisible() -> bool {
188    extern "C-unwind" {
189        fn CGCursorIsVisible() -> libc::boolean_t;
190    }
191    let ret = unsafe { CGCursorIsVisible() };
192    ret != 0
193}
194
195#[cfg(feature = "libc")]
196#[deprecated = "No longer supported"]
197#[inline]
198pub extern "C-unwind" fn CGCursorIsDrawnInFramebuffer() -> bool {
199    extern "C-unwind" {
200        fn CGCursorIsDrawnInFramebuffer() -> libc::boolean_t;
201    }
202    let ret = unsafe { CGCursorIsDrawnInFramebuffer() };
203    ret != 0
204}
205
206#[cfg(feature = "CGError")]
207#[inline]
208pub extern "C-unwind" fn CGWarpMouseCursorPosition(new_cursor_position: CGPoint) -> CGError {
209    extern "C-unwind" {
210        fn CGWarpMouseCursorPosition(new_cursor_position: CGPoint) -> CGError;
211    }
212    unsafe { CGWarpMouseCursorPosition(new_cursor_position) }
213}
214
215#[cfg(all(feature = "CGError", feature = "libc"))]
216#[inline]
217pub extern "C-unwind" fn CGAssociateMouseAndMouseCursorPosition(connected: bool) -> CGError {
218    extern "C-unwind" {
219        fn CGAssociateMouseAndMouseCursorPosition(connected: libc::boolean_t) -> CGError;
220    }
221    unsafe { CGAssociateMouseAndMouseCursorPosition(connected as _) }
222}
223
224#[inline]
225pub extern "C-unwind" fn CGWindowServerCreateServerPort() -> Option<CFRetained<CFMachPort>> {
226    extern "C-unwind" {
227        fn CGWindowServerCreateServerPort() -> Option<NonNull<CFMachPort>>;
228    }
229    let ret = unsafe { CGWindowServerCreateServerPort() };
230    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
231}
232
233#[cfg(all(feature = "CGError", feature = "libc"))]
234#[deprecated = "No longer supported"]
235#[inline]
236pub extern "C-unwind" fn CGEnableEventStateCombining(combine_state: bool) -> CGError {
237    extern "C-unwind" {
238        fn CGEnableEventStateCombining(combine_state: libc::boolean_t) -> CGError;
239    }
240    unsafe { CGEnableEventStateCombining(combine_state as _) }
241}
242
243#[cfg(all(feature = "CGError", feature = "libc"))]
244#[deprecated = "No longer supported"]
245#[inline]
246pub extern "C-unwind" fn CGInhibitLocalEvents(inhibit: bool) -> CGError {
247    extern "C-unwind" {
248        fn CGInhibitLocalEvents(inhibit: libc::boolean_t) -> CGError;
249    }
250    unsafe { CGInhibitLocalEvents(inhibit as _) }
251}
252
253#[cfg(all(feature = "CGError", feature = "libc"))]
254#[deprecated = "No longer supported"]
255#[inline]
256pub extern "C-unwind" fn CGPostKeyboardEvent(
257    key_char: CGCharCode,
258    virtual_key: CGKeyCode,
259    key_down: bool,
260) -> CGError {
261    extern "C-unwind" {
262        fn CGPostKeyboardEvent(
263            key_char: CGCharCode,
264            virtual_key: CGKeyCode,
265            key_down: libc::boolean_t,
266        ) -> CGError;
267    }
268    unsafe { CGPostKeyboardEvent(key_char, virtual_key, key_down as _) }
269}
270
271/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventfiltermask?language=objc)
272// NS_OPTIONS
273#[repr(transparent)]
274#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
275pub struct CGEventFilterMask(pub u32);
276bitflags::bitflags! {
277    impl CGEventFilterMask: u32 {
278        #[doc(alias = "kCGEventFilterMaskPermitLocalMouseEvents")]
279        const PermitLocalMouseEvents = 0x00000001;
280        #[doc(alias = "kCGEventFilterMaskPermitLocalKeyboardEvents")]
281        const PermitLocalKeyboardEvents = 0x00000002;
282        #[doc(alias = "kCGEventFilterMaskPermitSystemDefinedEvents")]
283        const PermitSystemDefinedEvents = 0x00000004;
284    }
285}
286
287#[cfg(feature = "objc2")]
288unsafe impl Encode for CGEventFilterMask {
289    const ENCODING: Encoding = u32::ENCODING;
290}
291
292#[cfg(feature = "objc2")]
293unsafe impl RefEncode for CGEventFilterMask {
294    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
295}
296
297/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgeventsuppressionstate?language=objc)
298// NS_ENUM
299#[repr(transparent)]
300#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
301pub struct CGEventSuppressionState(pub u32);
302impl CGEventSuppressionState {
303    #[doc(alias = "kCGEventSuppressionStateSuppressionInterval")]
304    pub const EventSuppressionStateSuppressionInterval: Self = Self(0);
305    #[doc(alias = "kCGEventSuppressionStateRemoteMouseDrag")]
306    pub const EventSuppressionStateRemoteMouseDrag: Self = Self(1);
307    #[doc(alias = "kCGNumberOfEventSuppressionStates")]
308    pub const NumberOfEventSuppressionStates: Self = Self(2);
309}
310
311#[cfg(feature = "objc2")]
312unsafe impl Encode for CGEventSuppressionState {
313    const ENCODING: Encoding = u32::ENCODING;
314}
315
316#[cfg(feature = "objc2")]
317unsafe impl RefEncode for CGEventSuppressionState {
318    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
319}
320
321#[cfg(feature = "CGError")]
322#[deprecated = "No longer supported"]
323#[inline]
324pub extern "C-unwind" fn CGSetLocalEventsFilterDuringSuppressionState(
325    filter: CGEventFilterMask,
326    state: CGEventSuppressionState,
327) -> CGError {
328    extern "C-unwind" {
329        fn CGSetLocalEventsFilterDuringSuppressionState(
330            filter: CGEventFilterMask,
331            state: CGEventSuppressionState,
332        ) -> CGError;
333    }
334    unsafe { CGSetLocalEventsFilterDuringSuppressionState(filter, state) }
335}
336
337#[cfg(feature = "CGError")]
338#[deprecated = "No longer supported"]
339#[inline]
340pub extern "C-unwind" fn CGSetLocalEventsSuppressionInterval(seconds: CFTimeInterval) -> CGError {
341    extern "C-unwind" {
342        fn CGSetLocalEventsSuppressionInterval(seconds: CFTimeInterval) -> CGError;
343    }
344    unsafe { CGSetLocalEventsSuppressionInterval(seconds) }
345}
346
347#[deprecated = "No longer supported"]
348#[inline]
349pub extern "C-unwind" fn CGWindowServerCFMachPort() -> Option<CFRetained<CFMachPort>> {
350    extern "C-unwind" {
351        fn CGWindowServerCFMachPort() -> Option<NonNull<CFMachPort>>;
352    }
353    let ret = unsafe { CGWindowServerCFMachPort() };
354    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
355}
356
357/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgrectcount?language=objc)
358pub type CGRectCount = u32;