Update smithay_clipboard and clipboard-win
This commit is contained in:
parent
f5293f9b3b
commit
5f78242246
3 changed files with 13 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "clipboard_wayland"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
|
||||
edition = "2018"
|
||||
description = "A library to obtain access to the clipboard of a Wayland window"
|
||||
|
|
@ -10,4 +10,4 @@ documentation = "https://docs.rs/clipboard_wayland"
|
|||
keywords = ["clipboard", "wayland"]
|
||||
|
||||
[dependencies]
|
||||
smithay-clipboard = "0.3.4"
|
||||
smithay-clipboard = "0.5.1"
|
||||
|
|
|
|||
|
|
@ -16,27 +16,25 @@ use std::error::Error;
|
|||
use std::ffi::c_void;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use smithay_clipboard::WaylandClipboard;
|
||||
|
||||
pub struct Clipboard {
|
||||
context: Arc<Mutex<WaylandClipboard>>,
|
||||
context: Arc<Mutex<smithay_clipboard::Clipboard>>,
|
||||
}
|
||||
|
||||
impl Clipboard {
|
||||
pub unsafe fn new(display: *mut c_void) -> Clipboard {
|
||||
let context = Arc::new(Mutex::new(
|
||||
WaylandClipboard::new_from_external(display as *mut _),
|
||||
));
|
||||
let context = Arc::new(Mutex::new(smithay_clipboard::Clipboard::new(
|
||||
display as *mut _,
|
||||
)));
|
||||
|
||||
Clipboard { context }
|
||||
}
|
||||
|
||||
pub fn read(&self) -> Result<String, Box<dyn Error>> {
|
||||
Ok(self.context.lock().unwrap().load(None))
|
||||
Ok(self.context.lock().unwrap().load()?)
|
||||
}
|
||||
|
||||
pub fn write(&mut self, data: String) -> Result<(), Box<dyn Error>> {
|
||||
self.context.lock().unwrap().store(None, data);
|
||||
self.context.lock().unwrap().store(data);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue