window_clipboard/Cargo.toml
leyoda 319db02e52
Some checks failed
Test / all (windows-latest, beta) (push) Has been cancelled
Test / all (windows-latest, stable) (push) Has been cancelled
Test / all (macOS-latest, beta) (push) Has been cancelled
Test / all (macOS-latest, stable) (push) Has been cancelled
Test / all (ubuntu-latest, beta) (push) Has been cancelled
Test / all (ubuntu-latest, stable) (push) Has been cancelled
yoda: gate clipboard_x11 behind an opt-in feature
Upstream pulled clipboard_x11 unconditionally on unix, which drags
x11rb + x11rb-protocol and ~500 symbols of X11 clipboard code into
every Wayland-only iced build. Add an x11 feature (default-on for
compat) that gates:
- the clipboard_x11 workspace dep (now optional)
- `pub use clipboard_x11 as x11` re-export
- the Clipboard::X11 enum variant
- every match arm that handles it
- the fallback branch in `unsafe fn connect` (returns a helpful
  error when called with a non-Wayland display handle)

Wayland-only builds set `window_clipboard = { ..., default-features = false, features = ["wayland"] }` and skip the x11 backend entirely.
2026-04-24 06:50:48 +02:00

45 lines
1.6 KiB
TOML

[package]
name = "window_clipboard"
version = "0.4.1"
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
edition = "2021"
description = "A library to obtain clipboard access from a `raw-window-handle`"
license = "MIT"
repository = "https://github.com/hecrj/window_clipboard"
documentation = "https://docs.rs/window_clipboard"
readme = "README.md"
keywords = ["clipboard", "window", "ui", "gui", "raw-window-handle"]
categories = ["gui"]
[features]
# Yoda: put the unix clipboard backends behind opt-in features. Upstream
# pulled both X11 + Wayland unconditionally on unix — pure bloat for
# Wayland-only builds (clipboard_x11 pulls x11rb + its protocol machinery).
# Default keeps both enabled to preserve upstream behaviour; yoda consumers
# pass default-features=false + "wayland" at the dep declaration.
default = ["x11", "wayland"]
x11 = ["dep:clipboard_x11"]
wayland = ["dep:clipboard_wayland"]
[dependencies]
raw-window-handle = { version = "0.6", features = ["std"] }
thiserror = "1.0"
mime = { path = "./mime" }
dnd = { path = "./dnd" }
[target.'cfg(windows)'.dependencies]
clipboard-win = { version = "5.0", features = ["std"] }
[target.'cfg(target_os = "macos")'.dependencies]
clipboard_macos = { version = "0.1", path = "./macos" }
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="emscripten", target_os="ios", target_os="redox"))))'.dependencies]
clipboard_x11 = { version = "0.4.2", path = "./x11", optional = true }
clipboard_wayland = { version = "0.2.2", path = "./wayland", optional = true }
[dev-dependencies]
rand = "0.8"
winit = "0.29"
[workspace]
members = ["dnd", "macos", "mime", "dnd", "wayland", "x11"]