From 4833dd872099decd42ec05734ec2d5fb0a898578 Mon Sep 17 00:00:00 2001 From: Ian Hobson Date: Thu, 23 Oct 2025 10:24:06 +0200 Subject: [PATCH] Don't enable `arboard` on iOS (#7663) `arboard` [doesn't support support iOS yet](https://github.com/1Password/arboard/pull/103), so this PR adds iOS to the conditions that prevent `arboard` from being enabled. Launching an app on a physical device results in a long timeout (~8s) while trying to connect to the X11 server (the timeout is immediate when launching on a simulator), with the following trace: ``` egui_winit::clipboard: Failed to initialize arboard clipboard: Unknown error while interacting with the clipboard: X11 server connection timed out because it was unreachable ``` * [x] I have followed the instructions in the PR template --- crates/egui-winit/src/clipboard.rs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/crates/egui-winit/src/clipboard.rs b/crates/egui-winit/src/clipboard.rs index cec4b43c..fc733438 100644 --- a/crates/egui-winit/src/clipboard.rs +++ b/crates/egui-winit/src/clipboard.rs @@ -5,7 +5,10 @@ use raw_window_handle::RawDisplayHandle; /// If the "clipboard" feature is off, or we cannot connect to the OS clipboard, /// then a fallback clipboard that just works within the same app is used instead. pub struct Clipboard { - #[cfg(all(feature = "arboard", not(target_os = "android")))] + #[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", + ))] arboard: Option, #[cfg(all( @@ -28,7 +31,10 @@ impl Clipboard { /// Construct a new instance pub fn new(_raw_display_handle: Option) -> Self { Self { - #[cfg(all(feature = "arboard", not(target_os = "android")))] + #[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", + ))] arboard: init_arboard(), #[cfg(all( @@ -68,7 +74,10 @@ impl Clipboard { }; } - #[cfg(all(feature = "arboard", not(target_os = "android")))] + #[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", + ))] if let Some(clipboard) = &mut self.arboard { return match clipboard.get_text() { Ok(text) => Some(text), @@ -98,7 +107,10 @@ impl Clipboard { return; } - #[cfg(all(feature = "arboard", not(target_os = "android")))] + #[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", + ))] if let Some(clipboard) = &mut self.arboard { if let Err(err) = clipboard.set_text(text) { log::error!("arboard copy/cut error: {err}"); @@ -110,7 +122,10 @@ impl Clipboard { } pub fn set_image(&mut self, image: &egui::ColorImage) { - #[cfg(all(feature = "arboard", not(target_os = "android")))] + #[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", + ))] if let Some(clipboard) = &mut self.arboard { if let Err(err) = clipboard.set_image(arboard::ImageData { width: image.width(), @@ -130,7 +145,10 @@ impl Clipboard { } } -#[cfg(all(feature = "arboard", not(target_os = "android")))] +#[cfg(all( + not(any(target_os = "android", target_os = "ios")), + feature = "arboard", +))] fn init_arboard() -> Option { profiling::function_scope!();