mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Fix iOS build, and add iOS step to CI (#4898)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> This PR - adds a pipeline to check the ios build - removes the iOS WaitUntil workaround, which doesn't seem to be necessary anymore after the winit update (and caused the build for iOS to fail again because of a missing self - ~removes a iOS workaround for window size which doesn't seem necessary anymore~ Turns out it was still needed (but you need to actually restart the app for the issue to show up, so I didn't catch it first) - fixes some cargo check errors in run.rs I've done all these changes in a single PR because otherwise the pipeline doesn't run but I can also split them in separate PRs if that makes it easier to review
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::{cell::RefCell, time::Instant};
|
||||
use std::time::Instant;
|
||||
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
@@ -32,11 +32,12 @@ fn create_event_loop(native_options: &mut epi::NativeOptions) -> Result<EventLoo
|
||||
///
|
||||
/// We reuse the event-loop so we can support closing and opening an eframe window
|
||||
/// multiple times. This is just a limitation of winit.
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
fn with_event_loop<R>(
|
||||
mut native_options: epi::NativeOptions,
|
||||
f: impl FnOnce(&mut EventLoop<UserEvent>, epi::NativeOptions) -> R,
|
||||
) -> Result<R> {
|
||||
thread_local!(static EVENT_LOOP: RefCell<Option<EventLoop<UserEvent>>> = RefCell::new(None));
|
||||
thread_local!(static EVENT_LOOP: std::cell::RefCell<Option<EventLoop<UserEvent>>> = std::cell::RefCell::new(None));
|
||||
|
||||
EVENT_LOOP.with(|event_loop| {
|
||||
// Since we want to reference NativeOptions when creating the EventLoop we can't
|
||||
@@ -174,16 +175,6 @@ impl<T: WinitApp> WinitAppWrapper<T> {
|
||||
});
|
||||
|
||||
if let Some(next_repaint_time) = next_repaint_time {
|
||||
// WaitUntil seems to not work on iOS
|
||||
#[cfg(target_os = "ios")]
|
||||
winit_app
|
||||
.window_id_from_viewport_id(egui::ViewportId::ROOT)
|
||||
.map(|window_id| {
|
||||
winit_app
|
||||
.window(window_id)
|
||||
.map(|window| window.request_redraw())
|
||||
});
|
||||
|
||||
event_loop.set_control_flow(ControlFlow::WaitUntil(next_repaint_time));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user