-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix iOS support in eframe
#3241
Conversation
crates/eframe/src/native/run.rs
Outdated
@@ -280,6 +281,10 @@ fn run_and_exit(event_loop: EventLoop<UserEvent>, mut winit_app: impl WinitApp + | |||
} | |||
|
|||
winit::event::Event::UserEvent(UserEvent::RequestRepaint { when, frame_nr }) => { | |||
// WaitUntil seems to not work on iOS | |||
#[cfg(target_os = "ios")] | |||
winit_app.window().unwrap().request_redraw(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense to move this to line 340 (covers more cases)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've updated it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This allows egui and eframe to work correctly on iOS.
Without these changes it wouldn't compile because winit doesn't support run_and_return on iOS.
Also request_redraw was not working, seems like WaitUntil was not working correctly, I'm not sure why though. My fix is to repaint immideately but that might need to be investigated some more.
Then, after changing screen orientation, the screen wouldn't return to full size, because egui was trying to restore the previous window size. I've disabled this behaviour for iOS since it doesn't seem like it would make sense there anyways.