Skip to content

Commit

Permalink
Update to objc2 v0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jul 31, 2023
1 parent e821678 commit 22998bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[workspace]
members = ["core-foundation", "core-foundation-sys", "core-graphics-types", "core-graphics", "core-text", "cocoa", "cocoa-foundation", "io-surface"]

[patch.crates-io]
objc2 = { path = "../objc2/crates/objc2" }
block2 = { path = "../objc2/crates/block2" }
2 changes: 1 addition & 1 deletion cocoa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ cocoa-foundation = { path = "../cocoa-foundation", version = "0.1" }
core-foundation = { path = "../core-foundation", version = "0.9" }
core-graphics = { path = "../core-graphics", version = "0.23" }
foreign-types = "0.5"
objc2 = "0.4.0"
objc2 = { version = "0.4.0", features = ["relax-void-encoding"] }
20 changes: 7 additions & 13 deletions cocoa/src/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use foundation::{
NSInteger, NSPoint, NSRange, NSRect, NSRectEdge, NSSize, NSTimeInterval, NSUInteger,
};
use libc;
use objc2::encode::{Encode, Encoding};

pub use core_graphics::base::CGFloat;
pub use core_graphics::geometry::CGPoint;
Expand Down Expand Up @@ -4581,13 +4580,6 @@ pub trait NSColorSpace: Sized {
unsafe fn localizedName(self) -> id;
}

#[repr(transparent)]
struct CGColorSpaceRef(*const c_void);

unsafe impl Encode for CGColorSpaceRef {
const ENCODING: Encoding = Encoding::Pointer(&Encoding::Struct("CGColorSpace", &[]));
}

impl NSColorSpace for id {
unsafe fn deviceRGBColorSpace(_: Self) -> id {
msg_send![class!(NSColorSpace), deviceRGBColorSpace]
Expand Down Expand Up @@ -4630,12 +4622,14 @@ impl NSColorSpace for id {
msg_send![class!(NSColorSpace), alloc]
}

unsafe fn initWithCGColorSpace_(self, cg_color_space: *const c_void) -> id {
msg_send![self, initWithCGColorSpace: CGColorSpaceRef(cg_color_space)]
unsafe fn initWithCGColorSpace_(
self,
cg_color_space: *const c_void, /* (CGColorSpaceRef) */
) -> id {
msg_send![self, initWithCGColorSpace: cg_color_space]
}
unsafe fn CGColorSpace(self) -> *const c_void {
let res: CGColorSpaceRef = msg_send![self, CGColorSpace];
res.0
unsafe fn CGColorSpace(self) -> *const c_void /* (CGColorSpaceRef) */ {
msg_send![self, CGColorSpace]
}
unsafe fn localizedName(self) -> id {
msg_send![self, localizedName]
Expand Down

0 comments on commit 22998bc

Please sign in to comment.