Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/platform_impl/ios/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
use objc::runtime::{BOOL, YES};

use crate::{
event::{Event, StartCause, WindowEvent},
event::{Event, StartCause},
event_loop::ControlFlow,
platform_impl::platform::{
event_loop::{EventHandler, Never},
Expand Down Expand Up @@ -51,11 +51,7 @@ enum UserCallbackTransitionResult<'a> {

impl Event<Never> {
fn is_redraw(&self) -> bool {
if let Event::WindowEvent {
window_id: _,
event: WindowEvent::RedrawRequested,
} = self
{
if let Event::RedrawRequested(_) = self {
true
} else {
false
Expand Down Expand Up @@ -776,16 +772,18 @@ pub unsafe fn handle_main_events_cleared() {

// User events are always sent out at the end of the "MainEventLoop"
handle_user_events();
handle_nonuser_event(Event::EventsCleared);
handle_nonuser_event(Event::MainEventsCleared);

let mut this = AppState::get_mut();
let redraw_events = this
let mut redraw_events: Vec<Event<Never>> = this
.main_events_cleared_transition()
.into_iter()
.map(|window| Event::WindowEvent {
window_id: RootWindowId(window.into()),
event: WindowEvent::RedrawRequested,
});
.map(|window| Event::RedrawRequested(RootWindowId(window.into())))
.collect();

if !redraw_events.is_empty() {
redraw_events.push(Event::RedrawEventsCleared);
}
drop(this);

handle_nonuser_events(redraw_events);
Expand Down
12 changes: 7 additions & 5 deletions src/platform_impl/ios/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ unsafe fn get_view_class(root_view_class: &'static Class) -> &'static Class {
unsafe {
let window: id = msg_send![object, window];
assert!(!window.is_null());
app_state::handle_nonuser_event(Event::WindowEvent {
window_id: RootWindowId(window.into()),
event: WindowEvent::RedrawRequested,
});
app_state::handle_nonuser_events(
std::iter::once(Event::RedrawRequested(RootWindowId(window.into())))
.chain(std::iter::once(Event::RedrawEventsCleared)),
);
let superclass: &'static Class = msg_send![object, superclass];
let () = msg_send![super(object, superclass), drawRect: rect];
}
Expand Down Expand Up @@ -500,7 +500,9 @@ pub unsafe fn create_window(
let () = msg_send![uiscreen, setCurrentMode: video_mode.video_mode.screen_mode];
msg_send![window, setScreen:video_mode.monitor().ui_screen()]
}
Some(Fullscreen::Borderless(ref monitor)) => msg_send![window, setScreen:monitor.ui_screen()],
Some(Fullscreen::Borderless(ref monitor)) => {
msg_send![window, setScreen:monitor.ui_screen()]
}
None => (),
}

Expand Down