desktop: add arboard dependency to manage clipboard

This commit is contained in:
ardocrat 2023-08-17 16:45:46 +03:00
parent 9eebe0c791
commit 36296f647d
3 changed files with 34 additions and 2 deletions

27
Cargo.lock generated
View file

@ -265,6 +265,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854"
dependencies = [
"clipboard-win",
"core-graphics",
"image",
"log",
"objc",
"objc-foundation",
@ -2266,6 +2268,7 @@ version = "0.1.0"
dependencies = [
"android-activity",
"android_logger",
"arboard",
"built",
"chrono",
"dirs 5.0.1",
@ -3103,6 +3106,7 @@ dependencies = [
"num-rational 0.4.1",
"num-traits 0.2.16",
"png",
"tiff",
]
[[package]]
@ -3254,6 +3258,12 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
[[package]]
name = "js-sys"
version = "0.3.64"
@ -5791,6 +5801,17 @@ dependencies = [
"once_cell",
]
[[package]]
name = "tiff"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d172b0f4d3fba17ba89811858b9d3d97f928aece846475bbda076ca46736211"
dependencies = [
"flate2",
"jpeg-decoder",
"weezl",
]
[[package]]
name = "time"
version = "0.1.45"
@ -6556,6 +6577,12 @@ dependencies = [
"webpki",
]
[[package]]
name = "weezl"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "wgpu"
version = "0.16.3"

View file

@ -65,6 +65,7 @@ built = { version = "0.6.0", features = ["git2"]}
env_logger = "0.10.0"
winit = { version = "0.28" }
eframe = { version = "0.22.0", features = [ "wgpu" ] }
arboard = "3.2.0"
[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.13.1"

View file

@ -22,9 +22,13 @@ impl PlatformCallbacks for Desktop {
fn hide_keyboard(&self) {}
fn copy_string_to_buffer(&self, data: String) {}
fn copy_string_to_buffer(&self, data: String) {
let mut clipboard = arboard::Clipboard::new().unwrap();
clipboard.set_text(data).unwrap();
}
fn get_string_from_buffer(&self) -> String {
"".to_string()
let mut clipboard = arboard::Clipboard::new().unwrap();
clipboard.get_text().unwrap()
}
}