@@ -15,6 +15,7 @@ use foundation::{
1515 NSInteger , NSPoint , NSRange , NSRect , NSRectEdge , NSSize , NSTimeInterval , NSUInteger ,
1616} ;
1717use libc;
18+ use objc2:: encode:: { Encode , Encoding } ;
1819
1920pub use core_graphics:: base:: CGFloat ;
2021pub use core_graphics:: geometry:: CGPoint ;
@@ -426,29 +427,29 @@ impl_Encode!(NSBezelStyle, u64);
426427
427428// https://developer.apple.com/documentation/appkit/nsvisualeffectview/blendingmode
428429#[ allow( dead_code) ]
429- #[ repr( u64 ) ]
430+ #[ repr( isize ) ]
430431#[ derive( Clone , Copy , Debug , PartialEq ) ]
431432pub enum NSVisualEffectBlendingMode {
432433 BehindWindow = 0 ,
433434 WithinWindow = 1 ,
434435}
435436
436- impl_Encode ! ( NSVisualEffectBlendingMode , u64 ) ;
437+ impl_Encode ! ( NSVisualEffectBlendingMode , isize ) ;
437438
438439// https://developer.apple.com/documentation/appkit/nsvisualeffectview/state
439440#[ allow( dead_code) ]
440- #[ repr( u64 ) ]
441+ #[ repr( isize ) ]
441442#[ derive( Clone , Copy , Debug , PartialEq ) ]
442443pub enum NSVisualEffectState {
443444 FollowsWindowActiveState = 0 ,
444445 Active = 1 ,
445446 Inactive = 2 ,
446447}
447448
448- impl_Encode ! ( NSVisualEffectState , u64 ) ;
449+ impl_Encode ! ( NSVisualEffectState , isize ) ;
449450
450451/// <https://developer.apple.com/documentation/appkit/nsvisualeffectview/material>
451- #[ repr( u64 ) ]
452+ #[ repr( isize ) ]
452453#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
453454pub enum NSVisualEffectMaterial {
454455 /// A default material for the view's effectiveAppearance.
@@ -484,7 +485,7 @@ pub enum NSVisualEffectMaterial {
484485 UnderPageBackground = 22 ,
485486}
486487
487- impl_Encode ! ( NSVisualEffectMaterial , u64 ) ;
488+ impl_Encode ! ( NSVisualEffectMaterial , isize ) ;
488489
489490// macOS 10.10+ - https://developer.apple.com/documentation/appkit/nsvisualeffectview
490491#[ allow( non_snake_case) ]
@@ -587,7 +588,7 @@ pub trait NSApplication: Sized {
587588
588589 unsafe fn mainMenu ( self ) -> id ;
589590 unsafe fn setActivationPolicy_ ( self , policy : NSApplicationActivationPolicy ) -> BOOL ;
590- unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) -> BOOL ;
591+ unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) ;
591592 unsafe fn presentationOptions_ ( self ) -> NSApplicationPresentationOptions ;
592593 unsafe fn setMainMenu_ ( self , menu : id ) ;
593594 unsafe fn setServicesMenu_ ( self , menu : id ) ;
@@ -618,7 +619,7 @@ impl NSApplication for id {
618619 msg_send ! [ self , setActivationPolicy: policy as NSInteger ]
619620 }
620621
621- unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) -> BOOL {
622+ unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) {
622623 msg_send ! [ self , setPresentationOptions: options. bits]
623624 }
624625
@@ -4580,6 +4581,13 @@ pub trait NSColorSpace: Sized {
45804581 unsafe fn localizedName ( self ) -> id ;
45814582}
45824583
4584+ #[ repr( transparent) ]
4585+ struct CGColorSpaceRef ( * const c_void ) ;
4586+
4587+ unsafe impl Encode for CGColorSpaceRef {
4588+ const ENCODING : Encoding = Encoding :: Pointer ( & Encoding :: Struct ( "CGColorSpace" , & [ ] ) ) ;
4589+ }
4590+
45834591impl NSColorSpace for id {
45844592 unsafe fn deviceRGBColorSpace ( _: Self ) -> id {
45854593 msg_send ! [ class!( NSColorSpace ) , deviceRGBColorSpace]
@@ -4622,14 +4630,12 @@ impl NSColorSpace for id {
46224630 msg_send ! [ class!( NSColorSpace ) , alloc]
46234631 }
46244632
4625- unsafe fn initWithCGColorSpace_ (
4626- self ,
4627- cg_color_space : * const c_void , /* (CGColorSpaceRef) */
4628- ) -> id {
4629- msg_send ! [ self , initWithCGColorSpace: cg_color_space]
4633+ unsafe fn initWithCGColorSpace_ ( self , cg_color_space : * const c_void ) -> id {
4634+ msg_send ! [ self , initWithCGColorSpace: CGColorSpaceRef ( cg_color_space) ]
46304635 }
4631- unsafe fn CGColorSpace ( self ) -> * const c_void /* (CGColorSpaceRef) */ {
4632- msg_send ! [ self , CGColorSpace ]
4636+ unsafe fn CGColorSpace ( self ) -> * const c_void {
4637+ let res: CGColorSpaceRef = msg_send ! [ self , CGColorSpace ] ;
4638+ res. 0
46334639 }
46344640 unsafe fn localizedName ( self ) -> id {
46354641 msg_send ! [ self , localizedName]
0 commit comments