From 0a75f399a871ecfa119b23b52c8a4ec92819eaeb Mon Sep 17 00:00:00 2001 From: TechnoPorg Date: Mon, 13 Oct 2025 15:28:53 -0400 Subject: [PATCH] Add `x11` and `wayland` feature flags --- Cargo.lock | 62 +++++--------------------------------- Cargo.toml | 16 ++++++---- examples/editor/Cargo.toml | 1 + renderer/Cargo.toml | 2 ++ src/lib.rs | 11 +++++++ tester/Cargo.toml | 3 ++ tiny_skia/Cargo.toml | 2 ++ winit/Cargo.toml | 4 +-- 8 files changed, 39 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 417e30b6..f11cc687 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -208,8 +208,6 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6cbdf310d77fd3aaee6ea2093db7011dc2d35d2eb3481e5607f1f8d942ed99df" dependencies = [ - "async-fs", - "async-net", "enumflags2", "futures-channel", "futures-util", @@ -217,6 +215,7 @@ dependencies = [ "raw-window-handle", "serde", "serde_repr", + "tokio", "url", "wayland-backend", "wayland-client", @@ -1349,45 +1348,6 @@ name = "dpi" version = "0.1.1" source = "git+https://github.com/iced-rs/winit.git?rev=05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed#05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" -[[package]] -name = "drm" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1" -dependencies = [ - "bitflags 2.10.0", - "bytemuck", - "drm-ffi", - "drm-fourcc", - "rustix 0.38.44", -] - -[[package]] -name = "drm-ffi" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53" -dependencies = [ - "drm-sys", - "rustix 0.38.44", -] - -[[package]] -name = "drm-fourcc" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" - -[[package]] -name = "drm-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd39dde40b6e196c2e8763f23d119ddb1a8714534bf7d77fa97a65b0feda3986" -dependencies = [ - "libc", - "linux-raw-sys 0.6.5", -] - [[package]] name = "editor" version = "0.1.0" @@ -3066,12 +3026,6 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" -[[package]] -name = "linux-raw-sys" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a385b1be4e5c3e362ad2ffa73c392e53f031eaa5b7d648e64cd87f27f6063d7" - [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -4884,9 +4838,9 @@ dependencies = [ [[package]] name = "rfd" -version = "0.15.4" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed" +checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672" dependencies = [ "ashpd", "block2 0.6.2", @@ -4903,7 +4857,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -5477,7 +5431,6 @@ dependencies = [ "bytemuck", "cfg_aliases", "core-graphics 0.24.0", - "drm", "fastrand", "foreign-types 0.5.0", "js-sys", @@ -5898,7 +5851,6 @@ checksum = "0324504befd01cab6e0c994f34b2ffa257849ee019d3fb3b64fb2c858887d89e" dependencies = [ "as-raw-xcb-connection", "ctor-lite", - "libloading", "pkg-config", "tracing", ] @@ -5974,6 +5926,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.6.1", "tokio-macros", + "tracing", "windows-sys 0.61.2", ] @@ -7001,9 +6954,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "window_clipboard" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d692d46038c433f9daee7ad8757e002a4248c20b0a3fbc991d99521d3bcb6d" +checksum = "5793d0b08c9e6a1240fe9ab2bd8db277487bf92436fd1a6321861a90a1b0cb7e" dependencies = [ "clipboard-win", "clipboard_macos", @@ -7697,6 +7650,7 @@ dependencies = [ "ordered-stream", "serde", "serde_repr", + "tokio", "tracing", "uds_windows", "uuid", diff --git a/Cargo.toml b/Cargo.toml index 7dca04c1..14d50e73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ all-features = true maintenance = { status = "actively-developed" } [features] -default = ["wgpu", "tiny-skia", "crisp", "web-colors", "thread-pool", "linux-theme-detection"] +default = ["wgpu", "tiny-skia", "crisp", "web-colors", "thread-pool", "linux-theme-detection", "x11", "wayland"] # Enables the `wgpu` GPU-accelerated renderer with all its default features (Vulkan, Metal, DX12, OpenGL, and WebGPU) wgpu = ["wgpu-bare", "iced_renderer/wgpu"] # Enables the `wgpu` GPU-accelerated renderer with the minimum required features (no backends!) @@ -85,6 +85,10 @@ unconditional-rendering = ["iced_winit/unconditional-rendering"] sipper = ["iced_runtime/sipper"] # Enables Linux system theme detection linux-theme-detection = ["iced_winit/linux-theme-detection"] +# Enables the Unix X11 backend +x11 = ["iced_renderer/x11", "iced_winit/x11"] +# Enables the Unix Wayland backend +wayland = ["iced_renderer/wayland", "iced_winit/wayland", "iced_winit/wayland-csd-adwaita", "iced_tester?/wayland"] [dependencies] iced_debug.workspace = true @@ -176,10 +180,10 @@ iced_runtime = { version = "0.14.0-dev", path = "runtime" } iced_selector = { version = "0.14.0-dev", path = "selector" } iced_test = { version = "0.14.0-dev", path = "test" } iced_tester = { version = "0.14.0-dev", path = "tester" } -iced_tiny_skia = { version = "0.14.0-dev", path = "tiny_skia" } +iced_tiny_skia = { version = "0.14.0-dev", path = "tiny_skia", default-features = false } iced_wgpu = { version = "0.14.0-dev", path = "wgpu", default-features = false } iced_widget = { version = "0.14.0-dev", path = "widget" } -iced_winit = { version = "0.14.0-dev", path = "winit" } +iced_winit = { version = "0.14.0-dev", path = "winit", default-features = false } bincode = "1.3" bitflags = "2.0" @@ -208,7 +212,7 @@ pulldown-cmark = "0.12" qrcode = { version = "0.13", default-features = false } raw-window-handle = "0.6" resvg = "0.45" -rfd = "0.15" +rfd = { version = "0.16", default-features = false } rustc-hash = "2.0" semver = "1.0" serde = "1.0" @@ -216,7 +220,7 @@ sha2 = "0.10" sipper = "0.1" smol = "2" smol_str = "0.2" -softbuffer = "0.4" +softbuffer = { version = "0.4", default-features = false } syntect = "5.1" sysinfo = "0.33" thiserror = "2" @@ -230,7 +234,7 @@ wasmtimer = "0.4.1" web-sys = "0.3.69" web-time = "1.1" wgpu = { version = "27.0", default-features = false, features = ["std", "wgsl"] } -window_clipboard = "0.4.1" +window_clipboard = "0.5" winit = { git = "https://github.com/iced-rs/winit.git", rev = "05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" } [workspace.lints.rust] diff --git a/examples/editor/Cargo.toml b/examples/editor/Cargo.toml index d3f408d6..cb7d51b2 100644 --- a/examples/editor/Cargo.toml +++ b/examples/editor/Cargo.toml @@ -13,3 +13,4 @@ tokio.workspace = true tokio.features = ["fs"] rfd.workspace = true +rfd.features = ["xdg-portal", "wayland", "tokio"] diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index c95cae1b..f025927a 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -24,6 +24,8 @@ web-colors = ["iced_wgpu?/web-colors"] webgl = ["iced_wgpu?/webgl"] fira-sans = ["iced_graphics/fira-sans"] strict-assertions = ["iced_wgpu?/strict-assertions"] +x11 = ["iced_tiny_skia?/x11"] +wayland = ["iced_tiny_skia?/wayland"] [dependencies] iced_graphics.workspace = true diff --git a/src/lib.rs b/src/lib.rs index 13a459c7..e0cf7646 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -496,6 +496,17 @@ compile_error!( Available options: thread-pool, tokio, or smol." ); +#[cfg(all( + target_family = "unix", + not(feature = "wayland"), + not(feature = "x11"), +))] +compile_error!( + "No Unix display server backend has been enabled. You must enable a \ + display server feature.\n\ + Available options: x11, wayland." +); + #[cfg(feature = "highlighter")] pub use iced_highlighter as highlighter; diff --git a/tester/Cargo.toml b/tester/Cargo.toml index 4f97bac3..229ab66b 100644 --- a/tester/Cargo.toml +++ b/tester/Cargo.toml @@ -10,6 +10,9 @@ categories.workspace = true keywords.workspace = true rust-version.workspace = true +[features] +wayland = ["rfd/wayland"] + [dependencies] iced_test.workspace = true iced_widget.workspace = true diff --git a/tiny_skia/Cargo.toml b/tiny_skia/Cargo.toml index 87aa74e5..eb9f98fc 100644 --- a/tiny_skia/Cargo.toml +++ b/tiny_skia/Cargo.toml @@ -17,6 +17,8 @@ workspace = true image = ["iced_graphics/image"] svg = ["iced_graphics/svg", "resvg"] geometry = ["iced_graphics/geometry"] +x11 = ["softbuffer/x11"] +wayland = ["softbuffer/wayland"] [dependencies] iced_debug.workspace = true diff --git a/winit/Cargo.toml b/winit/Cargo.toml index ebac340b..42ec755d 100644 --- a/winit/Cargo.toml +++ b/winit/Cargo.toml @@ -17,8 +17,8 @@ workspace = true default = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"] debug = ["iced_debug/enable"] sysinfo = ["dep:sysinfo"] -x11 = ["winit/x11"] -wayland = ["winit/wayland"] +x11 = ["winit/x11", "window_clipboard/x11"] +wayland = ["winit/wayland", "window_clipboard/wayland"] wayland-dlopen = ["winit/wayland-dlopen"] wayland-csd-adwaita = ["winit/wayland-csd-adwaita"] unconditional-rendering = []