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
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue