Skip to content
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

Merged
merged 6 commits into from
Aug 22, 2023
Merged

Fix iOS support in eframe #3241

merged 6 commits into from
Aug 22, 2023

Conversation

lucasmerlin
Copy link
Collaborator

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.

@emilk emilk added the eframe Relates to epi and eframe label Aug 11, 2023
@@ -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();
Copy link
Owner

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)

Copy link
Collaborator Author

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

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@emilk emilk changed the title Fix ios support Fix iOS support in eframe Aug 22, 2023
@emilk emilk merged commit 461328f into emilk:master Aug 22, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants