diff --git a/internal/backends/winit/build.rs b/internal/backends/winit/build.rs index 986db0b3e92..44374c63fdf 100644 --- a/internal/backends/winit/build.rs +++ b/internal/backends/winit/build.rs @@ -8,7 +8,7 @@ fn main() { cfg_aliases! { enable_skia_renderer: { any(feature = "renderer-skia", feature = "renderer-skia-opengl", feature = "renderer-skia-vulkan")}, enable_accesskit: { all(feature = "accessibility", not(target_arch = "wasm32")) }, - supports_opengl: { any(enable_skia_renderer, feature = "renderer-femtovg")} + supports_opengl: { all(any(enable_skia_renderer, feature = "renderer-femtovg"), not(target_os = "ios")) } } // This uses `web_sys_unstable_api`, which is typically set via `RUST_FLAGS` println!("cargo:rustc-check-cfg=cfg(web_sys_unstable_apis)"); diff --git a/internal/backends/winit/event_loop.rs b/internal/backends/winit/event_loop.rs index 4ee84d4ae1c..110a8c4f9a7 100644 --- a/internal/backends/winit/event_loop.rs +++ b/internal/backends/winit/event_loop.rs @@ -43,7 +43,7 @@ impl NotRunningEventLoop { let mut builder = builder.unwrap_or_else(|| winit::event_loop::EventLoop::with_user_event()); - #[cfg(all(unix, not(target_os = "macos")))] + #[cfg(all(unix, not(target_vendor = "apple")))] { #[cfg(feature = "wayland")] { @@ -126,7 +126,7 @@ impl EventLoopInterface for NotRunningEventLoop { fn event_loop(&self) -> ActiveOrInactiveEventLoop<'_> { ActiveOrInactiveEventLoop::Inactive(&self.instance) } - #[cfg(all(unix, not(target_os = "macos"), feature = "wayland"))] + #[cfg(all(unix, not(target_vendor = "apple"), feature = "wayland"))] fn is_wayland(&self) -> bool { use winit::platform::wayland::EventLoopExtWayland; return self.instance.is_wayland(); @@ -143,7 +143,7 @@ impl<'a> EventLoopInterface for RunningEventLoop<'a> { fn event_loop(&self) -> ActiveOrInactiveEventLoop<'_> { ActiveOrInactiveEventLoop::Active(self.active_event_loop) } - #[cfg(all(unix, not(target_os = "macos"), feature = "wayland"))] + #[cfg(all(unix, not(target_vendor = "apple"), feature = "wayland"))] fn is_wayland(&self) -> bool { use winit::platform::wayland::ActiveEventLoopExtWayland; return self.active_event_loop.is_wayland(); @@ -352,7 +352,7 @@ impl winit::application::ApplicationHandler for EventLoopState { WindowEvent::KeyboardInput { event, is_synthetic, .. } => { let key_code = event.logical_key; // For now: Match Qt's behavior of mapping command to control and control to meta (LWin/RWin). - #[cfg(target_os = "macos")] + #[cfg(target_vendor = "apple")] let key_code = match key_code { winit::keyboard::Key::Named(winit::keyboard::NamedKey::Control) => { winit::keyboard::Key::Named(winit::keyboard::NamedKey::Super) @@ -690,7 +690,7 @@ impl EventLoopState { let mut winit_loop = not_running_loop_instance.instance; - #[cfg(not(target_arch = "wasm32"))] + #[cfg(all(not(target_arch = "wasm32"), not(target_os = "ios")))] { use winit::platform::run_on_demand::EventLoopExtRunOnDemand as _; winit_loop @@ -714,7 +714,7 @@ impl EventLoopState { Ok(self) } - #[cfg(target_arch = "wasm32")] + #[cfg(any(target_arch = "wasm32", target_os = "ios"))] { winit_loop .run_app(&mut ActiveEventLoopSetterDuringEventProcessing(&mut self)) @@ -726,7 +726,7 @@ impl EventLoopState { /// Runs the event loop and renders the items in the provided `component` in its /// own window. - #[cfg(not(target_arch = "wasm32"))] + #[cfg(all(not(target_arch = "wasm32"), not(target_os = "ios")))] pub fn pump_events( mut self, timeout: Option, diff --git a/internal/backends/winit/lib.rs b/internal/backends/winit/lib.rs index 27226dd54f5..5c6691d7899 100644 --- a/internal/backends/winit/lib.rs +++ b/internal/backends/winit/lib.rs @@ -271,7 +271,7 @@ impl BackendBuilder { } #[cfg(enable_skia_renderer)] (Some("skia"), None) => renderer::skia::WinitSkiaRenderer::new_suspended, - #[cfg(enable_skia_renderer)] + #[cfg(all(enable_skia_renderer, supports_opengl))] (Some("skia-opengl"), _) | (Some("skia"), Some(_)) => { renderer::skia::WinitSkiaRenderer::new_opengl_suspended } @@ -452,7 +452,7 @@ impl i_slint_core::platform::Platform for Backend { Ok(()) } - #[cfg(not(target_arch = "wasm32"))] + #[cfg(all(not(target_arch = "wasm32"), not(target_os = "ios")))] fn process_events( &self, timeout: core::time::Duration, diff --git a/internal/backends/winit/renderer/skia.rs b/internal/backends/winit/renderer/skia.rs index 014cb91ee70..a8204cb519a 100644 --- a/internal/backends/winit/renderer/skia.rs +++ b/internal/backends/winit/renderer/skia.rs @@ -29,6 +29,7 @@ impl WinitSkiaRenderer { }) } + #[cfg(not(target_os = "ios"))] pub fn new_opengl_suspended() -> Box { Box::new(Self { renderer: i_slint_renderer_skia::SkiaRenderer::default_opengl(), diff --git a/internal/backends/winit/winitwindowadapter.rs b/internal/backends/winit/winitwindowadapter.rs index 2fc092983bc..cfcc14d0780 100644 --- a/internal/backends/winit/winitwindowadapter.rs +++ b/internal/backends/winit/winitwindowadapter.rs @@ -353,7 +353,7 @@ impl WinitWindowAdapter { WinitWindowOrNone::None(attributes) => attributes.borrow().clone(), }; - #[cfg(all(unix, not(target_os = "macos")))] + #[cfg(all(unix, not(target_vendor = "apple")))] { if let Some(xdg_app_id) = WindowInner::from_pub(self.window()).xdg_app_id() { #[cfg(feature = "wayland")] diff --git a/internal/renderers/skia/Cargo.toml b/internal/renderers/skia/Cargo.toml index 57beed4a69b..0beb236fba3 100644 --- a/internal/renderers/skia/Cargo.toml +++ b/internal/renderers/skia/Cargo.toml @@ -46,11 +46,12 @@ skia-safe = { version = "0.78.0", features = ["textlayout", "gl"] } glow = { version = "0.13" } unicode-segmentation = { version = "1.8.0" } -glutin = { workspace = true, default-features = false, features = ["egl", "wgl"] } - ash = { version = "^0.37.2", optional = true } vulkano = { version = "0.34.0", optional = true, default-features = false } +[target.'cfg(not(target_os = "ios"))'.dependencies] +glutin = { workspace = true, default-features = false, features = ["egl", "wgl"] } + [target.'cfg(not(target_os = "android"))'.dependencies] # software renderer fallback softbuffer = { workspace = true, default-features = false } diff --git a/internal/renderers/skia/build.rs b/internal/renderers/skia/build.rs index ef2a731ff52..fd1a24e47c4 100644 --- a/internal/renderers/skia/build.rs +++ b/internal/renderers/skia/build.rs @@ -6,8 +6,8 @@ use cfg_aliases::cfg_aliases; fn main() { // Setup cfg aliases cfg_aliases! { - skia_backend_opengl: { any(feature = "opengl", not(any(target_os = "macos", target_family = "windows", target_arch = "wasm32"))) }, - skia_backend_metal: { all(target_os = "macos", not(feature = "opengl")) }, + skia_backend_opengl: { any(feature = "opengl", not(any(target_vendor = "apple", target_family = "windows", target_arch = "wasm32"))) }, + skia_backend_metal: { all(target_vendor = "apple", not(feature = "opengl")) }, skia_backend_d3d: { all(target_family = "windows", not(feature = "opengl")) }, skia_backend_vulkan: { feature = "vulkan" }, skia_backend_software: { not(target_os = "android") }, diff --git a/internal/renderers/skia/lib.rs b/internal/renderers/skia/lib.rs index 858630acb7b..5bde28c0e6b 100644 --- a/internal/renderers/skia/lib.rs +++ b/internal/renderers/skia/lib.rs @@ -36,7 +36,7 @@ mod textlayout; #[cfg(skia_backend_software)] pub mod software_surface; -#[cfg(target_os = "macos")] +#[cfg(target_vendor = "apple")] pub mod metal_surface; #[cfg(target_family = "windows")] @@ -45,6 +45,7 @@ pub mod d3d_surface; #[cfg(skia_backend_vulkan)] pub mod vulkan_surface; +#[cfg(not(target_os = "ios"))] pub mod opengl_surface; use i_slint_core::items::TextWrap; @@ -163,6 +164,7 @@ impl SkiaRenderer { } } + #[cfg(not(target_os = "ios"))] /// Creates a new SkiaRenderer that will always use Skia's OpenGL renderer. pub fn default_opengl() -> Self { let (partial_rendering_state, visualize_dirty_region) = create_partial_renderer_state();