diff options
author | 2024-02-13 03:35:35 +0100 | |
---|---|---|
committer | 2024-02-13 03:35:35 +0100 | |
commit | dc2cba92646392fa78a14f768d98ad5f15b9f182 (patch) | |
tree | 84c48ea5c45516953b009e768fd6a9241ea80950 /core | |
parent | 7615b2240c360fea21ef041bfd5b1deb73fc03d1 (diff) | |
parent | 3ac2902f689fce8feaf86703b25535a93aa95209 (diff) | |
download | iced-dc2cba92646392fa78a14f768d98ad5f15b9f182.tar.gz iced-dc2cba92646392fa78a14f768d98ad5f15b9f182.tar.bz2 iced-dc2cba92646392fa78a14f768d98ad5f15b9f182.zip |
Merge pull request #2240 from snaggen/primary
Add support for primary clipboard
Diffstat (limited to '')
-rw-r--r-- | core/src/clipboard.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/core/src/clipboard.rs b/core/src/clipboard.rs index 081b4004..5df3e267 100644 --- a/core/src/clipboard.rs +++ b/core/src/clipboard.rs @@ -4,10 +4,21 @@ /// applications. pub trait Clipboard { /// Reads the current content of the [`Clipboard`] as text. - fn read(&self) -> Option<String>; + fn read(&self, kind: Kind) -> Option<String>; /// Writes the given text contents to the [`Clipboard`]. - fn write(&mut self, contents: String); + fn write(&mut self, kind: Kind, contents: String); +} + +/// The kind of [`Clipboard`]. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Kind { + /// The standard clipboard. + Standard, + /// The primary clipboard. + /// + /// Normally only present in X11 and Wayland. + Primary, } /// A null implementation of the [`Clipboard`] trait. @@ -15,9 +26,9 @@ pub trait Clipboard { pub struct Null; impl Clipboard for Null { - fn read(&self) -> Option<String> { + fn read(&self, _kind: Kind) -> Option<String> { None } - fn write(&mut self, _contents: String) {} + fn write(&mut self, _kind: Kind, _contents: String) {} } |