@@ -14,6 +14,7 @@ use block2::Block;
1414use foundation:: {
1515 NSInteger , NSPoint , NSRange , NSRect , NSRectEdge , NSSize , NSTimeInterval , NSUInteger ,
1616} ;
17+ use objc2:: encode:: { Encode , Encoding } ;
1718use libc;
1819
1920pub use core_graphics:: base:: CGFloat ;
@@ -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]
@@ -4624,12 +4632,13 @@ impl NSColorSpace for id {
46244632
46254633 unsafe fn initWithCGColorSpace_ (
46264634 self ,
4627- cg_color_space : * const c_void , /* (CGColorSpaceRef) */
4635+ cg_color_space : * const c_void ,
46284636 ) -> id {
4629- msg_send ! [ self , initWithCGColorSpace: cg_color_space]
4637+ msg_send ! [ self , initWithCGColorSpace: CGColorSpaceRef ( cg_color_space) ]
46304638 }
4631- unsafe fn CGColorSpace ( self ) -> * const c_void /* (CGColorSpaceRef) */ {
4632- msg_send ! [ self , CGColorSpace ]
4639+ unsafe fn CGColorSpace ( self ) -> * const c_void {
4640+ let res: CGColorSpaceRef = msg_send ! [ self , CGColorSpace ] ;
4641+ res. 0
46334642 }
46344643 unsafe fn localizedName ( self ) -> id {
46354644 msg_send ! [ self , localizedName]
0 commit comments