diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8aaa18faa36..79fee917825 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,4 +1,4 @@ -on: [push, pull_request] +on: [ push, pull_request ] name: Rust @@ -167,6 +167,26 @@ jobs: # --------------------------------------------------------------------------- + ios: + name: ios + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.76.0 + targets: aarch64-apple-ios + + - name: Set up cargo cache + uses: Swatinem/rust-cache@v2 + + # Default features are disabled because glutin doesn't compile for ios. + - run: cargo check --features wgpu --target aarch64-apple-ios --no-default-features + working-directory: crates/eframe + + # --------------------------------------------------------------------------- + windows: name: Check Windows runs-on: windows-latest diff --git a/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index 11029b9e5bc..3edc0992715 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -7,11 +7,12 @@ use winit::event_loop::ActiveEventLoop; use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _}; -use egui::{DeferredViewportUiCallback, NumExt as _, ViewportBuilder, ViewportId}; +use egui::{DeferredViewportUiCallback, ViewportBuilder, ViewportId}; use egui_winit::{EventResponse, WindowSettings}; use crate::epi; +#[cfg_attr(target_os = "ios", allow(dead_code, unused_variables, unused_mut))] pub fn viewport_builder( egui_zoom_factor: f32, event_loop: &ActiveEventLoop, @@ -53,8 +54,10 @@ pub fn viewport_builder( if clamp_size_to_monitor_size { if let Some(initial_window_size) = viewport_builder.inner_size { - let initial_window_size = initial_window_size - .at_most(largest_monitor_point_size(egui_zoom_factor, event_loop)); + let initial_window_size = egui::NumExt::at_most( + initial_window_size, + largest_monitor_point_size(egui_zoom_factor, event_loop), + ); viewport_builder = viewport_builder.with_inner_size(initial_window_size); } } @@ -95,6 +98,7 @@ pub fn apply_window_settings( } } +#[cfg(not(target_os = "ios"))] fn largest_monitor_point_size(egui_zoom_factor: f32, event_loop: &ActiveEventLoop) -> egui::Vec2 { crate::profile_function!(); diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index cd9ab3d66ee..61585f9bb4a 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -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( mut native_options: epi::NativeOptions, f: impl FnOnce(&mut EventLoop, epi::NativeOptions) -> R, ) -> Result { - thread_local!(static EVENT_LOOP: RefCell>> = RefCell::new(None)); + thread_local!(static EVENT_LOOP: std::cell::RefCell>> = 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 WinitAppWrapper { }); 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)); }; }