@@ -20,6 +20,7 @@ pub use crate::geometry::{CGPoint, CGRect, CGSize};
2020use crate :: image:: CGImage ;
2121use core_foundation:: base:: { CFRetain , TCFType } ;
2222use core_foundation:: string:: { CFString , CFStringRef } ;
23+ use core_graphics_types:: base:: kCGErrorSuccess;
2324use foreign_types:: { foreign_type, ForeignType } ;
2425
2526pub type CGDirectDisplayID = u32 ;
@@ -185,7 +186,7 @@ impl CGDisplay {
185186 let result = unsafe {
186187 CGGetDisplaysWithPoint ( point, 0 , ptr:: null_mut ( ) , & mut matching_display_count)
187188 } ;
188- if result == 0 {
189+ if result == kCGErrorSuccess {
189190 Ok ( matching_display_count)
190191 } else {
191192 Err ( result)
@@ -213,7 +214,7 @@ impl CGDisplay {
213214 )
214215 } ;
215216
216- if result == 0 {
217+ if result == kCGErrorSuccess {
217218 Ok ( ( displays, matching_display_count) )
218219 } else {
219220 Err ( result)
@@ -227,7 +228,7 @@ impl CGDisplay {
227228 let mut matching_display_count: u32 = 0 ;
228229 let result =
229230 unsafe { CGGetDisplaysWithRect ( rect, 0 , ptr:: null_mut ( ) , & mut matching_display_count) } ;
230- if result == 0 {
231+ if result == kCGErrorSuccess {
231232 Ok ( matching_display_count)
232233 } else {
233234 Err ( result)
@@ -254,7 +255,7 @@ impl CGDisplay {
254255 )
255256 } ;
256257
257- if result == 0 {
258+ if result == kCGErrorSuccess {
258259 Ok ( ( displays, matching_display_count) )
259260 } else {
260261 Err ( result)
0 commit comments