Skip to content

Commit

Permalink
Update objc2 crates
Browse files Browse the repository at this point in the history
- From objc2 0.5.0 to 0.5.1
- From icrate 0.1.0 to objc2-foundation 0.2.0 and objc2-app-kit 0.2.0
  • Loading branch information
madsmtm committed Apr 17, 2024
1 parent 575d978 commit 18c09de
Show file tree
Hide file tree
Showing 38 changed files with 288 additions and 269 deletions.
97 changes: 55 additions & 42 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,58 +88,71 @@ ndk-sys = "0.5.0"

[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
core-foundation = "0.9.3"
objc2 = "0.5.0"
objc2 = "0.5.1"

[target.'cfg(target_os = "macos")'.dependencies]
core-graphics = "0.23.1"

[target.'cfg(target_os = "macos")'.dependencies.icrate]
version = "0.1.0"
[target.'cfg(target_os = "macos")'.dependencies.objc2-foundation]
version = "0.2.0"
features = [
"dispatch",
"Foundation",
"Foundation_NSArray",
"Foundation_NSAttributedString",
"Foundation_NSMutableAttributedString",
"Foundation_NSData",
"Foundation_NSDictionary",
"Foundation_NSString",
"Foundation_NSProcessInfo",
"Foundation_NSThread",
"Foundation_NSNumber",
"AppKit",
"AppKit_NSAppearance",
"AppKit_NSApplication",
"AppKit_NSBitmapImageRep",
"AppKit_NSButton",
"AppKit_NSColor",
"AppKit_NSControl",
"AppKit_NSCursor",
"AppKit_NSEvent",
"AppKit_NSGraphicsContext",
"AppKit_NSImage",
"AppKit_NSImageRep",
"AppKit_NSMenu",
"AppKit_NSMenuItem",
"AppKit_NSPasteboard",
"AppKit_NSResponder",
"AppKit_NSScreen",
"AppKit_NSTextInputContext",
"AppKit_NSView",
"AppKit_NSWindow",
"AppKit_NSWindowTabGroup",
"NSArray",
"NSAttributedString",
"NSData",
"NSDictionary",
"NSEnumerator",
"NSObjCRuntime",
"NSString",
"NSPathUtilities",
"NSProcessInfo",
"NSThread",
"NSValue",
]

[target.'cfg(target_os = "ios")'.dependencies.icrate]
version = "0.1.0"
[target.'cfg(target_os = "macos")'.dependencies.objc2-app-kit]
version = "0.2.0"
features = [
"NSAppearance",
"NSApplication",
"NSBitmapImageRep",
"NSButton",
"NSColor",
"NSControl",
"NSCursor",
"NSDragging",
"NSEvent",
"NSGraphics",
"NSGraphicsContext",
"NSImage",
"NSImageRep",
"NSMenu",
"NSMenuItem",
"NSOpenGLView",
"NSPasteboard",
"NSResponder",
"NSRunningApplication",
"NSScreen",
"NSTextInputClient",
"NSTextInputContext",
"NSView",
"NSWindow",
"NSWindowScripting",
"NSWindowTabGroup",
]

[target.'cfg(target_os = "ios")'.dependencies.objc2-foundation]
version = "0.2.0"
features = [
"dispatch",
"Foundation",
"Foundation_NSArray",
"Foundation_NSString",
"Foundation_NSProcessInfo",
"Foundation_NSThread",
"Foundation_NSSet",
"NSArray",
"NSEnumerator",
"NSGeometry",
"NSObjCRuntime",
"NSString",
"NSProcessInfo",
"NSThread",
"NSSet",
]

[target.'cfg(target_os = "windows")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/platform/ios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl MonitorHandleExtIOS for MonitorHandle {
#[inline]
fn ui_screen(&self) -> *mut c_void {
// SAFETY: The marker is only used to get the pointer of the screen
let mtm = unsafe { icrate::Foundation::MainThreadMarker::new_unchecked() };
let mtm = unsafe { objc2_foundation::MainThreadMarker::new_unchecked() };
objc2::rc::Id::as_ptr(self.inner.ui_screen(mtm)) as *mut c_void
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ impl MonitorHandleExtMacOS for MonitorHandle {

fn ns_screen(&self) -> Option<*mut c_void> {
// SAFETY: We only use the marker to get a pointer
let mtm = unsafe { icrate::Foundation::MainThreadMarker::new_unchecked() };
let mtm = unsafe { objc2_foundation::MainThreadMarker::new_unchecked() };
self.inner
.ns_screen(mtm)
.map(|s| objc2::rc::Id::as_ptr(&s) as _)
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/app_delegate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::{MainThreadMarker, NSObject, NSObjectProtocol};
use objc2::{declare_class, mutability, ClassType, DeclaredClass};
use objc2_foundation::{MainThreadMarker, NSObject, NSObjectProtocol};

use super::app_state::{self, EventWrapper};
use super::uikit::{UIApplication, UIWindow};
Expand Down
6 changes: 3 additions & 3 deletions src/platform_impl/ios/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use core_foundation::runloop::{
kCFRunLoopCommonModes, CFRunLoopAddTimer, CFRunLoopGetMain, CFRunLoopRef, CFRunLoopTimerCreate,
CFRunLoopTimerInvalidate, CFRunLoopTimerRef, CFRunLoopTimerSetNextFireDate,
};
use icrate::Foundation::{
CGRect, CGSize, MainThreadMarker, NSInteger, NSOperatingSystemVersion, NSProcessInfo,
};
use objc2::rc::Id;
use objc2::runtime::AnyObject;
use objc2::{msg_send, sel};
use objc2_foundation::{
CGRect, CGSize, MainThreadMarker, NSInteger, NSOperatingSystemVersion, NSProcessInfo,
};

use super::uikit::UIView;
use super::window::WinitUIWindow;
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use core_foundation::runloop::{
CFRunLoopObserverCreate, CFRunLoopObserverRef, CFRunLoopSourceContext, CFRunLoopSourceCreate,
CFRunLoopSourceInvalidate, CFRunLoopSourceRef, CFRunLoopSourceSignal, CFRunLoopWakeUp,
};
use icrate::Foundation::{MainThreadMarker, NSString};
use objc2::ClassType;
use objc2_foundation::{MainThreadMarker, NSString};

use crate::{
error::EventLoopError,
Expand Down
12 changes: 6 additions & 6 deletions src/platform_impl/ios/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::{
fmt, hash, ptr,
};

use icrate::Foundation::{MainThreadBound, MainThreadMarker, NSInteger};
use objc2::mutability::IsRetainable;
use objc2::rc::Id;
use objc2::Message;
use objc2_foundation::{run_on_main, MainThreadBound, MainThreadMarker, NSInteger};

use super::uikit::{UIScreen, UIScreenMode};
use crate::{
Expand All @@ -23,7 +23,7 @@ struct MainThreadBoundDelegateImpls<T>(MainThreadBound<Id<T>>);

impl<T: IsRetainable + Message> Clone for MainThreadBoundDelegateImpls<T> {
fn clone(&self) -> Self {
Self(MainThreadMarker::run_on_main(|mtm| {
Self(run_on_main(|mtm| {
MainThreadBound::new(Id::clone(self.0.get(mtm)), mtm)
}))
}
Expand Down Expand Up @@ -100,7 +100,7 @@ pub struct MonitorHandle {

impl Clone for MonitorHandle {
fn clone(&self) -> Self {
MainThreadMarker::run_on_main(|mtm| Self {
run_on_main(|mtm| Self {
ui_screen: MainThreadBound::new(self.ui_screen.get(mtm).clone(), mtm),
})
}
Expand Down Expand Up @@ -155,7 +155,7 @@ impl MonitorHandle {
}

pub fn name(&self) -> Option<String> {
MainThreadMarker::run_on_main(|mtm| {
run_on_main(|mtm| {
let main = UIScreen::main(mtm);
if *self.ui_screen(mtm) == main {
Some("Primary".to_string())
Expand Down Expand Up @@ -197,7 +197,7 @@ impl MonitorHandle {
}

pub fn video_modes(&self) -> impl Iterator<Item = VideoModeHandle> {
MainThreadMarker::run_on_main(|mtm| {
run_on_main(|mtm| {
let ui_screen = self.ui_screen(mtm);
// Use Ord impl of RootVideoModeHandle

Expand All @@ -218,7 +218,7 @@ impl MonitorHandle {
}

pub fn preferred_video_mode(&self) -> VideoModeHandle {
MainThreadMarker::run_on_main(|mtm| {
run_on_main(|mtm| {
VideoModeHandle::new(
self.ui_screen(mtm).clone(),
self.ui_screen(mtm).preferredMode().unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/application.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use icrate::Foundation::{CGRect, MainThreadMarker, NSArray, NSObject};
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::{CGRect, MainThreadMarker, NSArray, NSObject};

use super::{UIResponder, UIWindow};

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/coordinate_space.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::NSObject;
use objc2::{extern_class, mutability, ClassType};
use objc2_foundation::NSObject;

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/device.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use icrate::Foundation::{MainThreadMarker, NSInteger, NSObject};
use objc2::encode::{Encode, Encoding};
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::{MainThreadMarker, NSInteger, NSObject};

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/event.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::NSObject;
use objc2::{extern_class, mutability, ClassType};
use objc2_foundation::NSObject;

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/geometry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::NSUInteger;
use objc2::encode::{Encode, Encoding};
use objc2_foundation::NSUInteger;

#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/gesture_recognizer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use icrate::Foundation::{CGFloat, NSInteger, NSObject, NSUInteger};
use objc2::{
encode::{Encode, Encoding},
extern_class, extern_methods, mutability, ClassType,
};
use objc2_foundation::{CGFloat, NSInteger, NSObject, NSUInteger};

// https://developer.apple.com/documentation/uikit/uigesturerecognizer
extern_class!(
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::os::raw::{c_char, c_int};

use icrate::Foundation::NSString;
use objc2_foundation::NSString;

mod application;
mod coordinate_space;
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/responder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::NSObject;
use objc2::{extern_class, mutability, ClassType};
use objc2_foundation::NSObject;

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/screen.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use icrate::Foundation::{CGFloat, CGRect, MainThreadMarker, NSArray, NSInteger, NSObject};
use objc2::encode::{Encode, Encoding};
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::{CGFloat, CGRect, MainThreadMarker, NSArray, NSInteger, NSObject};

use super::{UICoordinateSpace, UIScreenMode};

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/screen_mode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use icrate::Foundation::{CGSize, NSObject};
use objc2::{extern_class, extern_methods, mutability, ClassType};
use objc2_foundation::{CGSize, NSObject};

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/status_bar_style.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use icrate::Foundation::NSInteger;
use objc2_foundation::NSInteger;
use objc2::encode::{Encode, Encoding};

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/touch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use icrate::Foundation::{CGFloat, CGPoint, NSInteger, NSObject};
use objc2::encode::{Encode, Encoding};
use objc2::{extern_class, extern_methods, mutability, ClassType};
use objc2_foundation::{CGFloat, CGPoint, NSInteger, NSObject};

use super::UIView;

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/trait_collection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use icrate::Foundation::{NSInteger, NSObject};
use objc2::encode::{Encode, Encoding};
use objc2::{extern_class, extern_methods, mutability, ClassType};
use objc2_foundation::{NSInteger, NSObject};

extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/view.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use icrate::Foundation::{CGFloat, CGRect, NSObject};
use objc2::encode::{Encode, Encoding};
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::{CGFloat, CGRect, NSObject};

use super::{UICoordinateSpace, UIGestureRecognizer, UIResponder, UIViewController};

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/view_controller.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use icrate::Foundation::{NSObject, NSUInteger};
use objc2::encode::{Encode, Encoding};
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::{NSObject, NSUInteger};

use super::{UIResponder, UIView};

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/uikit/window.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use icrate::Foundation::NSObject;
use objc2::rc::Id;
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
use objc2_foundation::NSObject;

use super::{UIResponder, UIScreen, UIView};

Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/view.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![allow(clippy::unnecessary_cast)]
use std::cell::RefCell;

use icrate::Foundation::{CGFloat, CGRect, MainThreadMarker, NSObject, NSSet};
use objc2::rc::Id;
use objc2::runtime::AnyClass;
use objc2::{
declare_class, extern_methods, msg_send, msg_send_id, mutability, sel, ClassType, DeclaredClass,
};
use objc2_foundation::{CGFloat, CGRect, MainThreadMarker, NSObject, NSSet};

use super::app_state::{self, EventWrapper};
use super::uikit::{
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/view_controller.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::cell::Cell;

use icrate::Foundation::{MainThreadMarker, NSObject};
use objc2::rc::Id;
use objc2::{declare_class, msg_send_id, mutability, ClassType, DeclaredClass};
use objc2_foundation::{MainThreadMarker, NSObject};

use super::app_state::{self};
use super::uikit::{
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/ios/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use std::collections::VecDeque;

use icrate::Foundation::{CGFloat, CGPoint, CGRect, CGSize, MainThreadBound, MainThreadMarker};
use objc2::rc::Id;
use objc2::runtime::{AnyObject, NSObject};
use objc2::{class, declare_class, msg_send, msg_send_id, mutability, ClassType, DeclaredClass};
use objc2_foundation::{CGFloat, CGPoint, CGRect, CGSize, MainThreadBound, MainThreadMarker};
use tracing::{debug, warn};

use super::app_state::EventWrapper;
Expand Down
Loading

0 comments on commit 18c09de

Please sign in to comment.