Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,18 @@ jobs:
- run: rustup target add wasm32-unknown-unknown
- run: ./sh/setup_web.sh
- run: ./sh/wasm_bindgen_check.sh

android:
name: android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.61.0
target: aarch64-linux-android
override: true

- run: cargo check --features wgpu --target aarch64-linux-android
working-directory: eframe
16 changes: 9 additions & 7 deletions eframe/src/native/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ mod wgpu_integration {
.unwrap();

// SAFETY: `window` must outlive `painter`.
#[allow(unsafe_code)]
#[allow(unsafe_code, unused_mut, unused_unsafe)]
let painter = unsafe {
let mut painter = egui_wgpu::winit::Painter::new(
wgpu::Backends::PRIMARY | wgpu::Backends::GL,
Expand All @@ -486,7 +486,7 @@ mod wgpu_integration {
painter
};

let wgpu_render_state = painter.render_state().expect("Uninitialized");
let wgpu_render_state = painter.render_state();

let system_theme = native_options.system_theme();
let mut integration = epi_integration::EpiIntegration::new(
Expand All @@ -497,7 +497,7 @@ mod wgpu_integration {
storage,
#[cfg(feature = "glow")]
None,
Some(wgpu_render_state.clone()),
wgpu_render_state.clone(),
);
let theme = system_theme.unwrap_or(native_options.default_theme);
integration.egui_ctx.set_visuals(theme.egui_visuals());
Expand All @@ -515,7 +515,7 @@ mod wgpu_integration {
storage: integration.frame.storage(),
#[cfg(feature = "glow")]
gl: None,
wgpu_render_state: Some(wgpu_render_state),
wgpu_render_state,
});

if app.warm_up_enabled() {
Expand Down Expand Up @@ -629,11 +629,13 @@ mod wgpu_integration {
match event {
#[cfg(target_os = "android")]
winit::event::Event::Resumed => unsafe {
painter.set_window(Some(&window));
self.painter.set_window(Some(&self.window));
EventResult::RepaintAsap
},
#[cfg(target_os = "android")]
winit::event::Event::Paused => unsafe {
painter.set_window(None);
winit::event::Event::Suspended => unsafe {
self.painter.set_window(None);
EventResult::Wait
},

winit::event::Event::WindowEvent { event, .. } => {
Expand Down
4 changes: 3 additions & 1 deletion egui-winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ tracing = { version = "0.1", default-features = false, features = ["std"] }
winit = "0.27.2"

#! ### Optional dependencies
arboard = { version = "2.1", optional = true, default-features = false }

## Enable this when generating docs.
document-features = { version = "0.2", optional = true }
Expand All @@ -64,3 +63,6 @@ webbrowser = { version = "0.7", optional = true }

[target.'cfg(any(target_os="linux", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
smithay-clipboard = { version = "0.6.3", optional = true }

[target.'cfg(not(target_os = "android"))'.dependencies]
arboard = { version = "2.1", optional = true, default-features = false }
10 changes: 5 additions & 5 deletions egui-winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::os::raw::c_void;
/// If the "clipboard" feature is off, or we cannot connect to the OS clipboard,
/// then a fallback clipboard that just works works within the same app is used instead.
pub struct Clipboard {
#[cfg(feature = "arboard")]
#[cfg(all(feature = "arboard", not(target_os = "android")))]
arboard: Option<arboard::Clipboard>,

#[cfg(all(
Expand All @@ -28,7 +28,7 @@ impl Clipboard {
#[allow(unused_variables)]
pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self {
Self {
#[cfg(feature = "arboard")]
#[cfg(all(feature = "arboard", not(target_os = "android")))]
arboard: init_arboard(),
#[cfg(all(
any(
Expand Down Expand Up @@ -66,7 +66,7 @@ impl Clipboard {
};
}

#[cfg(feature = "arboard")]
#[cfg(all(feature = "arboard", not(target_os = "android")))]
if let Some(clipboard) = &mut self.arboard {
return match clipboard.get_text() {
Ok(text) => Some(text),
Expand Down Expand Up @@ -96,7 +96,7 @@ impl Clipboard {
return;
}

#[cfg(feature = "arboard")]
#[cfg(all(feature = "arboard", not(target_os = "android")))]
if let Some(clipboard) = &mut self.arboard {
if let Err(err) = clipboard.set_text(text) {
tracing::error!("Copy/Cut error: {}", err);
Expand All @@ -108,7 +108,7 @@ impl Clipboard {
}
}

#[cfg(feature = "arboard")]
#[cfg(all(feature = "arboard", not(target_os = "android")))]
fn init_arboard() -> Option<arboard::Clipboard> {
match arboard::Clipboard::new() {
Ok(clipboard) => Some(clipboard),
Expand Down