Update objc2 crates (#3634)
Changes relevant to Winit: - `icrate` has been deprecated in favour of separate crates per framework, in our case `objc2-foundation` and `objc2-app-kit` (and in the future `objc2-ui-kit` on iOS). - Moved `MainThreadMarker::run_on_main` to free-standing function `run_on_main`. - Changed how features work, this should result in less code that we need to compile. - Enums are now real structs instead of type-aliases and free constants.
This commit is contained in:
parent
575d978202
commit
259e868c05
38 changed files with 289 additions and 270 deletions
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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::{
|
||||
|
|
@ -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)
|
||||
}))
|
||||
}
|
||||
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
|
|
@ -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())
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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!(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use icrate::Foundation::NSInteger;
|
||||
use objc2::encode::{Encode, Encoding};
|
||||
use objc2_foundation::NSInteger;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
#[allow(dead_code)]
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
||||
|
|
|
|||
|
|
@ -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::{
|
||||
|
|
|
|||
|
|
@ -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::{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue