mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
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:
@@ -46,7 +46,9 @@ wayland = ["winit/wayland"]
|
||||
egui = { version = "0.19.0", path = "../egui", default-features = false, features = [
|
||||
"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"] }
|
||||
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 }
|
||||
|
||||
[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,
|
||||
/// then a fallback clipboard that just works works within the same app is used instead.
|
||||
pub struct Clipboard {
|
||||
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||
arboard: Option<arboard::Clipboard>,
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
target_os = "linux",
|
||||
@@ -25,6 +28,8 @@ impl Clipboard {
|
||||
#[allow(unused_variables)]
|
||||
pub fn new(#[allow(unused_variables)] wayland_display: Option<*mut c_void>) -> Self {
|
||||
Self {
|
||||
#[cfg(all(feature = "arboard", not(target_os = "android")))]
|
||||
arboard: init_arboard(),
|
||||
#[cfg(all(
|
||||
any(
|
||||
target_os = "linux",
|
||||
@@ -62,7 +67,7 @@ impl Clipboard {
|
||||
}
|
||||
|
||||
#[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() {
|
||||
Ok(text) => Some(text),
|
||||
Err(err) => {
|
||||
@@ -92,7 +97,7 @@ impl Clipboard {
|
||||
}
|
||||
|
||||
#[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) {
|
||||
tracing::error!("Copy/Cut error: {}", err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user