iOS: Never queue application-level events (#3905)

Events like `resumed`, `new_events`, `about_to_wait`, and so on will
never happen as a result of programmer action, so we'll never need to
queue those. This allows us to remove the need for the old `Event`
struct in the iOS backend.

Furthermore, we can now remove `InUserCallback`, since that state is
already stored inside `EventHandler`.

I've tried to otherwise keep the semantics as close to the original by
calling `handle_nonuser_events(mtm, [])`, which flushes pending events.
This commit is contained in:
Mads Marquart 2024-12-03 19:53:29 +01:00 committed by GitHub
parent 4a8b659228
commit 4d2a0dd2b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 165 additions and 312 deletions

View file

@ -23,7 +23,7 @@ use crate::dpi::{
Position, Size,
};
use crate::error::{NotSupportedError, RequestError};
use crate::event::{Event, WindowEvent};
use crate::event::WindowEvent;
use crate::icon::Icon;
use crate::monitor::MonitorHandle as CoreMonitorHandle;
use crate::platform::ios::{ScreenEdge, StatusBarStyle, ValidOrientations};
@ -51,10 +51,10 @@ declare_class!(
let mtm = MainThreadMarker::new().unwrap();
app_state::handle_nonuser_event(
mtm,
EventWrapper::StaticEvent(Event::WindowEvent {
EventWrapper::Window {
window_id: self.id(),
event: WindowEvent::Focused(true),
}),
},
);
let _: () = unsafe { msg_send![super(self), becomeKeyWindow] };
}
@ -64,10 +64,10 @@ declare_class!(
let mtm = MainThreadMarker::new().unwrap();
app_state::handle_nonuser_event(
mtm,
EventWrapper::StaticEvent(Event::WindowEvent {
EventWrapper::Window {
window_id: self.id(),
event: WindowEvent::Focused(false),
}),
},
);
let _: () = unsafe { msg_send![super(self), resignKeyWindow] };
}