From 8b60012a89bab3cbdb1c62412c091999ce9a93c1 Mon Sep 17 00:00:00 2001 From: nashaofu Date: Thu, 28 Mar 2024 23:41:44 +0800 Subject: [PATCH] Remove duplicate definitions of CGWindow-related constants and types --- core-graphics/src/display.rs | 24 +++--------------------- core-graphics/src/window.rs | 6 ++++-- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/core-graphics/src/display.rs b/core-graphics/src/display.rs index 2e40f777..4fbf98f0 100644 --- a/core-graphics/src/display.rs +++ b/core-graphics/src/display.rs @@ -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; diff --git a/core-graphics/src/window.rs b/core-graphics/src/window.rs index e2a2bac1..a673e49d 100644 --- a/core-graphics/src/window.rs +++ b/core-graphics/src/window.rs @@ -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; @@ -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,