objc2_core_graphics/generated/
CGDisplayConfiguration.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[repr(C)]
15#[derive(Debug)]
16pub struct _CGDisplayConfigRef {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21#[cfg(feature = "objc2")]
22unsafe impl RefEncode for _CGDisplayConfigRef {
23 const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("_CGDisplayConfigRef", &[]));
24}
25
26pub type CGDisplayConfigRef = *mut _CGDisplayConfigRef;
28
29extern "C-unwind" {
30 #[cfg(feature = "CGError")]
31 pub fn CGBeginDisplayConfiguration(config: *mut CGDisplayConfigRef) -> CGError;
32}
33
34extern "C-unwind" {
35 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
36 pub fn CGConfigureDisplayOrigin(
37 config: CGDisplayConfigRef,
38 display: CGDirectDisplayID,
39 x: i32,
40 y: i32,
41 ) -> CGError;
42}
43
44extern "C-unwind" {
45 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
46 pub fn CGConfigureDisplayWithDisplayMode(
47 config: CGDisplayConfigRef,
48 display: CGDirectDisplayID,
49 mode: Option<&CGDisplayMode>,
50 options: Option<&CFDictionary>,
51 ) -> CGError;
52}
53
54#[cfg(all(feature = "CGDirectDisplay", feature = "CGError", feature = "libc"))]
55#[inline]
56pub unsafe extern "C-unwind" fn CGConfigureDisplayStereoOperation(
57 config: CGDisplayConfigRef,
58 display: CGDirectDisplayID,
59 stereo: bool,
60 force_blue_line: bool,
61) -> CGError {
62 extern "C-unwind" {
63 fn CGConfigureDisplayStereoOperation(
64 config: CGDisplayConfigRef,
65 display: CGDirectDisplayID,
66 stereo: libc::boolean_t,
67 force_blue_line: libc::boolean_t,
68 ) -> CGError;
69 }
70 unsafe { CGConfigureDisplayStereoOperation(config, display, stereo as _, force_blue_line as _) }
71}
72
73extern "C-unwind" {
74 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
75 pub fn CGConfigureDisplayMirrorOfDisplay(
76 config: CGDisplayConfigRef,
77 display: CGDirectDisplayID,
78 master: CGDirectDisplayID,
79 ) -> CGError;
80}
81
82extern "C-unwind" {
83 #[cfg(feature = "CGError")]
84 pub fn CGCancelDisplayConfiguration(config: CGDisplayConfigRef) -> CGError;
85}
86
87#[repr(transparent)]
90#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
91pub struct CGConfigureOption(pub u32);
92bitflags::bitflags! {
93 impl CGConfigureOption: u32 {
94 #[doc(alias = "kCGConfigureForAppOnly")]
95 const ForAppOnly = 0;
96 #[doc(alias = "kCGConfigureForSession")]
97 const ForSession = 1;
98 #[doc(alias = "kCGConfigurePermanently")]
99 const Permanently = 2;
100 }
101}
102
103#[cfg(feature = "objc2")]
104unsafe impl Encode for CGConfigureOption {
105 const ENCODING: Encoding = u32::ENCODING;
106}
107
108#[cfg(feature = "objc2")]
109unsafe impl RefEncode for CGConfigureOption {
110 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
111}
112
113extern "C-unwind" {
114 #[cfg(feature = "CGError")]
115 pub fn CGCompleteDisplayConfiguration(
116 config: CGDisplayConfigRef,
117 option: CGConfigureOption,
118 ) -> CGError;
119}
120
121extern "C-unwind" {
122 pub fn CGRestorePermanentDisplayConfiguration();
123}
124
125#[repr(transparent)]
128#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
129pub struct CGDisplayChangeSummaryFlags(pub u32);
130bitflags::bitflags! {
131 impl CGDisplayChangeSummaryFlags: u32 {
132 #[doc(alias = "kCGDisplayBeginConfigurationFlag")]
133 const BeginConfigurationFlag = 1<<0;
134 #[doc(alias = "kCGDisplayMovedFlag")]
135 const MovedFlag = 1<<1;
136 #[doc(alias = "kCGDisplaySetMainFlag")]
137 const SetMainFlag = 1<<2;
138 #[doc(alias = "kCGDisplaySetModeFlag")]
139 const SetModeFlag = 1<<3;
140 #[doc(alias = "kCGDisplayAddFlag")]
141 const AddFlag = 1<<4;
142 #[doc(alias = "kCGDisplayRemoveFlag")]
143 const RemoveFlag = 1<<5;
144 #[doc(alias = "kCGDisplayEnabledFlag")]
145 const EnabledFlag = 1<<8;
146 #[doc(alias = "kCGDisplayDisabledFlag")]
147 const DisabledFlag = 1<<9;
148 #[doc(alias = "kCGDisplayMirrorFlag")]
149 const MirrorFlag = 1<<10;
150 #[doc(alias = "kCGDisplayUnMirrorFlag")]
151 const UnMirrorFlag = 1<<11;
152 #[doc(alias = "kCGDisplayDesktopShapeChangedFlag")]
153 const DesktopShapeChangedFlag = 1<<12;
154 }
155}
156
157#[cfg(feature = "objc2")]
158unsafe impl Encode for CGDisplayChangeSummaryFlags {
159 const ENCODING: Encoding = u32::ENCODING;
160}
161
162#[cfg(feature = "objc2")]
163unsafe impl RefEncode for CGDisplayChangeSummaryFlags {
164 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
165}
166
167#[cfg(feature = "CGDirectDisplay")]
169pub type CGDisplayReconfigurationCallBack = Option<
170 unsafe extern "C-unwind" fn(CGDirectDisplayID, CGDisplayChangeSummaryFlags, *mut c_void),
171>;
172
173extern "C-unwind" {
174 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
175 pub fn CGDisplayRegisterReconfigurationCallback(
176 callback: CGDisplayReconfigurationCallBack,
177 user_info: *mut c_void,
178 ) -> CGError;
179}
180
181extern "C-unwind" {
182 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
183 pub fn CGDisplayRemoveReconfigurationCallback(
184 callback: CGDisplayReconfigurationCallBack,
185 user_info: *mut c_void,
186 ) -> CGError;
187}
188
189#[cfg(all(feature = "CGDirectDisplay", feature = "CGError", feature = "libc"))]
190#[inline]
191pub unsafe extern "C-unwind" fn CGDisplaySetStereoOperation(
192 display: CGDirectDisplayID,
193 stereo: bool,
194 force_blue_line: bool,
195 option: CGConfigureOption,
196) -> CGError {
197 extern "C-unwind" {
198 fn CGDisplaySetStereoOperation(
199 display: CGDirectDisplayID,
200 stereo: libc::boolean_t,
201 force_blue_line: libc::boolean_t,
202 option: CGConfigureOption,
203 ) -> CGError;
204 }
205 unsafe { CGDisplaySetStereoOperation(display, stereo as _, force_blue_line as _, option) }
206}
207
208#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
209#[inline]
210pub unsafe extern "C-unwind" fn CGDisplayIsActive(display: CGDirectDisplayID) -> bool {
211 extern "C-unwind" {
212 fn CGDisplayIsActive(display: CGDirectDisplayID) -> libc::boolean_t;
213 }
214 let ret = unsafe { CGDisplayIsActive(display) };
215 ret != 0
216}
217
218#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
219#[inline]
220pub unsafe extern "C-unwind" fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> bool {
221 extern "C-unwind" {
222 fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> libc::boolean_t;
223 }
224 let ret = unsafe { CGDisplayIsAsleep(display) };
225 ret != 0
226}
227
228#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
229#[inline]
230pub unsafe extern "C-unwind" fn CGDisplayIsOnline(display: CGDirectDisplayID) -> bool {
231 extern "C-unwind" {
232 fn CGDisplayIsOnline(display: CGDirectDisplayID) -> libc::boolean_t;
233 }
234 let ret = unsafe { CGDisplayIsOnline(display) };
235 ret != 0
236}
237
238#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
239#[inline]
240pub unsafe extern "C-unwind" fn CGDisplayIsMain(display: CGDirectDisplayID) -> bool {
241 extern "C-unwind" {
242 fn CGDisplayIsMain(display: CGDirectDisplayID) -> libc::boolean_t;
243 }
244 let ret = unsafe { CGDisplayIsMain(display) };
245 ret != 0
246}
247
248#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
249#[inline]
250pub unsafe extern "C-unwind" fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> bool {
251 extern "C-unwind" {
252 fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> libc::boolean_t;
253 }
254 let ret = unsafe { CGDisplayIsBuiltin(display) };
255 ret != 0
256}
257
258#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
259#[inline]
260pub unsafe extern "C-unwind" fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> bool {
261 extern "C-unwind" {
262 fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
263 }
264 let ret = unsafe { CGDisplayIsInMirrorSet(display) };
265 ret != 0
266}
267
268#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
269#[inline]
270pub unsafe extern "C-unwind" fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> bool {
271 extern "C-unwind" {
272 fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
273 }
274 let ret = unsafe { CGDisplayIsAlwaysInMirrorSet(display) };
275 ret != 0
276}
277
278#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
279#[inline]
280pub unsafe extern "C-unwind" fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> bool {
281 extern "C-unwind" {
282 fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
283 }
284 let ret = unsafe { CGDisplayIsInHWMirrorSet(display) };
285 ret != 0
286}
287
288extern "C-unwind" {
289 #[cfg(feature = "CGDirectDisplay")]
290 pub fn CGDisplayMirrorsDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
291}
292
293#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
294#[inline]
295pub unsafe extern "C-unwind" fn CGDisplayUsesOpenGLAcceleration(
296 display: CGDirectDisplayID,
297) -> bool {
298 extern "C-unwind" {
299 fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> libc::boolean_t;
300 }
301 let ret = unsafe { CGDisplayUsesOpenGLAcceleration(display) };
302 ret != 0
303}
304
305#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
306#[inline]
307pub unsafe extern "C-unwind" fn CGDisplayIsStereo(display: CGDirectDisplayID) -> bool {
308 extern "C-unwind" {
309 fn CGDisplayIsStereo(display: CGDirectDisplayID) -> libc::boolean_t;
310 }
311 let ret = unsafe { CGDisplayIsStereo(display) };
312 ret != 0
313}
314
315extern "C-unwind" {
316 #[cfg(feature = "CGDirectDisplay")]
317 pub fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
318}
319
320extern "C-unwind" {
321 #[cfg(feature = "CGDirectDisplay")]
322 pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> u32;
323}
324
325extern "C-unwind" {
326 #[cfg(feature = "CGDirectDisplay")]
327 pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> u32;
328}
329
330extern "C-unwind" {
331 #[cfg(feature = "CGDirectDisplay")]
332 pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> u32;
333}
334
335extern "C-unwind" {
336 #[cfg(feature = "CGDirectDisplay")]
337 pub fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> u32;
338}
339
340extern "C-unwind" {
341 #[cfg(feature = "CGDirectDisplay")]
342 pub fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize;
343}
344
345extern "C-unwind" {
346 #[cfg(feature = "CGDirectDisplay")]
347 pub fn CGDisplayRotation(display: CGDirectDisplayID) -> c_double;
348}
349
350#[cfg(all(feature = "CGColorSpace", feature = "CGDirectDisplay"))]
351#[inline]
352pub unsafe extern "C-unwind" fn CGDisplayCopyColorSpace(
353 display: CGDirectDisplayID,
354) -> CFRetained<CGColorSpace> {
355 extern "C-unwind" {
356 fn CGDisplayCopyColorSpace(display: CGDirectDisplayID) -> Option<NonNull<CGColorSpace>>;
357 }
358 let ret = unsafe { CGDisplayCopyColorSpace(display) };
359 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
360 unsafe { CFRetained::from_raw(ret) }
361}
362
363extern "C-unwind" {
364 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
365 #[deprecated = "No longer supported"]
366 pub fn CGConfigureDisplayMode(
367 config: CGDisplayConfigRef,
368 display: CGDirectDisplayID,
369 mode: Option<&CFDictionary>,
370 ) -> CGError;
371}