Update to raw-window-handle 0.6

This commit is contained in:
Ian Douglas Scott 2024-01-16 21:12:14 -08:00
parent 555678e6ed
commit bf49c91331
2 changed files with 5 additions and 9 deletions

View file

@ -12,7 +12,7 @@ keywords = ["clipboard", "window", "ui", "gui", "raw-window-handle"]
categories = ["gui"]
[dependencies]
raw-window-handle = "0.5"
raw-window-handle = "0.6"
thiserror = "1.0"
[target.'cfg(windows)'.dependencies]
@ -27,7 +27,7 @@ clipboard_wayland = { version = "0.2", path = "./wayland" }
[dev-dependencies]
rand = "0.8"
winit = { version = "0.29", features = ["rwh_05"] }
winit = "0.29"
[workspace]
members = [

View file

@ -10,13 +10,9 @@ pub fn connect<W: HasRawDisplayHandle>(
window: &W,
) -> Result<Box<dyn ClipboardProvider>, Box<dyn Error>> {
let clipboard = match window.raw_display_handle() {
RawDisplayHandle::Wayland(handle) => {
assert!(!handle.display.is_null());
Box::new(unsafe {
wayland::Clipboard::connect(handle.display as *mut _)
}) as _
}
Ok(RawDisplayHandle::Wayland(handle)) => Box::new(unsafe {
wayland::Clipboard::connect(handle.display.as_ptr())
}) as _,
_ => Box::new(x11::Clipboard::connect()?) as _,
};