Update arboard, fixing copy-paste on X11 (#2238)
* Revert "Fix copy-paste on Windows (#2120)"
This reverts commit f61044cef7.
* Update arboard to 3.2
This commit is contained in:
parent
22a917c00a
commit
17501d7e3e
|
|
@ -119,9 +119,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arboard"
|
name = "arboard"
|
||||||
version = "3.1.0"
|
version = "3.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79e8af4eff708b72e371acd4625ad3d01a88c946b9e8d6868cb5bb6e4d0d923c"
|
checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clipboard-win",
|
"clipboard-win",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,9 @@ wayland = ["winit/wayland"]
|
||||||
egui = { version = "0.19.0", path = "../egui", default-features = false, features = [
|
egui = { version = "0.19.0", path = "../egui", default-features = false, features = [
|
||||||
"tracing",
|
"tracing",
|
||||||
] }
|
] }
|
||||||
instant = { version = "0.1", features = ["wasm-bindgen"] } # We use instant so we can (maybe) compile for web
|
instant = { version = "0.1", features = [
|
||||||
|
"wasm-bindgen",
|
||||||
|
] } # We use instant so we can (maybe) compile for web
|
||||||
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
tracing = { version = "0.1", default-features = false, features = ["std"] }
|
||||||
winit = { version = "0.27.2", default-features = false }
|
winit = { version = "0.27.2", default-features = false }
|
||||||
|
|
||||||
|
|
@ -67,4 +69,4 @@ webbrowser = { version = "0.8", optional = true }
|
||||||
smithay-clipboard = { version = "0.6.3", optional = true }
|
smithay-clipboard = { version = "0.6.3", optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||||
arboard = { version = "3.0", optional = true, default-features = false }
|
arboard = { version = "3.2", optional = true, default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ use std::os::raw::c_void;
|
||||||
/// If the "clipboard" feature is off, or we cannot connect to the OS clipboard,
|
/// 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.
|
/// then a fallback clipboard that just works works within the same app is used instead.
|
||||||
pub struct Clipboard {
|
pub struct Clipboard {
|
||||||
|
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||||
|
arboard: Option<arboard::Clipboard>,
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
any(
|
any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
|
|
@ -25,6 +28,8 @@ impl Clipboard {
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self {
|
pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||||
|
arboard: init_arboard(),
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
any(
|
any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
|
|
@ -62,7 +67,7 @@ impl Clipboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||||
if let Some(mut clipboard) = init_arboard() {
|
if let Some(clipboard) = &mut self.arboard {
|
||||||
return match clipboard.get_text() {
|
return match clipboard.get_text() {
|
||||||
Ok(text) => Some(text),
|
Ok(text) => Some(text),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
@ -92,7 +97,7 @@ impl Clipboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||||
if let Some(mut clipboard) = init_arboard() {
|
if let Some(clipboard) = &mut self.arboard {
|
||||||
if let Err(err) = clipboard.set_text(text) {
|
if let Err(err) = clipboard.set_text(text) {
|
||||||
tracing::error!("Copy/Cut error: {}", err);
|
tracing::error!("Copy/Cut error: {}", err);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue