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")]
34 pub fn CGBeginDisplayConfiguration(config: *mut CGDisplayConfigRef) -> CGError;
35}
36
37extern "C-unwind" {
38 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
42 pub fn CGConfigureDisplayOrigin(
43 config: CGDisplayConfigRef,
44 display: CGDirectDisplayID,
45 x: i32,
46 y: i32,
47 ) -> CGError;
48}
49
50extern "C-unwind" {
51 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
56 pub fn CGConfigureDisplayWithDisplayMode(
57 config: CGDisplayConfigRef,
58 display: CGDirectDisplayID,
59 mode: Option<&CGDisplayMode>,
60 options: Option<&CFDictionary>,
61 ) -> CGError;
62}
63
64#[cfg(all(feature = "CGDirectDisplay", feature = "CGError", feature = "libc"))]
68#[inline]
69pub unsafe extern "C-unwind" fn CGConfigureDisplayStereoOperation(
70 config: CGDisplayConfigRef,
71 display: CGDirectDisplayID,
72 stereo: bool,
73 force_blue_line: bool,
74) -> CGError {
75 extern "C-unwind" {
76 fn CGConfigureDisplayStereoOperation(
77 config: CGDisplayConfigRef,
78 display: CGDirectDisplayID,
79 stereo: libc::boolean_t,
80 force_blue_line: libc::boolean_t,
81 ) -> CGError;
82 }
83 unsafe { CGConfigureDisplayStereoOperation(config, display, stereo as _, force_blue_line as _) }
84}
85
86extern "C-unwind" {
87 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
91 pub fn CGConfigureDisplayMirrorOfDisplay(
92 config: CGDisplayConfigRef,
93 display: CGDirectDisplayID,
94 master: CGDirectDisplayID,
95 ) -> CGError;
96}
97
98extern "C-unwind" {
99 #[cfg(feature = "CGError")]
103 pub fn CGCancelDisplayConfiguration(config: CGDisplayConfigRef) -> CGError;
104}
105
106#[repr(transparent)]
109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
110pub struct CGConfigureOption(pub u32);
111bitflags::bitflags! {
112 impl CGConfigureOption: u32 {
113 #[doc(alias = "kCGConfigureForAppOnly")]
114 const ForAppOnly = 0;
115 #[doc(alias = "kCGConfigureForSession")]
116 const ForSession = 1;
117 #[doc(alias = "kCGConfigurePermanently")]
118 const Permanently = 2;
119 }
120}
121
122#[cfg(feature = "objc2")]
123unsafe impl Encode for CGConfigureOption {
124 const ENCODING: Encoding = u32::ENCODING;
125}
126
127#[cfg(feature = "objc2")]
128unsafe impl RefEncode for CGConfigureOption {
129 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
130}
131
132extern "C-unwind" {
133 #[cfg(feature = "CGError")]
137 pub fn CGCompleteDisplayConfiguration(
138 config: CGDisplayConfigRef,
139 option: CGConfigureOption,
140 ) -> CGError;
141}
142
143#[inline]
144pub extern "C-unwind" fn CGRestorePermanentDisplayConfiguration() {
145 extern "C-unwind" {
146 fn CGRestorePermanentDisplayConfiguration();
147 }
148 unsafe { CGRestorePermanentDisplayConfiguration() }
149}
150
151#[repr(transparent)]
154#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
155pub struct CGDisplayChangeSummaryFlags(pub u32);
156bitflags::bitflags! {
157 impl CGDisplayChangeSummaryFlags: u32 {
158 #[doc(alias = "kCGDisplayBeginConfigurationFlag")]
159 const BeginConfigurationFlag = 1<<0;
160 #[doc(alias = "kCGDisplayMovedFlag")]
161 const MovedFlag = 1<<1;
162 #[doc(alias = "kCGDisplaySetMainFlag")]
163 const SetMainFlag = 1<<2;
164 #[doc(alias = "kCGDisplaySetModeFlag")]
165 const SetModeFlag = 1<<3;
166 #[doc(alias = "kCGDisplayAddFlag")]
167 const AddFlag = 1<<4;
168 #[doc(alias = "kCGDisplayRemoveFlag")]
169 const RemoveFlag = 1<<5;
170 #[doc(alias = "kCGDisplayEnabledFlag")]
171 const EnabledFlag = 1<<8;
172 #[doc(alias = "kCGDisplayDisabledFlag")]
173 const DisabledFlag = 1<<9;
174 #[doc(alias = "kCGDisplayMirrorFlag")]
175 const MirrorFlag = 1<<10;
176 #[doc(alias = "kCGDisplayUnMirrorFlag")]
177 const UnMirrorFlag = 1<<11;
178 #[doc(alias = "kCGDisplayDesktopShapeChangedFlag")]
179 const DesktopShapeChangedFlag = 1<<12;
180 }
181}
182
183#[cfg(feature = "objc2")]
184unsafe impl Encode for CGDisplayChangeSummaryFlags {
185 const ENCODING: Encoding = u32::ENCODING;
186}
187
188#[cfg(feature = "objc2")]
189unsafe impl RefEncode for CGDisplayChangeSummaryFlags {
190 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
191}
192
193#[cfg(feature = "CGDirectDisplay")]
195pub type CGDisplayReconfigurationCallBack = Option<
196 unsafe extern "C-unwind" fn(CGDirectDisplayID, CGDisplayChangeSummaryFlags, *mut c_void),
197>;
198
199extern "C-unwind" {
200 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
205 pub fn CGDisplayRegisterReconfigurationCallback(
206 callback: CGDisplayReconfigurationCallBack,
207 user_info: *mut c_void,
208 ) -> CGError;
209}
210
211extern "C-unwind" {
212 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
217 pub fn CGDisplayRemoveReconfigurationCallback(
218 callback: CGDisplayReconfigurationCallBack,
219 user_info: *mut c_void,
220 ) -> CGError;
221}
222
223#[cfg(all(feature = "CGDirectDisplay", feature = "CGError", feature = "libc"))]
224#[inline]
225pub extern "C-unwind" fn CGDisplaySetStereoOperation(
226 display: CGDirectDisplayID,
227 stereo: bool,
228 force_blue_line: bool,
229 option: CGConfigureOption,
230) -> CGError {
231 extern "C-unwind" {
232 fn CGDisplaySetStereoOperation(
233 display: CGDirectDisplayID,
234 stereo: libc::boolean_t,
235 force_blue_line: libc::boolean_t,
236 option: CGConfigureOption,
237 ) -> CGError;
238 }
239 unsafe { CGDisplaySetStereoOperation(display, stereo as _, force_blue_line as _, option) }
240}
241
242#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
243#[inline]
244pub extern "C-unwind" fn CGDisplayIsActive(display: CGDirectDisplayID) -> bool {
245 extern "C-unwind" {
246 fn CGDisplayIsActive(display: CGDirectDisplayID) -> libc::boolean_t;
247 }
248 let ret = unsafe { CGDisplayIsActive(display) };
249 ret != 0
250}
251
252#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
253#[inline]
254pub extern "C-unwind" fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> bool {
255 extern "C-unwind" {
256 fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> libc::boolean_t;
257 }
258 let ret = unsafe { CGDisplayIsAsleep(display) };
259 ret != 0
260}
261
262#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
263#[inline]
264pub extern "C-unwind" fn CGDisplayIsOnline(display: CGDirectDisplayID) -> bool {
265 extern "C-unwind" {
266 fn CGDisplayIsOnline(display: CGDirectDisplayID) -> libc::boolean_t;
267 }
268 let ret = unsafe { CGDisplayIsOnline(display) };
269 ret != 0
270}
271
272#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
273#[inline]
274pub extern "C-unwind" fn CGDisplayIsMain(display: CGDirectDisplayID) -> bool {
275 extern "C-unwind" {
276 fn CGDisplayIsMain(display: CGDirectDisplayID) -> libc::boolean_t;
277 }
278 let ret = unsafe { CGDisplayIsMain(display) };
279 ret != 0
280}
281
282#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
283#[inline]
284pub extern "C-unwind" fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> bool {
285 extern "C-unwind" {
286 fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> libc::boolean_t;
287 }
288 let ret = unsafe { CGDisplayIsBuiltin(display) };
289 ret != 0
290}
291
292#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
293#[inline]
294pub extern "C-unwind" fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> bool {
295 extern "C-unwind" {
296 fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
297 }
298 let ret = unsafe { CGDisplayIsInMirrorSet(display) };
299 ret != 0
300}
301
302#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
303#[inline]
304pub extern "C-unwind" fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> bool {
305 extern "C-unwind" {
306 fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
307 }
308 let ret = unsafe { CGDisplayIsAlwaysInMirrorSet(display) };
309 ret != 0
310}
311
312#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
313#[inline]
314pub extern "C-unwind" fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> bool {
315 extern "C-unwind" {
316 fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> libc::boolean_t;
317 }
318 let ret = unsafe { CGDisplayIsInHWMirrorSet(display) };
319 ret != 0
320}
321
322#[cfg(feature = "CGDirectDisplay")]
323#[inline]
324pub extern "C-unwind" fn CGDisplayMirrorsDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID {
325 extern "C-unwind" {
326 fn CGDisplayMirrorsDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
327 }
328 unsafe { CGDisplayMirrorsDisplay(display) }
329}
330
331#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
332#[inline]
333pub extern "C-unwind" fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> bool {
334 extern "C-unwind" {
335 fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> libc::boolean_t;
336 }
337 let ret = unsafe { CGDisplayUsesOpenGLAcceleration(display) };
338 ret != 0
339}
340
341#[cfg(all(feature = "CGDirectDisplay", feature = "libc"))]
342#[inline]
343pub extern "C-unwind" fn CGDisplayIsStereo(display: CGDirectDisplayID) -> bool {
344 extern "C-unwind" {
345 fn CGDisplayIsStereo(display: CGDirectDisplayID) -> libc::boolean_t;
346 }
347 let ret = unsafe { CGDisplayIsStereo(display) };
348 ret != 0
349}
350
351#[cfg(feature = "CGDirectDisplay")]
352#[inline]
353pub extern "C-unwind" fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID {
354 extern "C-unwind" {
355 fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
356 }
357 unsafe { CGDisplayPrimaryDisplay(display) }
358}
359
360#[cfg(feature = "CGDirectDisplay")]
361#[inline]
362pub extern "C-unwind" fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> u32 {
363 extern "C-unwind" {
364 fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> u32;
365 }
366 unsafe { CGDisplayUnitNumber(display) }
367}
368
369#[cfg(feature = "CGDirectDisplay")]
370#[inline]
371pub extern "C-unwind" fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> u32 {
372 extern "C-unwind" {
373 fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> u32;
374 }
375 unsafe { CGDisplayVendorNumber(display) }
376}
377
378#[cfg(feature = "CGDirectDisplay")]
379#[inline]
380pub extern "C-unwind" fn CGDisplayModelNumber(display: CGDirectDisplayID) -> u32 {
381 extern "C-unwind" {
382 fn CGDisplayModelNumber(display: CGDirectDisplayID) -> u32;
383 }
384 unsafe { CGDisplayModelNumber(display) }
385}
386
387#[cfg(feature = "CGDirectDisplay")]
388#[inline]
389pub extern "C-unwind" fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> u32 {
390 extern "C-unwind" {
391 fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> u32;
392 }
393 unsafe { CGDisplaySerialNumber(display) }
394}
395
396#[cfg(feature = "CGDirectDisplay")]
397#[inline]
398pub extern "C-unwind" fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize {
399 extern "C-unwind" {
400 fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize;
401 }
402 unsafe { CGDisplayScreenSize(display) }
403}
404
405#[cfg(feature = "CGDirectDisplay")]
406#[inline]
407pub extern "C-unwind" fn CGDisplayRotation(display: CGDirectDisplayID) -> c_double {
408 extern "C-unwind" {
409 fn CGDisplayRotation(display: CGDirectDisplayID) -> c_double;
410 }
411 unsafe { CGDisplayRotation(display) }
412}
413
414#[cfg(all(feature = "CGColorSpace", feature = "CGDirectDisplay"))]
415#[inline]
416pub extern "C-unwind" fn CGDisplayCopyColorSpace(
417 display: CGDirectDisplayID,
418) -> CFRetained<CGColorSpace> {
419 extern "C-unwind" {
420 fn CGDisplayCopyColorSpace(display: CGDirectDisplayID) -> Option<NonNull<CGColorSpace>>;
421 }
422 let ret = unsafe { CGDisplayCopyColorSpace(display) };
423 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
424 unsafe { CFRetained::from_raw(ret) }
425}
426
427extern "C-unwind" {
428 #[cfg(all(feature = "CGDirectDisplay", feature = "CGError"))]
433 #[deprecated = "No longer supported"]
434 pub fn CGConfigureDisplayMode(
435 config: CGDisplayConfigRef,
436 display: CGDirectDisplayID,
437 mode: Option<&CFDictionary>,
438 ) -> CGError;
439}