Skip to content

Commit bfcc2b3

Browse files
committed
Update to objc2 v0.4.1
1 parent e821678 commit bfcc2b3

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

cocoa-foundation/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ license = "MIT OR Apache-2.0"
1212
default-target = "x86_64-apple-darwin"
1313

1414
[dependencies]
15-
block2 = "0.2.0"
15+
block2 = "0.3.0"
1616
bitflags = "1.0"
1717
libc = "0.2"
1818
core-foundation = { path = "../core-foundation", version = "0.9" }
1919
core-graphics-types = { path = "../core-graphics-types", version = "0.1", features = ["objc2"] }
20-
objc2 = "0.4.0"
20+
objc2 = "0.4.1"

cocoa/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ license = "MIT OR Apache-2.0"
1212
default-target = "x86_64-apple-darwin"
1313

1414
[dependencies]
15-
block2 = "0.2.0"
15+
block2 = "0.3.0"
1616
bitflags = "1.0"
1717
libc = "0.2"
1818
cocoa-foundation = { path = "../cocoa-foundation", version = "0.1" }
1919
core-foundation = { path = "../core-foundation", version = "0.9" }
2020
core-graphics = { path = "../core-graphics", version = "0.23" }
2121
foreign-types = "0.5"
22-
objc2 = "0.4.0"
22+
objc2 = { version = "0.4.1", features = ["relax-void-encoding"] }

cocoa/examples/fullscreen.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use cocoa::foundation::{
1616
use core_graphics::display::CGDisplay;
1717

1818
use objc2::declare::ClassBuilder;
19-
use objc2::runtime::{Object, Sel};
19+
use objc2::runtime::{AnyObject, Sel};
2020
use objc2::{class, msg_send, sel};
2121

2222
fn main() {
@@ -50,7 +50,7 @@ fn main() {
5050
let mut decl = ClassBuilder::new("MyWindowDelegate", superclass).unwrap();
5151

5252
extern "C" fn will_use_fillscreen_presentation_options(
53-
_: &Object,
53+
_: &AnyObject,
5454
_: Sel,
5555
_: id,
5656
_: NSUInteger,
@@ -63,7 +63,7 @@ fn main() {
6363
options.bits()
6464
}
6565

66-
extern "C" fn window_entering_fullscreen(_: &Object, _: Sel, _: id) {
66+
extern "C" fn window_entering_fullscreen(_: &AnyObject, _: Sel, _: id) {
6767
// Reset HideDock and HideMenuBar settings during/after we entered fullscreen.
6868
let options = NSApplicationPresentationOptions::NSApplicationPresentationHideDock
6969
| NSApplicationPresentationOptions::NSApplicationPresentationHideMenuBar;

cocoa/src/appkit.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use foundation::{
1515
NSInteger, NSPoint, NSRange, NSRect, NSRectEdge, NSSize, NSTimeInterval, NSUInteger,
1616
};
1717
use libc;
18-
use objc2::encode::{Encode, Encoding};
1918

2019
pub use core_graphics::base::CGFloat;
2120
pub use core_graphics::geometry::CGPoint;
@@ -4581,13 +4580,6 @@ pub trait NSColorSpace: Sized {
45814580
unsafe fn localizedName(self) -> id;
45824581
}
45834582

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-
45914583
impl NSColorSpace for id {
45924584
unsafe fn deviceRGBColorSpace(_: Self) -> id {
45934585
msg_send![class!(NSColorSpace), deviceRGBColorSpace]
@@ -4630,12 +4622,14 @@ impl NSColorSpace for id {
46304622
msg_send![class!(NSColorSpace), alloc]
46314623
}
46324624

4633-
unsafe fn initWithCGColorSpace_(self, cg_color_space: *const c_void) -> id {
4634-
msg_send![self, initWithCGColorSpace: CGColorSpaceRef(cg_color_space)]
4625+
unsafe fn initWithCGColorSpace_(
4626+
self,
4627+
cg_color_space: *const c_void, /* (CGColorSpaceRef) */
4628+
) -> id {
4629+
msg_send![self, initWithCGColorSpace: cg_color_space]
46354630
}
4636-
unsafe fn CGColorSpace(self) -> *const c_void {
4637-
let res: CGColorSpaceRef = msg_send![self, CGColorSpace];
4638-
res.0
4631+
unsafe fn CGColorSpace(self) -> *const c_void /* (CGColorSpaceRef) */ {
4632+
msg_send![self, CGColorSpace]
46394633
}
46404634
unsafe fn localizedName(self) -> id {
46414635
msg_send![self, localizedName]

core-graphics-types/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = "MIT OR Apache-2.0"
1111
bitflags = "1.0"
1212
core-foundation = { path = "../core-foundation", version = "0.9" }
1313
libc = "0.2"
14-
objc2 = { version = "0.4.0", optional = true }
14+
objc2 = { version = "0.4.1", optional = true }
1515

1616
[package.metadata.docs.rs]
1717
default-target = "x86_64-apple-darwin"

0 commit comments

Comments
 (0)