@@ -14,6 +14,7 @@ use block2::Block;
14
14
use foundation:: {
15
15
NSInteger , NSPoint , NSRange , NSRect , NSRectEdge , NSSize , NSTimeInterval , NSUInteger ,
16
16
} ;
17
+ use objc2:: encode:: { Encode , Encoding } ;
17
18
use libc;
18
19
19
20
pub use core_graphics:: base:: CGFloat ;
@@ -426,29 +427,29 @@ impl_Encode!(NSBezelStyle, u64);
426
427
427
428
// https://developer.apple.com/documentation/appkit/nsvisualeffectview/blendingmode
428
429
#[ allow( dead_code) ]
429
- #[ repr( u64 ) ]
430
+ #[ repr( isize ) ]
430
431
#[ derive( Clone , Copy , Debug , PartialEq ) ]
431
432
pub enum NSVisualEffectBlendingMode {
432
433
BehindWindow = 0 ,
433
434
WithinWindow = 1 ,
434
435
}
435
436
436
- impl_Encode ! ( NSVisualEffectBlendingMode , u64 ) ;
437
+ impl_Encode ! ( NSVisualEffectBlendingMode , isize ) ;
437
438
438
439
// https://developer.apple.com/documentation/appkit/nsvisualeffectview/state
439
440
#[ allow( dead_code) ]
440
- #[ repr( u64 ) ]
441
+ #[ repr( isize ) ]
441
442
#[ derive( Clone , Copy , Debug , PartialEq ) ]
442
443
pub enum NSVisualEffectState {
443
444
FollowsWindowActiveState = 0 ,
444
445
Active = 1 ,
445
446
Inactive = 2 ,
446
447
}
447
448
448
- impl_Encode ! ( NSVisualEffectState , u64 ) ;
449
+ impl_Encode ! ( NSVisualEffectState , isize ) ;
449
450
450
451
/// <https://developer.apple.com/documentation/appkit/nsvisualeffectview/material>
451
- #[ repr( u64 ) ]
452
+ #[ repr( isize ) ]
452
453
#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
453
454
pub enum NSVisualEffectMaterial {
454
455
/// A default material for the view's effectiveAppearance.
@@ -484,7 +485,7 @@ pub enum NSVisualEffectMaterial {
484
485
UnderPageBackground = 22 ,
485
486
}
486
487
487
- impl_Encode ! ( NSVisualEffectMaterial , u64 ) ;
488
+ impl_Encode ! ( NSVisualEffectMaterial , isize ) ;
488
489
489
490
// macOS 10.10+ - https://developer.apple.com/documentation/appkit/nsvisualeffectview
490
491
#[ allow( non_snake_case) ]
@@ -587,7 +588,7 @@ pub trait NSApplication: Sized {
587
588
588
589
unsafe fn mainMenu ( self ) -> id ;
589
590
unsafe fn setActivationPolicy_ ( self , policy : NSApplicationActivationPolicy ) -> BOOL ;
590
- unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) -> BOOL ;
591
+ unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) ;
591
592
unsafe fn presentationOptions_ ( self ) -> NSApplicationPresentationOptions ;
592
593
unsafe fn setMainMenu_ ( self , menu : id ) ;
593
594
unsafe fn setServicesMenu_ ( self , menu : id ) ;
@@ -618,7 +619,7 @@ impl NSApplication for id {
618
619
msg_send ! [ self , setActivationPolicy: policy as NSInteger ]
619
620
}
620
621
621
- unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) -> BOOL {
622
+ unsafe fn setPresentationOptions_ ( self , options : NSApplicationPresentationOptions ) {
622
623
msg_send ! [ self , setPresentationOptions: options. bits]
623
624
}
624
625
@@ -4580,6 +4581,13 @@ pub trait NSColorSpace: Sized {
4580
4581
unsafe fn localizedName ( self ) -> id ;
4581
4582
}
4582
4583
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
+
4583
4591
impl NSColorSpace for id {
4584
4592
unsafe fn deviceRGBColorSpace ( _: Self ) -> id {
4585
4593
msg_send ! [ class!( NSColorSpace ) , deviceRGBColorSpace]
@@ -4624,12 +4632,13 @@ impl NSColorSpace for id {
4624
4632
4625
4633
unsafe fn initWithCGColorSpace_ (
4626
4634
self ,
4627
- cg_color_space : * const c_void , /* (CGColorSpaceRef) */
4635
+ cg_color_space : * const c_void ,
4628
4636
) -> id {
4629
- msg_send ! [ self , initWithCGColorSpace: cg_color_space]
4637
+ msg_send ! [ self , initWithCGColorSpace: CGColorSpaceRef ( cg_color_space) ]
4630
4638
}
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
4633
4642
}
4634
4643
unsafe fn localizedName ( self ) -> id {
4635
4644
msg_send ! [ self , localizedName]
0 commit comments