Ver Fonte

app: remove arboard dependency now miniquad::linux_wayland has full clipboard support

darkfi há 1 ano atrás
pai
commit
734cf91444

+ 0 - 337
bin/app/Cargo.lock

@@ -155,25 +155,6 @@ version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
 
-[[package]]
-name = "arboard"
-version = "3.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4"
-dependencies = [
- "clipboard-win",
- "core-graphics",
- "image",
- "log",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
- "parking_lot 0.12.3",
- "windows-sys 0.48.0",
- "wl-clipboard-rs",
- "x11rb",
-]
-
 [[package]]
 name = "arg_enum_proc_macro"
 version = "0.3.4"
@@ -751,15 +732,6 @@ dependencies = [
  "generic-array",
 ]
 
-[[package]]
-name = "block2"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
-dependencies = [
- "objc2",
-]
-
 [[package]]
 name = "blocking"
 version = "1.6.1"
@@ -920,12 +892,6 @@ version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
-[[package]]
-name = "cfg_aliases"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
-
 [[package]]
 name = "chacha20"
 version = "0.9.1"
@@ -991,15 +957,6 @@ dependencies = [
  "vec_map",
 ]
 
-[[package]]
-name = "clipboard-win"
-version = "5.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892"
-dependencies = [
- "error-code",
-]
-
 [[package]]
 name = "coarsetime"
 version = "0.1.36"
@@ -1298,7 +1255,6 @@ name = "darkfi-app"
 version = "0.1.0"
 dependencies = [
  "android_logger",
- "arboard",
  "async-channel 2.3.1",
  "async-gen",
  "async-lock",
@@ -1561,17 +1517,6 @@ dependencies = [
  "void",
 ]
 
-[[package]]
-name = "derive-new"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.100",
-]
-
 [[package]]
 name = "derive_builder_core_fork_arti"
 version = "0.11.2"
@@ -1880,12 +1825,6 @@ dependencies = [
  "version_check",
 ]
 
-[[package]]
-name = "error-code"
-version = "3.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f"
-
 [[package]]
 name = "event-listener"
 version = "2.5.3"
@@ -2007,12 +1946,6 @@ dependencies = [
  "windows-sys 0.59.0",
 ]
 
-[[package]]
-name = "fixedbitset"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
-
 [[package]]
 name = "flate2"
 version = "1.1.0"
@@ -2302,16 +2235,6 @@ dependencies = [
  "zeroize",
 ]
 
-[[package]]
-name = "gethostname"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
-dependencies = [
- "libc",
- "windows-targets 0.48.5",
-]
-
 [[package]]
 name = "getrandom"
 version = "0.2.15"
@@ -3239,18 +3162,6 @@ version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
 
-[[package]]
-name = "nix"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
-dependencies = [
- "bitflags 2.9.0",
- "cfg-if",
- "cfg_aliases",
- "libc",
-]
-
 [[package]]
 name = "nom"
 version = "7.1.3"
@@ -3428,105 +3339,6 @@ dependencies = [
  "malloc_buf",
 ]
 
-[[package]]
-name = "objc-sys"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
-
-[[package]]
-name = "objc2"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
-dependencies = [
- "objc-sys",
- "objc2-encode",
-]
-
-[[package]]
-name = "objc2-app-kit"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
-dependencies = [
- "bitflags 2.9.0",
- "block2",
- "libc",
- "objc2",
- "objc2-core-data",
- "objc2-core-image",
- "objc2-foundation",
- "objc2-quartz-core",
-]
-
-[[package]]
-name = "objc2-core-data"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
-dependencies = [
- "bitflags 2.9.0",
- "block2",
- "objc2",
- "objc2-foundation",
-]
-
-[[package]]
-name = "objc2-core-image"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
-dependencies = [
- "block2",
- "objc2",
- "objc2-foundation",
- "objc2-metal",
-]
-
-[[package]]
-name = "objc2-encode"
-version = "4.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
-
-[[package]]
-name = "objc2-foundation"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
-dependencies = [
- "bitflags 2.9.0",
- "block2",
- "libc",
- "objc2",
-]
-
-[[package]]
-name = "objc2-metal"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
-dependencies = [
- "bitflags 2.9.0",
- "block2",
- "objc2",
- "objc2-foundation",
-]
-
-[[package]]
-name = "objc2-quartz-core"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
-dependencies = [
- "bitflags 2.9.0",
- "block2",
- "objc2",
- "objc2-foundation",
- "objc2-metal",
-]
-
 [[package]]
 name = "oid-registry"
 version = "0.8.1"
@@ -3572,16 +3384,6 @@ dependencies = [
  "num-traits",
 ]
 
-[[package]]
-name = "os_pipe"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982"
-dependencies = [
- "libc",
- "windows-sys 0.59.0",
-]
-
 [[package]]
 name = "os_str_bytes"
 version = "6.6.1"
@@ -3735,16 +3537,6 @@ version = "2.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
 
-[[package]]
-name = "petgraph"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
-dependencies = [
- "fixedbitset",
- "indexmap 2.8.0",
-]
-
 [[package]]
 name = "phf"
 version = "0.11.3"
@@ -4045,15 +3837,6 @@ version = "2.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
 
-[[package]]
-name = "quick-xml"
-version = "0.37.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003"
-dependencies = [
- "memchr",
-]
-
 [[package]]
 name = "quote"
 version = "1.0.40"
@@ -7088,19 +6871,6 @@ dependencies = [
  "syn 2.0.100",
 ]
 
-[[package]]
-name = "tree_magic_mini"
-version = "3.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63"
-dependencies = [
- "fnv",
- "memchr",
- "nom",
- "once_cell",
- "petgraph",
-]
-
 [[package]]
 name = "typed-index-collections"
 version = "3.1.0"
@@ -7388,76 +7158,6 @@ dependencies = [
  "unicode-ident",
 ]
 
-[[package]]
-name = "wayland-backend"
-version = "0.3.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
-dependencies = [
- "cc",
- "downcast-rs 1.2.1",
- "rustix 0.38.44",
- "smallvec",
- "wayland-sys",
-]
-
-[[package]]
-name = "wayland-client"
-version = "0.31.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
-dependencies = [
- "bitflags 2.9.0",
- "rustix 0.38.44",
- "wayland-backend",
- "wayland-scanner",
-]
-
-[[package]]
-name = "wayland-protocols"
-version = "0.31.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
-dependencies = [
- "bitflags 2.9.0",
- "wayland-backend",
- "wayland-client",
- "wayland-scanner",
-]
-
-[[package]]
-name = "wayland-protocols-wlr"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
-dependencies = [
- "bitflags 2.9.0",
- "wayland-backend",
- "wayland-client",
- "wayland-protocols",
- "wayland-scanner",
-]
-
-[[package]]
-name = "wayland-scanner"
-version = "0.31.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
-dependencies = [
- "proc-macro2",
- "quick-xml",
- "quote",
-]
-
-[[package]]
-name = "wayland-sys"
-version = "0.31.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
-dependencies = [
- "pkg-config",
-]
-
 [[package]]
 name = "weak-table"
 version = "0.3.2"
@@ -7756,26 +7456,6 @@ dependencies = [
  "bitflags 2.9.0",
 ]
 
-[[package]]
-name = "wl-clipboard-rs"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12b41773911497b18ca8553c3daaf8ec9fe9819caf93d451d3055f69de028adb"
-dependencies = [
- "derive-new",
- "libc",
- "log",
- "nix",
- "os_pipe",
- "tempfile",
- "thiserror 1.0.69",
- "tree_magic_mini",
- "wayland-backend",
- "wayland-client",
- "wayland-protocols",
- "wayland-protocols-wlr",
-]
-
 [[package]]
 name = "write16"
 version = "1.0.0"
@@ -7797,23 +7477,6 @@ dependencies = [
  "tap",
 ]
 
-[[package]]
-name = "x11rb"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12"
-dependencies = [
- "gethostname",
- "rustix 0.38.44",
- "x11rb-protocol",
-]
-
-[[package]]
-name = "x11rb-protocol"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
-
 [[package]]
 name = "x25519-dalek"
 version = "2.0.1"

+ 0 - 1
bin/app/Cargo.toml

@@ -70,7 +70,6 @@ halo2_gadgets = {git="https://github.com/parazyd/halo2", branch="v4"}
 #dirs-sys = {git="https://github.com/sbechet/dirs-sys-rs.git"}
 
 [target.'cfg(not(target_os = "android"))'.dependencies]
-arboard = {version = "3.4.1", features=["wayland-data-control"]}
 dirs = "5.0.1"
 
 [target.'cfg(target_os = "android")'.dependencies]

+ 4 - 7
bin/app/src/app/schema/chat.rs

@@ -45,7 +45,7 @@ use crate::{
         chatview, emoji_picker, Button, ChatEdit, ChatView, EditBox, EmojiPicker, Image, Layer,
         ShapeVertex, Shortcut, Text, VectorArt, VectorShape, Window,
     },
-    util::{unixtime, Clipboard},
+    util::unixtime,
     ExecutorPtr,
 };
 
@@ -1425,13 +1425,12 @@ pub async fn make(
     let actions_is_visible2 = actions_is_visible.clone();
     let editz_select_text2 = editz_select_text.clone();
     let listen_click = app.ex.spawn(async move {
-        let mut clip = Clipboard::new();
         while let Ok(_) = recvr.recv().await {
             info!(target: "app::chat", "clicked copy");
             let atom = &mut PropertyAtomicGuard::new();
             actions_is_visible2.set(atom, false);
             let select_text = editz_select_text2.get_str(0).unwrap();
-            clip.set(&select_text);
+            miniquad::window::clipboard_set(&select_text);
         }
     });
     app.tasks.lock().unwrap().push(listen_click);
@@ -1453,10 +1452,9 @@ pub async fn make(
     let actions_is_visible2 = actions_is_visible.clone();
     let chatedit_node2 = chatedit_node.clone();
     let listen_click = app.ex.spawn(async move {
-        let mut clip = Clipboard::new();
         while let Ok(_) = recvr.recv().await {
             let atom = &mut PropertyAtomicGuard::new();
-            if let Some(text) = clip.get() {
+            if let Some(text) = miniquad::window::clipboard_get() {
                 info!(target: "app::chat", "clicked paste: {text}");
                 let mut data = vec![];
                 text.encode(&mut data).unwrap();
@@ -1614,10 +1612,9 @@ pub async fn make(
     let chatedit_node2 = chatedit_node.clone();
     let pasta_is_visible2 = pasta_is_visible.clone();
     let listen_click = app.ex.spawn(async move {
-        let mut clip = Clipboard::new();
         while let Ok(_) = recvr.recv().await {
             let atom = &mut PropertyAtomicGuard::new();
-            if let Some(text) = clip.get() {
+            if let Some(text) = miniquad::window::clipboard_get() {
                 info!(target: "app::chat", "clicked paste: {text}");
                 let mut data = vec![];
                 text.encode(&mut data).unwrap();

+ 2 - 3
bin/app/src/ui/chatedit.rs

@@ -48,7 +48,7 @@ use crate::{
     pubsub::Subscription,
     scene::{MethodCallSub, Pimpl, SceneNodePtr, SceneNodeWeak},
     text::{self, Glyph, GlyphPositionIter, TextShaperPtr},
-    util::{enumerate_ref, is_whitespace, min_f32, unixtime, zip4, Clipboard},
+    util::{enumerate_ref, is_whitespace, min_f32, unixtime, zip4},
     ExecutorPtr,
 };
 
@@ -1164,8 +1164,7 @@ impl ChatEdit {
             }
             'v' => {
                 if modkey_pressed {
-                    let mut clip = Clipboard::new();
-                    if let Some(text) = clip.get() {
+                    if let Some(text) = miniquad::window::clipboard_get() {
                         self.insert_text(&text, atom).await;
                     }
                     return true

+ 0 - 47
bin/app/src/util/clip.rs

@@ -1,47 +0,0 @@
-/* This file is part of DarkFi (https://dark.fi)
- *
- * Copyright (C) 2020-2025 Dyne.org foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-
-pub struct Clipboard {
-    #[cfg(not(target_os = "android"))]
-    clip: arboard::Clipboard,
-}
-
-impl Clipboard {
-    pub fn new() -> Self {
-        Self {
-            #[cfg(not(target_os = "android"))]
-            clip: arboard::Clipboard::new().unwrap(),
-        }
-    }
-
-    pub fn get(&mut self) -> Option<String> {
-        #[cfg(target_os = "android")]
-        return miniquad::window::clipboard_get();
-
-        #[cfg(not(target_os = "android"))]
-        return self.clip.get_text().ok();
-    }
-
-    pub fn set(&mut self, data: &str) {
-        #[cfg(target_os = "android")]
-        return miniquad::window::clipboard_set(data);
-
-        #[cfg(not(target_os = "android"))]
-        return self.clip.set_text(data).unwrap();
-    }
-}

+ 0 - 3
bin/app/src/util/mod.rs

@@ -19,9 +19,6 @@
 use colored::Colorize;
 use std::time::{SystemTime, UNIX_EPOCH};
 
-mod clip;
-pub use clip::Clipboard;
-
 pub fn is_whitespace(s: &str) -> bool {
     s.chars().all(char::is_whitespace)
 }