Implement write support for clipboard_x11
This commit is contained in:
parent
aeda90d4ef
commit
a97dfae8f6
11 changed files with 496 additions and 185 deletions
|
|
@ -35,4 +35,8 @@ impl ClipboardProvider for Clipboard {
|
|||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Err(Box::new(AndroidClipboardError::Unimplemented))
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
Err(Box::new(AndroidClipboardError::Unimplemented))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,8 @@ impl ClipboardProvider for Clipboard {
|
|||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Err(Box::new(iOSClipboardError::Unimplemented))
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
Err(Box::new(AndroidClipboardError::Unimplemented))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,18 @@ impl ClipboardProvider for wayland::Clipboard {
|
|||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
self.read()
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
self.write(contents)
|
||||
}
|
||||
}
|
||||
|
||||
impl ClipboardProvider for x11::Clipboard {
|
||||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
self.read()
|
||||
self.read().map_err(Box::from)
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
self.write(contents).map_err(Box::from)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,8 @@ impl ClipboardProvider for clipboard_macos::Clipboard {
|
|||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
self.read()
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
self.write(contents)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ClipboardProvider;
|
||||
|
||||
use clipboard_win::get_clipboard_string;
|
||||
use clipboard_win::{get_clipboard_string, set_clipboard_string};
|
||||
use raw_window_handle::HasRawWindowHandle;
|
||||
|
||||
use std::error::Error;
|
||||
|
|
@ -17,4 +17,8 @@ impl ClipboardProvider for Clipboard {
|
|||
fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Ok(get_clipboard_string()?)
|
||||
}
|
||||
|
||||
fn write(&mut self, contents: String) -> Result<(), Box<dyn Error>> {
|
||||
Ok(set_clipboard_string(&contents)?)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue