Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate definitions of CGWindow-related constants and types #659

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions core-graphics/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,18 @@ pub use crate::base::{boolean_t, CGError};
pub use crate::geometry::{CGPoint, CGRect, CGSize};

use crate::image::CGImage;
use crate::window::{
kCGNullWindowID, CGWindowID, CGWindowImageOption, CGWindowLevel, CGWindowListOption,
};
use core_foundation::base::{CFRetain, TCFType};
use core_foundation::string::{CFString, CFStringRef};
use core_graphics_types::base::kCGErrorSuccess;
use foreign_types::{foreign_type, ForeignType};

pub type CGDirectDisplayID = u32;
pub type CGWindowID = u32;
pub type CGWindowLevel = i32;

pub const kCGNullWindowID: CGWindowID = 0 as CGWindowID;
pub const kCGNullDirectDisplayID: CGDirectDisplayID = 0 as CGDirectDisplayID;

pub type CGWindowListOption = u32;

pub const kCGWindowListOptionAll: CGWindowListOption = 0;
pub const kCGWindowListOptionOnScreenOnly: CGWindowListOption = 1 << 0;
pub const kCGWindowListOptionOnScreenAboveWindow: CGWindowListOption = 1 << 1;
pub const kCGWindowListOptionOnScreenBelowWindow: CGWindowListOption = 1 << 2;
pub const kCGWindowListOptionIncludingWindow: CGWindowListOption = 1 << 3;
pub const kCGWindowListExcludeDesktopElements: CGWindowListOption = 1 << 4;

pub type CGWindowImageOption = u32;

pub const kCGWindowImageDefault: CGWindowImageOption = 0;
pub const kCGWindowImageBoundsIgnoreFraming: CGWindowImageOption = 1 << 0;
pub const kCGWindowImageShouldBeOpaque: CGWindowImageOption = 1 << 1;
pub const kCGWindowImageOnlyShadows: CGWindowImageOption = 1 << 2;
pub const kCGWindowImageBestResolution: CGWindowImageOption = 1 << 3;
pub const kCGWindowImageNominalResolution: CGWindowImageOption = 1 << 4;

pub const kDisplayModeValidFlag: u32 = 0x00000001;
pub const kDisplayModeSafeFlag: u32 = 0x00000002;
pub const kDisplayModeDefaultFlag: u32 = 0x00000004;
Expand Down
6 changes: 4 additions & 2 deletions core-graphics/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ use crate::image::CGImage;
use crate::sys;

pub type CGWindowID = u32;
pub type CGWindowLevel = i32;

pub const kCGNullWindowID: CGWindowID = 0;

// https://developer.apple.com/documentation/coregraphics/cgwindowsharingtype?language=objc
pub type CGWindowSharingType = u32;
pub const kCGWindowSharingNone: CGWindowSharingType = 0;
pub const kCGWindowSharingReadOnly: CGWindowSharingType = 1;
Expand Down Expand Up @@ -48,8 +52,6 @@ pub const kCGWindowImageOnlyShadows: CGWindowImageOption = 1 << 2;
pub const kCGWindowImageBestResolution: CGWindowImageOption = 1 << 3;
pub const kCGWindowImageNominalResolution: CGWindowImageOption = 1 << 4;

pub const kCGNullWindowID: CGWindowID = 0;

pub fn copy_window_info(
option: CGWindowListOption,
relative_to_window: CGWindowID,
Expand Down
Loading