objc2_core_graphics/generated/
CGDirectDisplay.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
13pub const kCGNullDirectDisplay: CGDirectDisplayID = 0;
15pub type CGDirectDisplayID = u32;
17
18pub type CGOpenGLDisplayMask = u32;
20
21pub type CGRefreshRate = c_double;
23
24#[doc(alias = "CGDisplayModeRef")]
26#[repr(C)]
27pub struct CGDisplayMode {
28 inner: [u8; 0],
29 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
30}
31
32cf_type!(
33 unsafe impl CGDisplayMode {}
34);
35#[cfg(feature = "objc2")]
36cf_objc2_type!(
37 unsafe impl RefEncode<"CGDisplayMode"> for CGDisplayMode {}
38);
39
40#[inline]
41pub extern "C-unwind" fn CGMainDisplayID() -> CGDirectDisplayID {
42 extern "C-unwind" {
43 fn CGMainDisplayID() -> CGDirectDisplayID;
44 }
45 unsafe { CGMainDisplayID() }
46}
47
48extern "C-unwind" {
49 #[cfg(feature = "CGError")]
54 pub fn CGGetDisplaysWithPoint(
55 point: CGPoint,
56 max_displays: u32,
57 displays: *mut CGDirectDisplayID,
58 matching_display_count: *mut u32,
59 ) -> CGError;
60}
61
62extern "C-unwind" {
63 #[cfg(feature = "CGError")]
68 pub fn CGGetDisplaysWithRect(
69 rect: CGRect,
70 max_displays: u32,
71 displays: *mut CGDirectDisplayID,
72 matching_display_count: *mut u32,
73 ) -> CGError;
74}
75
76extern "C-unwind" {
77 #[cfg(feature = "CGError")]
82 pub fn CGGetDisplaysWithOpenGLDisplayMask(
83 mask: CGOpenGLDisplayMask,
84 max_displays: u32,
85 displays: *mut CGDirectDisplayID,
86 matching_display_count: *mut u32,
87 ) -> CGError;
88}
89
90extern "C-unwind" {
91 #[cfg(feature = "CGError")]
96 pub fn CGGetActiveDisplayList(
97 max_displays: u32,
98 active_displays: *mut CGDirectDisplayID,
99 display_count: *mut u32,
100 ) -> CGError;
101}
102
103extern "C-unwind" {
104 #[cfg(feature = "CGError")]
109 pub fn CGGetOnlineDisplayList(
110 max_displays: u32,
111 online_displays: *mut CGDirectDisplayID,
112 display_count: *mut u32,
113 ) -> CGError;
114}
115
116#[inline]
117pub extern "C-unwind" fn CGDisplayIDToOpenGLDisplayMask(
118 display: CGDirectDisplayID,
119) -> CGOpenGLDisplayMask {
120 extern "C-unwind" {
121 fn CGDisplayIDToOpenGLDisplayMask(display: CGDirectDisplayID) -> CGOpenGLDisplayMask;
122 }
123 unsafe { CGDisplayIDToOpenGLDisplayMask(display) }
124}
125
126#[inline]
127pub extern "C-unwind" fn CGOpenGLDisplayMaskToDisplayID(
128 mask: CGOpenGLDisplayMask,
129) -> CGDirectDisplayID {
130 extern "C-unwind" {
131 fn CGOpenGLDisplayMaskToDisplayID(mask: CGOpenGLDisplayMask) -> CGDirectDisplayID;
132 }
133 unsafe { CGOpenGLDisplayMaskToDisplayID(mask) }
134}
135
136#[inline]
137pub extern "C-unwind" fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect {
138 extern "C-unwind" {
139 fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
140 }
141 unsafe { CGDisplayBounds(display) }
142}
143
144#[inline]
145pub extern "C-unwind" fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> usize {
146 extern "C-unwind" {
147 fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> usize;
148 }
149 unsafe { CGDisplayPixelsWide(display) }
150}
151
152#[inline]
153pub extern "C-unwind" fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> usize {
154 extern "C-unwind" {
155 fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> usize;
156 }
157 unsafe { CGDisplayPixelsHigh(display) }
158}
159
160#[inline]
164pub unsafe extern "C-unwind" fn CGDisplayCopyAllDisplayModes(
165 display: CGDirectDisplayID,
166 options: Option<&CFDictionary>,
167) -> Option<CFRetained<CFArray>> {
168 extern "C-unwind" {
169 fn CGDisplayCopyAllDisplayModes(
170 display: CGDirectDisplayID,
171 options: Option<&CFDictionary>,
172 ) -> Option<NonNull<CFArray>>;
173 }
174 let ret = unsafe { CGDisplayCopyAllDisplayModes(display, options) };
175 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
176}
177
178extern "C" {
179 pub static kCGDisplayShowDuplicateLowResolutionModes: &'static CFString;
181}
182
183#[inline]
184pub extern "C-unwind" fn CGDisplayCopyDisplayMode(
185 display: CGDirectDisplayID,
186) -> Option<CFRetained<CGDisplayMode>> {
187 extern "C-unwind" {
188 fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> Option<NonNull<CGDisplayMode>>;
189 }
190 let ret = unsafe { CGDisplayCopyDisplayMode(display) };
191 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
192}
193
194extern "C-unwind" {
195 #[cfg(feature = "CGError")]
199 pub fn CGDisplaySetDisplayMode(
200 display: CGDirectDisplayID,
201 mode: Option<&CGDisplayMode>,
202 options: Option<&CFDictionary>,
203 ) -> CGError;
204}
205
206impl CGDisplayMode {
207 #[doc(alias = "CGDisplayModeGetWidth")]
208 #[inline]
209 pub fn width(mode: Option<&CGDisplayMode>) -> usize {
210 extern "C-unwind" {
211 fn CGDisplayModeGetWidth(mode: Option<&CGDisplayMode>) -> usize;
212 }
213 unsafe { CGDisplayModeGetWidth(mode) }
214 }
215
216 #[doc(alias = "CGDisplayModeGetHeight")]
217 #[inline]
218 pub fn height(mode: Option<&CGDisplayMode>) -> usize {
219 extern "C-unwind" {
220 fn CGDisplayModeGetHeight(mode: Option<&CGDisplayMode>) -> usize;
221 }
222 unsafe { CGDisplayModeGetHeight(mode) }
223 }
224
225 #[doc(alias = "CGDisplayModeCopyPixelEncoding")]
226 #[deprecated = "No longer supported"]
227 #[inline]
228 pub fn pixel_encoding(mode: Option<&CGDisplayMode>) -> Option<CFRetained<CFString>> {
229 extern "C-unwind" {
230 fn CGDisplayModeCopyPixelEncoding(
231 mode: Option<&CGDisplayMode>,
232 ) -> Option<NonNull<CFString>>;
233 }
234 let ret = unsafe { CGDisplayModeCopyPixelEncoding(mode) };
235 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
236 }
237
238 #[doc(alias = "CGDisplayModeGetRefreshRate")]
239 #[inline]
240 pub fn refresh_rate(mode: Option<&CGDisplayMode>) -> c_double {
241 extern "C-unwind" {
242 fn CGDisplayModeGetRefreshRate(mode: Option<&CGDisplayMode>) -> c_double;
243 }
244 unsafe { CGDisplayModeGetRefreshRate(mode) }
245 }
246
247 #[doc(alias = "CGDisplayModeGetIOFlags")]
248 #[inline]
249 pub fn io_flags(mode: Option<&CGDisplayMode>) -> u32 {
250 extern "C-unwind" {
251 fn CGDisplayModeGetIOFlags(mode: Option<&CGDisplayMode>) -> u32;
252 }
253 unsafe { CGDisplayModeGetIOFlags(mode) }
254 }
255
256 #[doc(alias = "CGDisplayModeGetIODisplayModeID")]
257 #[inline]
258 pub fn io_display_mode_id(mode: Option<&CGDisplayMode>) -> i32 {
259 extern "C-unwind" {
260 fn CGDisplayModeGetIODisplayModeID(mode: Option<&CGDisplayMode>) -> i32;
261 }
262 unsafe { CGDisplayModeGetIODisplayModeID(mode) }
263 }
264
265 #[doc(alias = "CGDisplayModeIsUsableForDesktopGUI")]
266 #[inline]
267 pub fn is_usable_for_desktop_gui(mode: Option<&CGDisplayMode>) -> bool {
268 extern "C-unwind" {
269 fn CGDisplayModeIsUsableForDesktopGUI(mode: Option<&CGDisplayMode>) -> bool;
270 }
271 unsafe { CGDisplayModeIsUsableForDesktopGUI(mode) }
272 }
273}
274
275unsafe impl ConcreteType for CGDisplayMode {
276 #[doc(alias = "CGDisplayModeGetTypeID")]
277 #[inline]
278 fn type_id() -> CFTypeID {
279 extern "C-unwind" {
280 fn CGDisplayModeGetTypeID() -> CFTypeID;
281 }
282 unsafe { CGDisplayModeGetTypeID() }
283 }
284}
285
286impl CGDisplayMode {
287 #[doc(alias = "CGDisplayModeGetPixelWidth")]
288 #[inline]
289 pub fn pixel_width(mode: Option<&CGDisplayMode>) -> usize {
290 extern "C-unwind" {
291 fn CGDisplayModeGetPixelWidth(mode: Option<&CGDisplayMode>) -> usize;
292 }
293 unsafe { CGDisplayModeGetPixelWidth(mode) }
294 }
295
296 #[doc(alias = "CGDisplayModeGetPixelHeight")]
297 #[inline]
298 pub fn pixel_height(mode: Option<&CGDisplayMode>) -> usize {
299 extern "C-unwind" {
300 fn CGDisplayModeGetPixelHeight(mode: Option<&CGDisplayMode>) -> usize;
301 }
302 unsafe { CGDisplayModeGetPixelHeight(mode) }
303 }
304}
305
306pub type CGGammaValue = c_float;
308
309#[cfg(feature = "CGError")]
310#[inline]
311pub extern "C-unwind" fn CGSetDisplayTransferByFormula(
312 display: CGDirectDisplayID,
313 red_min: CGGammaValue,
314 red_max: CGGammaValue,
315 red_gamma: CGGammaValue,
316 green_min: CGGammaValue,
317 green_max: CGGammaValue,
318 green_gamma: CGGammaValue,
319 blue_min: CGGammaValue,
320 blue_max: CGGammaValue,
321 blue_gamma: CGGammaValue,
322) -> CGError {
323 extern "C-unwind" {
324 fn CGSetDisplayTransferByFormula(
325 display: CGDirectDisplayID,
326 red_min: CGGammaValue,
327 red_max: CGGammaValue,
328 red_gamma: CGGammaValue,
329 green_min: CGGammaValue,
330 green_max: CGGammaValue,
331 green_gamma: CGGammaValue,
332 blue_min: CGGammaValue,
333 blue_max: CGGammaValue,
334 blue_gamma: CGGammaValue,
335 ) -> CGError;
336 }
337 unsafe {
338 CGSetDisplayTransferByFormula(
339 display,
340 red_min,
341 red_max,
342 red_gamma,
343 green_min,
344 green_max,
345 green_gamma,
346 blue_min,
347 blue_max,
348 blue_gamma,
349 )
350 }
351}
352
353extern "C-unwind" {
354 #[cfg(feature = "CGError")]
366 pub fn CGGetDisplayTransferByFormula(
367 display: CGDirectDisplayID,
368 red_min: *mut CGGammaValue,
369 red_max: *mut CGGammaValue,
370 red_gamma: *mut CGGammaValue,
371 green_min: *mut CGGammaValue,
372 green_max: *mut CGGammaValue,
373 green_gamma: *mut CGGammaValue,
374 blue_min: *mut CGGammaValue,
375 blue_max: *mut CGGammaValue,
376 blue_gamma: *mut CGGammaValue,
377 ) -> CGError;
378}
379
380#[inline]
381pub extern "C-unwind" fn CGDisplayGammaTableCapacity(display: CGDirectDisplayID) -> u32 {
382 extern "C-unwind" {
383 fn CGDisplayGammaTableCapacity(display: CGDirectDisplayID) -> u32;
384 }
385 unsafe { CGDisplayGammaTableCapacity(display) }
386}
387
388extern "C-unwind" {
389 #[cfg(feature = "CGError")]
395 pub fn CGSetDisplayTransferByTable(
396 display: CGDirectDisplayID,
397 table_size: u32,
398 red_table: *const CGGammaValue,
399 green_table: *const CGGammaValue,
400 blue_table: *const CGGammaValue,
401 ) -> CGError;
402}
403
404extern "C-unwind" {
405 #[cfg(feature = "CGError")]
412 pub fn CGGetDisplayTransferByTable(
413 display: CGDirectDisplayID,
414 capacity: u32,
415 red_table: *mut CGGammaValue,
416 green_table: *mut CGGammaValue,
417 blue_table: *mut CGGammaValue,
418 sample_count: *mut u32,
419 ) -> CGError;
420}
421
422extern "C-unwind" {
423 #[cfg(feature = "CGError")]
429 pub fn CGSetDisplayTransferByByteTable(
430 display: CGDirectDisplayID,
431 table_size: u32,
432 red_table: NonNull<u8>,
433 green_table: NonNull<u8>,
434 blue_table: NonNull<u8>,
435 ) -> CGError;
436}
437
438#[inline]
439pub extern "C-unwind" fn CGDisplayRestoreColorSyncSettings() {
440 extern "C-unwind" {
441 fn CGDisplayRestoreColorSyncSettings();
442 }
443 unsafe { CGDisplayRestoreColorSyncSettings() }
444}
445
446#[repr(transparent)]
449#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
450pub struct CGCaptureOptions(pub u32);
451bitflags::bitflags! {
452 impl CGCaptureOptions: u32 {
453 #[doc(alias = "kCGCaptureNoOptions")]
454 const NoOptions = 0;
455 #[doc(alias = "kCGCaptureNoFill")]
456#[deprecated]
457 const NoFill = 1<<0;
458 }
459}
460
461#[cfg(feature = "objc2")]
462unsafe impl Encode for CGCaptureOptions {
463 const ENCODING: Encoding = u32::ENCODING;
464}
465
466#[cfg(feature = "objc2")]
467unsafe impl RefEncode for CGCaptureOptions {
468 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
469}
470
471#[cfg(feature = "libc")]
472#[deprecated = "No longer supported"]
473#[inline]
474pub extern "C-unwind" fn CGDisplayIsCaptured(display: CGDirectDisplayID) -> bool {
475 extern "C-unwind" {
476 fn CGDisplayIsCaptured(display: CGDirectDisplayID) -> libc::boolean_t;
477 }
478 let ret = unsafe { CGDisplayIsCaptured(display) };
479 ret != 0
480}
481
482#[cfg(feature = "CGError")]
483#[inline]
484pub extern "C-unwind" fn CGDisplayCapture(display: CGDirectDisplayID) -> CGError {
485 extern "C-unwind" {
486 fn CGDisplayCapture(display: CGDirectDisplayID) -> CGError;
487 }
488 unsafe { CGDisplayCapture(display) }
489}
490
491#[cfg(feature = "CGError")]
492#[inline]
493pub extern "C-unwind" fn CGDisplayCaptureWithOptions(
494 display: CGDirectDisplayID,
495 options: CGCaptureOptions,
496) -> CGError {
497 extern "C-unwind" {
498 fn CGDisplayCaptureWithOptions(
499 display: CGDirectDisplayID,
500 options: CGCaptureOptions,
501 ) -> CGError;
502 }
503 unsafe { CGDisplayCaptureWithOptions(display, options) }
504}
505
506#[cfg(feature = "CGError")]
507#[inline]
508pub extern "C-unwind" fn CGDisplayRelease(display: CGDirectDisplayID) -> CGError {
509 extern "C-unwind" {
510 fn CGDisplayRelease(display: CGDirectDisplayID) -> CGError;
511 }
512 unsafe { CGDisplayRelease(display) }
513}
514
515#[cfg(feature = "CGError")]
516#[inline]
517pub extern "C-unwind" fn CGCaptureAllDisplays() -> CGError {
518 extern "C-unwind" {
519 fn CGCaptureAllDisplays() -> CGError;
520 }
521 unsafe { CGCaptureAllDisplays() }
522}
523
524#[cfg(feature = "CGError")]
525#[inline]
526pub extern "C-unwind" fn CGCaptureAllDisplaysWithOptions(options: CGCaptureOptions) -> CGError {
527 extern "C-unwind" {
528 fn CGCaptureAllDisplaysWithOptions(options: CGCaptureOptions) -> CGError;
529 }
530 unsafe { CGCaptureAllDisplaysWithOptions(options) }
531}
532
533#[cfg(feature = "CGError")]
534#[inline]
535pub extern "C-unwind" fn CGReleaseAllDisplays() -> CGError {
536 extern "C-unwind" {
537 fn CGReleaseAllDisplays() -> CGError;
538 }
539 unsafe { CGReleaseAllDisplays() }
540}
541
542#[cfg(feature = "CGWindow")]
543#[inline]
544pub extern "C-unwind" fn CGShieldingWindowID(display: CGDirectDisplayID) -> CGWindowID {
545 extern "C-unwind" {
546 fn CGShieldingWindowID(display: CGDirectDisplayID) -> CGWindowID;
547 }
548 unsafe { CGShieldingWindowID(display) }
549}
550
551#[cfg(feature = "CGWindowLevel")]
552#[inline]
553pub extern "C-unwind" fn CGShieldingWindowLevel() -> CGWindowLevel {
554 extern "C-unwind" {
555 fn CGShieldingWindowLevel() -> CGWindowLevel;
556 }
557 unsafe { CGShieldingWindowLevel() }
558}
559
560#[cfg(feature = "CGImage")]
561#[deprecated = "Please use ScreenCaptureKit instead."]
562#[inline]
563pub extern "C-unwind" fn CGDisplayCreateImage(
564 display_id: CGDirectDisplayID,
565) -> Option<CFRetained<CGImage>> {
566 extern "C-unwind" {
567 fn CGDisplayCreateImage(display_id: CGDirectDisplayID) -> Option<NonNull<CGImage>>;
568 }
569 let ret = unsafe { CGDisplayCreateImage(display_id) };
570 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
571}
572
573#[cfg(feature = "CGImage")]
574#[deprecated = "Please use ScreenCaptureKit instead."]
575#[inline]
576pub extern "C-unwind" fn CGDisplayCreateImageForRect(
577 display: CGDirectDisplayID,
578 rect: CGRect,
579) -> Option<CFRetained<CGImage>> {
580 extern "C-unwind" {
581 fn CGDisplayCreateImageForRect(
582 display: CGDirectDisplayID,
583 rect: CGRect,
584 ) -> Option<NonNull<CGImage>>;
585 }
586 let ret = unsafe { CGDisplayCreateImageForRect(display, rect) };
587 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
588}
589
590#[cfg(feature = "CGError")]
591#[inline]
592pub extern "C-unwind" fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError {
593 extern "C-unwind" {
594 fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError;
595 }
596 unsafe { CGDisplayHideCursor(display) }
597}
598
599#[cfg(feature = "CGError")]
600#[inline]
601pub extern "C-unwind" fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError {
602 extern "C-unwind" {
603 fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError;
604 }
605 unsafe { CGDisplayShowCursor(display) }
606}
607
608#[cfg(feature = "CGError")]
609#[inline]
610pub extern "C-unwind" fn CGDisplayMoveCursorToPoint(
611 display: CGDirectDisplayID,
612 point: CGPoint,
613) -> CGError {
614 extern "C-unwind" {
615 fn CGDisplayMoveCursorToPoint(display: CGDirectDisplayID, point: CGPoint) -> CGError;
616 }
617 unsafe { CGDisplayMoveCursorToPoint(display, point) }
618}
619
620extern "C-unwind" {
621 pub fn CGGetLastMouseDelta(delta_x: *mut i32, delta_y: *mut i32);
626}
627
628#[cfg(feature = "CGContext")]
629#[inline]
630pub extern "C-unwind" fn CGDisplayGetDrawingContext(
631 display: CGDirectDisplayID,
632) -> Option<CFRetained<CGContext>> {
633 extern "C-unwind" {
634 fn CGDisplayGetDrawingContext(display: CGDirectDisplayID) -> Option<NonNull<CGContext>>;
635 }
636 let ret = unsafe { CGDisplayGetDrawingContext(display) };
637 ret.map(|ret| unsafe { CFRetained::retain(ret) })
638}
639
640pub type CGDisplayCount = u32;
642
643#[cfg(feature = "CGError")]
645pub type CGDisplayErr = CGError;
646
647#[deprecated = "No longer supported"]
648#[inline]
649pub unsafe extern "C-unwind" fn CGDisplayAvailableModes(
650 dsp: CGDirectDisplayID,
651) -> Option<CFRetained<CFArray>> {
652 extern "C-unwind" {
653 fn CGDisplayAvailableModes(dsp: CGDirectDisplayID) -> Option<NonNull<CFArray>>;
654 }
655 let ret = unsafe { CGDisplayAvailableModes(dsp) };
656 ret.map(|ret| unsafe { CFRetained::retain(ret) })
657}
658
659#[cfg(feature = "libc")]
663#[deprecated = "No longer supported"]
664#[inline]
665pub unsafe extern "C-unwind" fn CGDisplayBestModeForParameters(
666 display: CGDirectDisplayID,
667 bits_per_pixel: usize,
668 width: usize,
669 height: usize,
670 exact_match: *mut libc::boolean_t,
671) -> Option<CFRetained<CFDictionary>> {
672 extern "C-unwind" {
673 fn CGDisplayBestModeForParameters(
674 display: CGDirectDisplayID,
675 bits_per_pixel: usize,
676 width: usize,
677 height: usize,
678 exact_match: *mut libc::boolean_t,
679 ) -> Option<NonNull<CFDictionary>>;
680 }
681 let ret = unsafe {
682 CGDisplayBestModeForParameters(display, bits_per_pixel, width, height, exact_match)
683 };
684 ret.map(|ret| unsafe { CFRetained::retain(ret) })
685}
686
687#[cfg(feature = "libc")]
691#[deprecated = "No longer supported"]
692#[inline]
693pub unsafe extern "C-unwind" fn CGDisplayBestModeForParametersAndRefreshRate(
694 display: CGDirectDisplayID,
695 bits_per_pixel: usize,
696 width: usize,
697 height: usize,
698 refresh_rate: CGRefreshRate,
699 exact_match: *mut libc::boolean_t,
700) -> Option<CFRetained<CFDictionary>> {
701 extern "C-unwind" {
702 fn CGDisplayBestModeForParametersAndRefreshRate(
703 display: CGDirectDisplayID,
704 bits_per_pixel: usize,
705 width: usize,
706 height: usize,
707 refresh_rate: CGRefreshRate,
708 exact_match: *mut libc::boolean_t,
709 ) -> Option<NonNull<CFDictionary>>;
710 }
711 let ret = unsafe {
712 CGDisplayBestModeForParametersAndRefreshRate(
713 display,
714 bits_per_pixel,
715 width,
716 height,
717 refresh_rate,
718 exact_match,
719 )
720 };
721 ret.map(|ret| unsafe { CFRetained::retain(ret) })
722}
723
724#[deprecated = "No longer supported"]
725#[inline]
726pub unsafe extern "C-unwind" fn CGDisplayCurrentMode(
727 display: CGDirectDisplayID,
728) -> Option<CFRetained<CFDictionary>> {
729 extern "C-unwind" {
730 fn CGDisplayCurrentMode(display: CGDirectDisplayID) -> Option<NonNull<CFDictionary>>;
731 }
732 let ret = unsafe { CGDisplayCurrentMode(display) };
733 ret.map(|ret| unsafe { CFRetained::retain(ret) })
734}
735
736extern "C-unwind" {
737 #[cfg(feature = "CGError")]
741 #[deprecated = "No longer supported"]
742 pub fn CGDisplaySwitchToMode(
743 display: CGDirectDisplayID,
744 mode: Option<&CFDictionary>,
745 ) -> CGError;
746}
747
748#[deprecated = "renamed to `CGDisplayMode::width`"]
749#[inline]
750pub extern "C-unwind" fn CGDisplayModeGetWidth(mode: Option<&CGDisplayMode>) -> usize {
751 extern "C-unwind" {
752 fn CGDisplayModeGetWidth(mode: Option<&CGDisplayMode>) -> usize;
753 }
754 unsafe { CGDisplayModeGetWidth(mode) }
755}
756
757#[deprecated = "renamed to `CGDisplayMode::height`"]
758#[inline]
759pub extern "C-unwind" fn CGDisplayModeGetHeight(mode: Option<&CGDisplayMode>) -> usize {
760 extern "C-unwind" {
761 fn CGDisplayModeGetHeight(mode: Option<&CGDisplayMode>) -> usize;
762 }
763 unsafe { CGDisplayModeGetHeight(mode) }
764}
765
766#[deprecated = "renamed to `CGDisplayMode::pixel_encoding`"]
767#[inline]
768pub extern "C-unwind" fn CGDisplayModeCopyPixelEncoding(
769 mode: Option<&CGDisplayMode>,
770) -> Option<CFRetained<CFString>> {
771 extern "C-unwind" {
772 fn CGDisplayModeCopyPixelEncoding(
773 mode: Option<&CGDisplayMode>,
774 ) -> Option<NonNull<CFString>>;
775 }
776 let ret = unsafe { CGDisplayModeCopyPixelEncoding(mode) };
777 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
778}
779
780#[deprecated = "renamed to `CGDisplayMode::refresh_rate`"]
781#[inline]
782pub extern "C-unwind" fn CGDisplayModeGetRefreshRate(mode: Option<&CGDisplayMode>) -> c_double {
783 extern "C-unwind" {
784 fn CGDisplayModeGetRefreshRate(mode: Option<&CGDisplayMode>) -> c_double;
785 }
786 unsafe { CGDisplayModeGetRefreshRate(mode) }
787}
788
789#[deprecated = "renamed to `CGDisplayMode::io_flags`"]
790#[inline]
791pub extern "C-unwind" fn CGDisplayModeGetIOFlags(mode: Option<&CGDisplayMode>) -> u32 {
792 extern "C-unwind" {
793 fn CGDisplayModeGetIOFlags(mode: Option<&CGDisplayMode>) -> u32;
794 }
795 unsafe { CGDisplayModeGetIOFlags(mode) }
796}
797
798#[deprecated = "renamed to `CGDisplayMode::io_display_mode_id`"]
799#[inline]
800pub extern "C-unwind" fn CGDisplayModeGetIODisplayModeID(mode: Option<&CGDisplayMode>) -> i32 {
801 extern "C-unwind" {
802 fn CGDisplayModeGetIODisplayModeID(mode: Option<&CGDisplayMode>) -> i32;
803 }
804 unsafe { CGDisplayModeGetIODisplayModeID(mode) }
805}
806
807#[deprecated = "renamed to `CGDisplayMode::is_usable_for_desktop_gui`"]
808#[inline]
809pub extern "C-unwind" fn CGDisplayModeIsUsableForDesktopGUI(mode: Option<&CGDisplayMode>) -> bool {
810 extern "C-unwind" {
811 fn CGDisplayModeIsUsableForDesktopGUI(mode: Option<&CGDisplayMode>) -> bool;
812 }
813 unsafe { CGDisplayModeIsUsableForDesktopGUI(mode) }
814}
815
816#[deprecated = "renamed to `CGDisplayMode::pixel_width`"]
817#[inline]
818pub extern "C-unwind" fn CGDisplayModeGetPixelWidth(mode: Option<&CGDisplayMode>) -> usize {
819 extern "C-unwind" {
820 fn CGDisplayModeGetPixelWidth(mode: Option<&CGDisplayMode>) -> usize;
821 }
822 unsafe { CGDisplayModeGetPixelWidth(mode) }
823}
824
825#[deprecated = "renamed to `CGDisplayMode::pixel_height`"]
826#[inline]
827pub extern "C-unwind" fn CGDisplayModeGetPixelHeight(mode: Option<&CGDisplayMode>) -> usize {
828 extern "C-unwind" {
829 fn CGDisplayModeGetPixelHeight(mode: Option<&CGDisplayMode>) -> usize;
830 }
831 unsafe { CGDisplayModeGetPixelHeight(mode) }
832}