Make iOS fully thread safe (#3045)

* macOS & iOS: Refactor EventWrapper

* macOS & iOS: Make EventLoopWindowTarget independent of the user event

* iOS: Use MainThreadMarker instead of marking functions unsafe

* Make iOS thread safe
This commit is contained in:
Mads Marquart 2023-08-27 17:04:39 +02:00 committed by GitHub
parent d9f04780cc
commit 86baa1c99a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 457 additions and 445 deletions

View file

@ -5,15 +5,11 @@ use core_foundation::{
data::{CFDataGetBytePtr, CFDataRef},
};
use icrate::Foundation::MainThreadMarker;
use objc2::rc::Id;
use smol_str::SmolStr;
use super::appkit::{NSEvent, NSEventModifierFlags};
use super::util::Never;
use super::window::WinitWindow;
use crate::{
dpi::LogicalSize,
event::{ElementState, Event, KeyEvent, Modifiers},
event::{ElementState, KeyEvent, Modifiers},
keyboard::{
Key, KeyCode, KeyLocation, ModifiersKeys, ModifiersState, NativeKey, NativeKeyCode,
},
@ -21,21 +17,6 @@ use crate::{
platform_impl::platform::ffi,
};
#[derive(Debug)]
pub(crate) enum EventWrapper {
StaticEvent(Event<Never>),
EventProxy(EventProxy),
}
#[derive(Debug)]
pub(crate) enum EventProxy {
DpiChangedProxy {
window: Id<WinitWindow>,
suggested_size: LogicalSize<f64>,
scale_factor: f64,
},
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct KeyEventExtra {
pub text_with_all_modifiers: Option<SmolStr>,