From 51872bca8b17f08046fbecdf75c93d1e33c83cab Mon Sep 17 00:00:00 2001 From: Cody Wyatt Neiman Date: Sun, 15 Dec 2024 15:05:22 -0500 Subject: [PATCH 1/4] Fix unspecified wayland/x11 dep from clipboard feature --- crates/eframe/Cargo.toml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index eb4766dfaab..a8ff25b2910 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -82,6 +82,16 @@ wayland = [ "glutin-winit?/wayland", ] +## Enables wayland support and fixes clipboard issue. +wayland = [ + "egui-winit/wayland", + "egui-wgpu?/wayland", + "egui_glow?/wayland", + "glutin?/wayland", + "glutin-winit?/wayland", + "egui-winit/smithay-clipboard", +] + ## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web. ## ## For other platforms, use the `accesskit` feature instead. @@ -114,6 +124,7 @@ x11 = [ "glutin?/glx", "glutin-winit?/x11", "glutin-winit?/glx", + "egui-winit/arboard", ] ## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit. @@ -146,7 +157,6 @@ serde = { workspace = true, optional = true } # native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] egui-winit = { workspace = true, default-features = false, features = [ - "clipboard", "links", ] } image = { workspace = true, features = ["png"] } # Needed for app icon @@ -176,6 +186,10 @@ wgpu = { workspace = true, optional = true, features = [ # mac: [target.'cfg(any(target_os = "macos"))'.dependencies] +egui-winit = { workspace = true, default-features = false, features = [ + "arboard", + "links", +] } objc2 = "0.5.1" objc2-foundation = { version = "0.2.0", features = [ "block2", @@ -192,6 +206,10 @@ objc2-app-kit = { version = "0.2.0", features = [ # windows: [target.'cfg(any(target_os = "windows"))'.dependencies] +egui-winit = { workspace = true, default-features = false, features = [ + "arboard", + "links", +] } winapi = { version = "0.3.9", features = ["winuser"] } windows-sys = { workspace = true, features = [ "Win32_Foundation", From bd8dfa178dbceab70b38915763101eefe22e6edb Mon Sep 17 00:00:00 2001 From: Cody Wyatt Neiman Date: Sun, 15 Dec 2024 16:10:31 -0500 Subject: [PATCH 2/4] Fix clipboard x11/wayland dep issue inside egui-winit as well --- crates/eframe/Cargo.toml | 8 ++++---- crates/egui-winit/Cargo.toml | 10 ++++++++-- crates/egui-winit/src/clipboard.rs | 2 ++ crates/egui_glow/Cargo.toml | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index a8ff25b2910..0397074edf1 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -89,7 +89,7 @@ wayland = [ "egui_glow?/wayland", "glutin?/wayland", "glutin-winit?/wayland", - "egui-winit/smithay-clipboard", + "egui-winit/clipboard-wayland", ] ## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web. @@ -124,7 +124,7 @@ x11 = [ "glutin?/glx", "glutin-winit?/x11", "glutin-winit?/glx", - "egui-winit/arboard", + "egui-winit/clipboard-nonwayland", ] ## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit. @@ -187,7 +187,7 @@ wgpu = { workspace = true, optional = true, features = [ # mac: [target.'cfg(any(target_os = "macos"))'.dependencies] egui-winit = { workspace = true, default-features = false, features = [ - "arboard", + "clipboard-nonwayland", "links", ] } objc2 = "0.5.1" @@ -207,7 +207,7 @@ objc2-app-kit = { version = "0.2.0", features = [ # windows: [target.'cfg(any(target_os = "windows"))'.dependencies] egui-winit = { workspace = true, default-features = false, features = [ - "arboard", + "clipboard-nonwayland", "links", ] } winapi = { version = "0.3.9", features = ["winuser"] } diff --git a/crates/egui-winit/Cargo.toml b/crates/egui-winit/Cargo.toml index c584db85e70..8589b56bd59 100644 --- a/crates/egui-winit/Cargo.toml +++ b/crates/egui-winit/Cargo.toml @@ -21,7 +21,7 @@ all-features = true rustdoc-args = ["--generate-link-to-definition"] [features] -default = ["clipboard", "links", "wayland", "winit/default", "x11"] +default = ["clipboard-nonwayland", "links", "wayland", "winit/default", "x11"] ## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/). accesskit = ["dep:accesskit_winit", "egui/accesskit"] @@ -40,7 +40,13 @@ bytemuck = ["egui/bytemuck"] ## Enable cut/copy/paste to OS clipboard. ## If disabled a clipboard will be simulated so you can still copy/paste within the egui app. -clipboard = ["arboard", "smithay-clipboard"] +clipboard = ["clipboard-nonwayland", "clipboard-wayland"] +## Enable cut/copy/paste to OS clipboard on **non-wayland** systems. +## If disabled a clipboard will be simulated so you can still copy/paste within the egui app. +clipboard-nonwayland = ["arboard"] +## Enable cut/copy/paste to OS clipboard on **wayland** systems. +## If disabled a clipboard will be simulated so you can still copy/paste within the egui app. +clipboard-wayland = ["wayland", "smithay-clipboard"] ## Enable opening links in a browser when an egui hyperlink is clicked. links = ["webbrowser"] diff --git a/crates/egui-winit/src/clipboard.rs b/crates/egui-winit/src/clipboard.rs index c4192f78d55..8403fb36a03 100644 --- a/crates/egui-winit/src/clipboard.rs +++ b/crates/egui-winit/src/clipboard.rs @@ -47,6 +47,8 @@ impl Clipboard { } } + #[allow(clippy::unnecessary_wraps)] // for implementation consistency + #[allow(clippy::needless_pass_by_ref_mut)] // for implementation consistency pub fn get(&mut self) -> Option { #[cfg(all( any( diff --git a/crates/egui_glow/Cargo.toml b/crates/egui_glow/Cargo.toml index 7a402d4067a..fed6d935872 100644 --- a/crates/egui_glow/Cargo.toml +++ b/crates/egui_glow/Cargo.toml @@ -33,7 +33,7 @@ default = [] ## enable cut/copy/paste to os clipboard. ## ## if disabled a clipboard will be simulated so you can still copy/paste within the egui app. -clipboard = ["egui-winit?/clipboard"] +clipboard = ["egui-winit?/clipboard-nonwayland"] ## For the `winit` integration: ## enable opening links in a browser when an egui hyperlink is clicked. @@ -43,7 +43,7 @@ links = ["egui-winit?/links"] winit = ["egui-winit", "dep:winit"] ## Enables Wayland support for winit. -wayland = ["winit?/wayland"] +wayland = ["winit?/wayland", "egui-winit/clipboard-wayland"] ## Enables x11 support for winit. x11 = ["winit?/x11"] From 6d41ab5883e05f88d83afef8a33a2a59f187bcd7 Mon Sep 17 00:00:00 2001 From: Cody Wyatt Neiman Date: Sun, 15 Dec 2024 16:12:19 -0500 Subject: [PATCH 3/4] Reorder egui-winit feature deps in eframe --- crates/eframe/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index 0397074edf1..36d469017ed 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -85,11 +85,11 @@ wayland = [ ## Enables wayland support and fixes clipboard issue. wayland = [ "egui-winit/wayland", + "egui-winit/clipboard-wayland", "egui-wgpu?/wayland", "egui_glow?/wayland", "glutin?/wayland", "glutin-winit?/wayland", - "egui-winit/clipboard-wayland", ] ## Enable screen reader support (requires `ctx.options_mut(|o| o.screen_reader = true);`) on web. @@ -118,13 +118,13 @@ wgpu = ["dep:wgpu", "dep:egui-wgpu", "dep:pollster"] ## Enables compiling for x11. x11 = [ "egui-winit/x11", + "egui-winit/clipboard-nonwayland", "egui-wgpu?/x11", "egui_glow?/x11", "glutin?/x11", "glutin?/glx", "glutin-winit?/x11", "glutin-winit?/glx", - "egui-winit/clipboard-nonwayland", ] ## If set, eframe will look for the env-var `EFRAME_SCREENSHOT_TO` and write a screenshot to that location, and then quit. From 288ccb6184a49b4eb21b2252f41219607eed8fc9 Mon Sep 17 00:00:00 2001 From: Cody Wyatt Neiman Date: Wed, 18 Dec 2024 13:28:32 -0500 Subject: [PATCH 4/4] Fix rebase duplicate wayland feature --- crates/eframe/Cargo.toml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index 36d469017ed..eab3184addb 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -74,15 +74,6 @@ persistence = [ ## Enables wayland support and fixes clipboard issue. ## ## If you are compiling for Linux (or want to test on a CI system using Linux), you should enable this feature. -wayland = [ - "egui-winit/wayland", - "egui-wgpu?/wayland", - "egui_glow?/wayland", - "glutin?/wayland", - "glutin-winit?/wayland", -] - -## Enables wayland support and fixes clipboard issue. wayland = [ "egui-winit/wayland", "egui-winit/clipboard-wayland",