Skip to content

Commit cf8d847

Browse files
committed
Don't enable arboard on iOS
`arboard` doesn't support support iOS yet: 1Password/arboard#103 Launching an app on a physical device results in a long timeout while trying to connect to the X11 server (the timeout is immediate when launching on a simulator).
1 parent bf5604b commit cf8d847

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

crates/egui-winit/src/clipboard.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use raw_window_handle::RawDisplayHandle;
55
/// If the "clipboard" feature is off, or we cannot connect to the OS clipboard,
66
/// then a fallback clipboard that just works within the same app is used instead.
77
pub struct Clipboard {
8-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
8+
#[cfg(all(
9+
not(any(target_os = "android", target_os = "ios")),
10+
feature = "arboard",
11+
))]
912
arboard: Option<arboard::Clipboard>,
1013

1114
#[cfg(all(
@@ -28,7 +31,10 @@ impl Clipboard {
2831
/// Construct a new instance
2932
pub fn new(_raw_display_handle: Option<RawDisplayHandle>) -> Self {
3033
Self {
31-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
34+
#[cfg(all(
35+
not(any(target_os = "android", target_os = "ios")),
36+
feature = "arboard",
37+
))]
3238
arboard: init_arboard(),
3339

3440
#[cfg(all(
@@ -68,7 +74,10 @@ impl Clipboard {
6874
};
6975
}
7076

71-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
77+
#[cfg(all(
78+
not(any(target_os = "android", target_os = "ios")),
79+
feature = "arboard",
80+
))]
7281
if let Some(clipboard) = &mut self.arboard {
7382
return match clipboard.get_text() {
7483
Ok(text) => Some(text),
@@ -98,7 +107,10 @@ impl Clipboard {
98107
return;
99108
}
100109

101-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
110+
#[cfg(all(
111+
not(any(target_os = "android", target_os = "ios")),
112+
feature = "arboard",
113+
))]
102114
if let Some(clipboard) = &mut self.arboard {
103115
if let Err(err) = clipboard.set_text(text) {
104116
log::error!("arboard copy/cut error: {err}");
@@ -110,7 +122,10 @@ impl Clipboard {
110122
}
111123

112124
pub fn set_image(&mut self, image: &egui::ColorImage) {
113-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
125+
#[cfg(all(
126+
not(any(target_os = "android", target_os = "ios")),
127+
feature = "arboard",
128+
))]
114129
if let Some(clipboard) = &mut self.arboard {
115130
if let Err(err) = clipboard.set_image(arboard::ImageData {
116131
width: image.width(),
@@ -130,7 +145,10 @@ impl Clipboard {
130145
}
131146
}
132147

133-
#[cfg(all(feature = "arboard", not(target_os = "android")))]
148+
#[cfg(all(
149+
not(any(target_os = "android", target_os = "ios")),
150+
feature = "arboard",
151+
))]
134152
fn init_arboard() -> Option<arboard::Clipboard> {
135153
profiling::function_scope!();
136154

0 commit comments

Comments
 (0)