diff --git a/src/clients/wayland/wlr_data_control/mod.rs b/src/clients/wayland/wlr_data_control/mod.rs index b1ddabc..ff285b8 100644 --- a/src/clients/wayland/wlr_data_control/mod.rs +++ b/src/clients/wayland/wlr_data_control/mod.rs @@ -20,6 +20,7 @@ use std::ffi::c_int; use std::fmt::{Debug, Formatter}; use std::fs::File; use std::io::{ErrorKind, Write}; +use std::os::fd::RawFd; use std::os::fd::{AsFd, BorrowedFd, OwnedFd}; use std::sync::Arc; use std::{fs, io}; @@ -156,7 +157,7 @@ impl Environment { let source = self .data_control_device_manager_state - .create_copy_paste_source(&self.queue_handle, [&item.mime_type, INTERNAL_MIME_TYPE]); + .create_copy_paste_source(&self.queue_handle, [INTERNAL_MIME_TYPE, &item.mime_type]); source.set_selection(&device.device); self.copy_paste_sources.push(source); @@ -331,7 +332,7 @@ impl DataControlSourceHandler for Environment { debug!("Done writing"); } else { - error!("Failed to find source (mime: '{mime}')"); + error!("Failed to find source"); } } diff --git a/src/clients/wayland/wlr_data_control/offer.rs b/src/clients/wayland/wlr_data_control/offer.rs index 255c406..cddd076 100644 --- a/src/clients/wayland/wlr_data_control/offer.rs +++ b/src/clients/wayland/wlr_data_control/offer.rs @@ -1,6 +1,6 @@ use super::manager::DataControlDeviceManagerState; use crate::lock; -use rustix::pipe::{PipeFlags, pipe_with}; +use rustix::pipe::{pipe_with, PipeFlags}; use smithay_client_toolkit::data_device_manager::data_offer::DataOfferError; use std::ops::DerefMut; use std::os::fd::AsFd; diff --git a/src/clients/wayland/wlr_data_control/source.rs b/src/clients/wayland/wlr_data_control/source.rs index 35ec742..ca10cb7 100644 --- a/src/clients/wayland/wlr_data_control/source.rs +++ b/src/clients/wayland/wlr_data_control/source.rs @@ -1,6 +1,8 @@ use super::device::DataControlDevice; use super::manager::DataControlDeviceManagerState; +use color_eyre::Result; use smithay_client_toolkit::data_device_manager::WritePipe; +use tracing::error; use wayland_client::{Connection, Dispatch, Proxy, QueueHandle}; use wayland_protocols_wlr::data_control::v1::client::zwlr_data_control_source_v1::{ Event, ZwlrDataControlSourceV1, @@ -41,7 +43,7 @@ pub trait DataControlSourceHandler: Sized { source: &ZwlrDataControlSourceV1, mime: String, fd: WritePipe, - ); + ) -> Result<()>; /// The data source is no longer valid /// Cleanup & destroy this resource @@ -68,7 +70,9 @@ where ) { match event { Event::Send { mime_type, fd } => { - state.send_request(conn, qh, source, mime_type, fd.into()); + if let Err(err) = state.send_request(conn, qh, source, mime_type, fd.into()) { + error!("{err:#}"); + } } Event::Cancelled => { state.cancelled(conn, qh, source);