diff --git a/src/ifs/data_transfer.rs b/src/ifs/data_transfer.rs index cab966f1..8337498b 100644 --- a/src/ifs/data_transfer.rs +++ b/src/ifs/data_transfer.rs @@ -2,7 +2,7 @@ use { crate::{ client::{Client, ClientError, ClientId}, fixed::Fixed, - ifs::{data_transfer::x_data_device::XIpcDevice, wl_seat::WlSeatGlobal}, + ifs::{data_transfer::x_data_device::XTransferDevice, wl_seat::WlSeatGlobal}, utils::{ bitflags::BitflagsExt, cell_ext::CellExt, clonecell::CloneCell, numcell::NumCell, smallmap::SmallMap, @@ -38,7 +38,7 @@ linear_ids!(DataSourceIds, DataSourceId, u64); linear_ids!(DataOfferIds, DataOfferId, u64); #[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub enum IpcLocation { +pub enum TransferLocation { Clipboard, PrimarySelection, } @@ -56,7 +56,7 @@ pub trait DataSource: DynDataSource { pub trait DynDataSource: 'static { fn source_data(&self) -> &SourceData; fn send_send(&self, mime_type: &str, fd: Rc); - fn offer_to_x(self: Rc, dd: &Rc); + fn offer_to_x(self: Rc, dd: &Rc); fn detach_seat(&self, seat: &Rc); fn cancel_unprivileged_offers(&self); @@ -123,13 +123,13 @@ pub trait DynDataOffer: 'static { } } -pub trait IterableIpcVtable: IpcVtable { +pub trait IterableTransferVtable: TransferVtable { fn for_each_device(seat: &WlSeatGlobal, client: ClientId, f: C) where C: FnMut(&Rc); } -pub trait IpcVtable: Sized { +pub trait TransferVtable: Sized { type Device; type Source: DataSource; type Offer: DataOffer; @@ -167,7 +167,7 @@ pub struct OfferData { } #[derive(Debug, Error)] -pub enum IpcError { +pub enum TransferError { #[error("The data source is already attached")] AlreadyAttached, #[error("The data source does not have drag-and-drop actions set")] @@ -248,20 +248,20 @@ pub fn attach_seat( src: &S, seat: &Rc, role: Role, -) -> Result<(), IpcError> { +) -> Result<(), TransferError> { let data = src.source_data(); let mut state = data.state.get(); if state.contains(SOURCE_STATE_USED) { - return Err(IpcError::AlreadyAttached); + return Err(TransferError::AlreadyAttached); } state |= SOURCE_STATE_USED; if role == Role::Dnd { if data.actions.is_none() { - return Err(IpcError::ActionsNotSet); + return Err(TransferError::ActionsNotSet); } } else { if data.actions.is_some() { - return Err(IpcError::ActionsSet); + return Err(TransferError::ActionsSet); } } data.state.set(state); @@ -283,7 +283,7 @@ pub fn cancel_offers(src: &S, cancel_privileged: bool) { data.offers.replace(offers); } -pub fn cancel_offer(offer: &T::Offer) { +pub fn cancel_offer(offer: &T::Offer) { let data = offer.offer_data(); data.source.take(); destroy_data_offer::(&offer); @@ -299,7 +299,7 @@ pub fn detach_seat(src: &S, seat: &Rc) { // data.client.flush(); } -fn offer_source_to_device( +fn offer_source_to_device( src: &Rc, dd: &Rc, data: &SourceData, @@ -335,9 +335,9 @@ fn offer_source_to_device( } } -fn offer_source_to_x(src: Rc, dd: &Rc) +fn offer_source_to_x(src: Rc, dd: &Rc) where - T: IpcVtable, + T: TransferVtable, { let data = src.source_data(); src.cancel_unprivileged_offers(); @@ -348,7 +348,7 @@ where pub fn offer_source_to_data_control_device(src: Rc, dd: &Rc) where - T: IpcVtable, + T: TransferVtable, { let data = src.source_data(); let shared = data.shared.get(); @@ -356,7 +356,7 @@ where offer_source_to_device::(&src, dd, data, shared); } -pub fn offer_source_to_regular_client( +pub fn offer_source_to_regular_client( src: Rc, client: &Rc, ) { @@ -376,7 +376,7 @@ pub fn offer_source_to_regular_client( }); } -pub fn add_data_source_mime_type(src: &T::Source, mime_type: &str) { +pub fn add_data_source_mime_type(src: &T::Source, mime_type: &str) { let data = src.source_data(); if data.mime_types.borrow_mut().insert(mime_type.to_string()) { for (_, offer) in &data.offers { @@ -387,14 +387,14 @@ pub fn add_data_source_mime_type(src: &T::Source, mime_type: &str) } } -pub fn destroy_data_source(src: &T::Source) { +pub fn destroy_data_source(src: &T::Source) { let data = src.source_data(); if let Some(seat) = data.seat.take() { T::unset(&seat, data.role.get()); } } -pub fn destroy_data_offer(offer: &T::Offer) { +pub fn destroy_data_offer(offer: &T::Offer) { let data = offer.offer_data(); if let Some(device) = data.device.take() { let device_data = T::get_device_data(&device); @@ -421,7 +421,7 @@ pub fn destroy_data_offer(offer: &T::Offer) { } } -pub fn destroy_data_device(dd: &T::Device) { +pub fn destroy_data_device(dd: &T::Device) { let data = T::get_device_data(dd); let offers = [data.selection.take(), data.dnd.take()]; for offer in offers.into_iter().flat_map(|o| o.into_iter()) { @@ -430,7 +430,7 @@ pub fn destroy_data_device(dd: &T::Device) { } } -fn break_source_loops(src: &T::Source) { +fn break_source_loops(src: &T::Source) { let data = src.source_data(); let mut remove = SmallVec::<[DataOfferId; 1]>::new(); for (id, offer) in &data.offers { @@ -444,20 +444,20 @@ fn break_source_loops(src: &T::Source) { destroy_data_source::(src); } -fn break_offer_loops(offer: &T::Offer) { +fn break_offer_loops(offer: &T::Offer) { let data = offer.offer_data(); data.device.set(None); destroy_data_offer::(offer); } -fn break_device_loops(dd: &T::Device) { +fn break_device_loops(dd: &T::Device) { let data = T::get_device_data(dd); data.selection.take(); data.dnd.take(); destroy_data_device::(dd); } -pub fn receive_data_offer(offer: &T::Offer, mime_type: &str, fd: Rc) { +pub fn receive_data_offer(offer: &T::Offer, mime_type: &str, fd: Rc) { let data = offer.offer_data(); if let Some(src) = data.source.get() { src.send_send(mime_type, fd); diff --git a/src/ifs/data_transfer/data_control.rs b/src/ifs/data_transfer/data_control.rs index 01242833..2ea54734 100644 --- a/src/ifs/data_transfer/data_control.rs +++ b/src/ifs/data_transfer/data_control.rs @@ -1,5 +1,5 @@ use { - crate::ifs::data_transfer::{DynDataSource, IpcLocation}, + crate::ifs::data_transfer::{DynDataSource, TransferLocation}, std::rc::Rc, }; @@ -20,7 +20,7 @@ pub trait DynDataControlDevice { fn handle_new_source( self: Rc, - location: IpcLocation, + location: TransferLocation, source: Option>, ); } diff --git a/src/ifs/data_transfer/data_control/ext_data_control_manager_v1.rs b/src/ifs/data_transfer/data_control/ext_data_control_manager_v1.rs index c7caaf21..5cfccf24 100644 --- a/src/ifs/data_transfer/data_control/ext_data_control_manager_v1.rs +++ b/src/ifs/data_transfer/data_control/ext_data_control_manager_v1.rs @@ -3,7 +3,7 @@ use { client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError}, globals::{Global, GlobalName}, ifs::data_transfer::{ - IpcLocation, + TransferLocation, data_control::{ DynDataControlDevice, ext_data_control_device_v1::ExtDataControlDeviceV1, ext_data_control_source_v1::ExtDataControlSourceV1, @@ -81,9 +81,9 @@ impl ExtDataControlManagerV1RequestHandler for ExtDataControlManagerV1 { seat.global.add_data_control_device(dev.clone()); self.client.add_client_obj(&dev)?; dev.clone() - .handle_new_source(IpcLocation::Clipboard, seat.global.get_selection()); + .handle_new_source(TransferLocation::Clipboard, seat.global.get_selection()); dev.clone().handle_new_source( - IpcLocation::PrimarySelection, + TransferLocation::PrimarySelection, seat.global.get_primary_selection(), ); Ok(()) diff --git a/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs b/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs index 0baf5964..acea0af5 100644 --- a/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs +++ b/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs @@ -2,7 +2,7 @@ use { crate::{ client::Client, ifs::data_transfer::{ - IpcLocation, SourceData, + TransferLocation, SourceData, data_control::{ ext_data_control_device_v1::ExtDataControlIpc, private::{ @@ -49,7 +49,7 @@ impl ExtDataControlSourceV1 { data: DataControlSourceData { data: SourceData::new(client), version, - location: Cell::new(IpcLocation::Clipboard), + location: Cell::new(TransferLocation::Clipboard), used: Cell::new(false), }, tracker: Default::default(), diff --git a/src/ifs/data_transfer/data_control/private.rs b/src/ifs/data_transfer/data_control/private.rs index f23dad15..f8be1b53 100644 --- a/src/ifs/data_transfer/data_control/private.rs +++ b/src/ifs/data_transfer/data_control/private.rs @@ -4,10 +4,10 @@ use { ifs::{ data_transfer::{ DataOffer, DataOfferId, DataSource, DeviceData, DynDataOffer, DynDataSource, - IpcLocation, IpcVtable, OfferData, Role, SourceData, cancel_offer, cancel_offers, + TransferLocation, TransferVtable, OfferData, Role, SourceData, cancel_offer, cancel_offers, data_control::{DataControlDeviceId, DynDataControlDevice}, detach_seat, offer_source_to_data_control_device, offer_source_to_x, - x_data_device::{XClipboardIpc, XIpcDevice, XPrimarySelectionIpc}, + x_data_device::{XClipboardTransfer, XTransferDevice, XPrimarySelectionTransfer}, }, wl_seat::WlSeatGlobal, }, @@ -64,7 +64,7 @@ pub struct DataControlOfferData { pub client: Rc, pub device: Rc, pub data: OfferData, - pub location: IpcLocation, + pub location: TransferLocation, } pub trait DataControlOffer: WaylandObject { @@ -78,7 +78,7 @@ pub trait DataControlOffer: WaylandObject { pub struct DataControlSourceData { pub data: SourceData, pub version: Version, - pub location: Cell, + pub location: Cell, pub used: Cell, } @@ -99,22 +99,22 @@ impl DynDataControlDevice for T { fn handle_new_source( self: Rc, - location: IpcLocation, + location: TransferLocation, source: Option>, ) { - if location == IpcLocation::PrimarySelection + if location == TransferLocation::PrimarySelection && self.data().version < T::Ipc::PRIMARY_SELECTION_SINCE { return; } match location { - IpcLocation::Clipboard => match source { + TransferLocation::Clipboard => match source { Some(src) => { offer_source_to_data_control_device::>(src, &self); } _ => self.send_selection(None), }, - IpcLocation::PrimarySelection => match source { + TransferLocation::PrimarySelection => match source { Some(src) => { offer_source_to_data_control_device::>(src, &self); } @@ -129,7 +129,7 @@ type PrimarySelection = DataControlIpcImpl>; pub trait DataControlLocationIpc { type Ipc: DataControlIpc; - const LOCATION: IpcLocation; + const LOCATION: TransferLocation; fn loc_get_device_data(dd: &Device) -> &DeviceData>; @@ -140,7 +140,7 @@ pub trait DataControlLocationIpc { impl DataControlLocationIpc for ClipboardCore { type Ipc = T; - const LOCATION: IpcLocation = IpcLocation::Clipboard; + const LOCATION: TransferLocation = TransferLocation::Clipboard; fn loc_get_device_data(dd: &Device) -> &DeviceData> { &dd.data().clipboard_data @@ -157,7 +157,7 @@ impl DataControlLocationIpc for ClipboardCore { impl DataControlLocationIpc for PrimarySelectionCore { type Ipc = T; - const LOCATION: IpcLocation = IpcLocation::PrimarySelection; + const LOCATION: TransferLocation = TransferLocation::PrimarySelection; fn loc_get_device_data(dd: &Device) -> &DeviceData> { &dd.data().primary_selection_data @@ -172,7 +172,7 @@ impl DataControlLocationIpc for PrimarySelectionCore { } } -impl IpcVtable for DataControlIpcImpl { +impl TransferVtable for DataControlIpcImpl { type Device = Device; type Source = Source; type Offer = Offer; @@ -234,10 +234,10 @@ impl DynDataSource for T { self.send_send(mime_type, fd); } - fn offer_to_x(self: Rc, dd: &Rc) { + fn offer_to_x(self: Rc, dd: &Rc) { match self.data().location.get() { - IpcLocation::Clipboard => offer_source_to_x::(self, dd), - IpcLocation::PrimarySelection => offer_source_to_x::(self, dd), + TransferLocation::Clipboard => offer_source_to_x::(self, dd), + TransferLocation::PrimarySelection => offer_source_to_x::(self, dd), } } @@ -273,8 +273,8 @@ impl DynDataOffer for T { fn cancel(&self) { match self.data().location { - IpcLocation::Clipboard => cancel_offer::>(self), - IpcLocation::PrimarySelection => cancel_offer::>(self), + TransferLocation::Clipboard => cancel_offer::>(self), + TransferLocation::PrimarySelection => cancel_offer::>(self), } } @@ -293,7 +293,7 @@ pub mod logic { client::ClientError, ifs::{ data_transfer::{ - IpcLocation, add_data_source_mime_type, break_device_loops, break_offer_loops, + TransferLocation, add_data_source_mime_type, break_device_loops, break_offer_loops, break_source_loops, data_control::private::{ Clipboard, DataControlDevice, DataControlOffer, DataControlSource, @@ -319,7 +319,7 @@ pub mod logic { fn use_source( device: &D, source: Option>, - location: IpcLocation, + location: TransferLocation, ) -> Result>>, DataControlError> { if let Some(source) = source { let src = device.data().client.lookup(source)?; @@ -337,7 +337,7 @@ pub mod logic { d: &D, source: Option>, ) -> Result<(), DataControlError> { - let src = use_source(d, source, IpcLocation::Clipboard)?; + let src = use_source(d, source, TransferLocation::Clipboard)?; d.data().seat.set_selection(src)?; Ok(()) } @@ -354,7 +354,7 @@ pub mod logic { d: &D, source: Option>, ) -> Result<(), DataControlError> { - let src = use_source(d, source, IpcLocation::PrimarySelection)?; + let src = use_source(d, source, TransferLocation::PrimarySelection)?; d.data().seat.set_primary_selection(src)?; Ok(()) } @@ -372,8 +372,8 @@ pub mod logic { pub fn data_source_destroy(s: &S) -> Result<(), DataControlError> { match s.data().location.get() { - IpcLocation::Clipboard => destroy_data_source::>(s), - IpcLocation::PrimarySelection => destroy_data_source::>(s), + TransferLocation::Clipboard => destroy_data_source::>(s), + TransferLocation::PrimarySelection => destroy_data_source::>(s), } s.data().data.client.remove_obj(s)?; Ok(()) @@ -381,15 +381,15 @@ pub mod logic { pub fn data_source_break_loops(s: &S) { match s.data().location.get() { - IpcLocation::Clipboard => break_source_loops::>(s), - IpcLocation::PrimarySelection => break_source_loops::>(s), + TransferLocation::Clipboard => break_source_loops::>(s), + TransferLocation::PrimarySelection => break_source_loops::>(s), } } pub fn data_offer_receive(o: &O, mime_type: &str, fd: Rc) { match o.data().location { - IpcLocation::Clipboard => receive_data_offer::>(o, mime_type, fd), - IpcLocation::PrimarySelection => { + TransferLocation::Clipboard => receive_data_offer::>(o, mime_type, fd), + TransferLocation::PrimarySelection => { receive_data_offer::>(o, mime_type, fd) } } @@ -397,8 +397,8 @@ pub mod logic { pub fn data_offer_destroy(o: &O) -> Result<(), DataControlError> { match o.data().location { - IpcLocation::Clipboard => destroy_data_offer::>(o), - IpcLocation::PrimarySelection => destroy_data_offer::>(o), + TransferLocation::Clipboard => destroy_data_offer::>(o), + TransferLocation::PrimarySelection => destroy_data_offer::>(o), } o.data().client.remove_obj(o)?; Ok(()) @@ -406,8 +406,8 @@ pub mod logic { pub fn data_offer_break_loops(o: &O) { match o.data().location { - IpcLocation::Clipboard => break_offer_loops::>(o), - IpcLocation::PrimarySelection => break_offer_loops::>(o), + TransferLocation::Clipboard => break_offer_loops::>(o), + TransferLocation::PrimarySelection => break_offer_loops::>(o), } } diff --git a/src/ifs/data_transfer/data_control/zwlr_data_control_manager_v1.rs b/src/ifs/data_transfer/data_control/zwlr_data_control_manager_v1.rs index 5f030451..b0e37764 100644 --- a/src/ifs/data_transfer/data_control/zwlr_data_control_manager_v1.rs +++ b/src/ifs/data_transfer/data_control/zwlr_data_control_manager_v1.rs @@ -3,7 +3,7 @@ use { client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError}, globals::{Global, GlobalName}, ifs::data_transfer::{ - IpcLocation, + TransferLocation, data_control::{ DynDataControlDevice, zwlr_data_control_device_v1::ZwlrDataControlDeviceV1, zwlr_data_control_source_v1::ZwlrDataControlSourceV1, @@ -81,9 +81,9 @@ impl ZwlrDataControlManagerV1RequestHandler for ZwlrDataControlManagerV1 { seat.global.add_data_control_device(dev.clone()); self.client.add_client_obj(&dev)?; dev.clone() - .handle_new_source(IpcLocation::Clipboard, seat.global.get_selection()); + .handle_new_source(TransferLocation::Clipboard, seat.global.get_selection()); dev.clone().handle_new_source( - IpcLocation::PrimarySelection, + TransferLocation::PrimarySelection, seat.global.get_primary_selection(), ); Ok(()) diff --git a/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs b/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs index 8e707a55..fc75fcaa 100644 --- a/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs +++ b/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs @@ -2,7 +2,7 @@ use { crate::{ client::Client, ifs::data_transfer::{ - IpcLocation, SourceData, + TransferLocation, SourceData, data_control::{ private::{ DataControlSource, DataControlSourceData, @@ -49,7 +49,7 @@ impl ZwlrDataControlSourceV1 { data: DataControlSourceData { data: SourceData::new(client), version, - location: Cell::new(IpcLocation::Clipboard), + location: Cell::new(TransferLocation::Clipboard), used: Cell::new(false), }, tracker: Default::default(), diff --git a/src/ifs/data_transfer/wl_data_device.rs b/src/ifs/data_transfer/wl_data_device.rs index 053e9391..be3c30a8 100644 --- a/src/ifs/data_transfer/wl_data_device.rs +++ b/src/ifs/data_transfer/wl_data_device.rs @@ -4,7 +4,7 @@ use { fixed::Fixed, ifs::{ data_transfer::{ - DeviceData, IpcVtable, IterableIpcVtable, OfferData, Role, break_device_loops, + DeviceData, TransferVtable, IterableTransferVtable, OfferData, Role, break_device_loops, destroy_data_device, wl_data_offer::WlDataOffer, wl_data_source::WlDataSource, }, wl_seat::{WlSeatError, WlSeatGlobal}, @@ -141,16 +141,16 @@ impl WlDataDeviceRequestHandler for WlDataDevice { } fn release(&self, _req: Release, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_device::(self); + destroy_data_device::(self); self.seat.remove_data_device(self); self.client.remove_obj(self)?; Ok(()) } } -pub struct ClipboardIpc; +pub struct ClipboardTransfer; -impl IterableIpcVtable for ClipboardIpc { +impl IterableTransferVtable for ClipboardTransfer { fn for_each_device(seat: &WlSeatGlobal, client: ClientId, f: C) where C: FnMut(&Rc), @@ -159,7 +159,7 @@ impl IterableIpcVtable for ClipboardIpc { } } -impl IpcVtable for ClipboardIpc { +impl TransferVtable for ClipboardTransfer { type Device = WlDataDevice; type Source = WlDataSource; type Offer = WlDataOffer; @@ -216,7 +216,7 @@ object_base! { impl Object for WlDataDevice { fn break_loops(&self) { - break_device_loops::(self); + break_device_loops::(self); self.seat.remove_data_device(self); } } diff --git a/src/ifs/data_transfer/wl_data_offer.rs b/src/ifs/data_transfer/wl_data_offer.rs index 54ba950a..d4436b99 100644 --- a/src/ifs/data_transfer/wl_data_offer.rs +++ b/src/ifs/data_transfer/wl_data_offer.rs @@ -7,7 +7,7 @@ use { DataOffer, DataOfferId, DynDataOffer, OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED, OFFER_STATE_FINISHED, OfferData, Role, SOURCE_STATE_FINISHED, break_offer_loops, cancel_offer, destroy_data_offer, receive_data_offer, - wl_data_device::{ClipboardIpc, WlDataDevice}, + wl_data_device::{ClipboardTransfer, WlDataDevice}, wl_data_device_manager::DND_ALL, }, wl_seat::WlSeatGlobal, @@ -65,7 +65,7 @@ impl DynDataOffer for WlDataOffer { } fn cancel(&self) { - cancel_offer::(self); + cancel_offer::(self); } fn send_enter(&self, surface: WlSurfaceId, x: Fixed, y: Fixed, serial: u64) { @@ -133,12 +133,12 @@ impl WlDataOfferRequestHandler for WlDataOffer { if self.data.shared.state.get().contains(OFFER_STATE_FINISHED) { return Err(WlDataOfferError::AlreadyFinished); } - receive_data_offer::(self, req.mime_type, req.fd); + receive_data_offer::(self, req.mime_type, req.fd); Ok(()) } fn destroy(&self, _req: Destroy, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_offer::(self); + destroy_data_offer::(self); self.client.remove_obj(self)?; Ok(()) } @@ -198,7 +198,7 @@ object_base! { impl Object for WlDataOffer { fn break_loops(&self) { - break_offer_loops::(self); + break_offer_loops::(self); } } diff --git a/src/ifs/data_transfer/wl_data_source.rs b/src/ifs/data_transfer/wl_data_source.rs index 763a2bf3..351b8162 100644 --- a/src/ifs/data_transfer/wl_data_source.rs +++ b/src/ifs/data_transfer/wl_data_source.rs @@ -7,9 +7,9 @@ use { SOURCE_STATE_CANCELLED, SOURCE_STATE_DROPPED, SharedState, SourceData, add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source, detach_seat, offer_source_to_x, - wl_data_device::ClipboardIpc, + wl_data_device::ClipboardTransfer, wl_data_device_manager::{DND_ALL, DND_NONE}, - x_data_device::{XClipboardIpc, XIpcDevice}, + x_data_device::{XClipboardTransfer, XTransferDevice}, }, wl_seat::WlSeatGlobal, xdg_toplevel_drag_v1::XdgToplevelDragV1, @@ -52,8 +52,8 @@ impl DynDataSource for WlDataSource { WlDataSource::send_send(self, mime_type, fd); } - fn offer_to_x(self: Rc, dd: &Rc) { - offer_source_to_x::(self, dd); + fn offer_to_x(self: Rc, dd: &Rc) { + offer_source_to_x::(self, dd); } fn detach_seat(&self, seat: &Rc) { @@ -201,12 +201,12 @@ impl WlDataSourceRequestHandler for WlDataSource { type Error = WlDataSourceError; fn offer(&self, req: Offer, _slf: &Rc) -> Result<(), Self::Error> { - add_data_source_mime_type::(self, req.mime_type); + add_data_source_mime_type::(self, req.mime_type); Ok(()) } fn destroy(&self, _req: Destroy, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_source::(self); + destroy_data_source::(self); self.data.client.remove_obj(self)?; Ok(()) } @@ -230,7 +230,7 @@ object_base! { impl Object for WlDataSource { fn break_loops(&self) { - break_source_loops::(self); + break_source_loops::(self); self.toplevel_drag.take(); } } diff --git a/src/ifs/data_transfer/x_data_device.rs b/src/ifs/data_transfer/x_data_device.rs index cf9e8c73..7ca8a024 100644 --- a/src/ifs/data_transfer/x_data_device.rs +++ b/src/ifs/data_transfer/x_data_device.rs @@ -3,7 +3,7 @@ use { client::{Client, ClientError}, ifs::{ data_transfer::{ - DeviceData, IpcLocation, IpcVtable, OfferData, Role, x_data_offer::XDataOffer, + DeviceData, TransferLocation, TransferVtable, OfferData, Role, x_data_offer::XDataOffer, x_data_source::XDataSource, }, wl_seat::WlSeatGlobal, @@ -11,14 +11,14 @@ use { state::State, xwayland::XWaylandEvent, }, - XWaylandEvent::IpcSetOffer, + XWaylandEvent::DataTransferSetOffer, std::rc::Rc, }; -linear_ids!(XIpcDeviceIds, XIpcDeviceId, u64); +linear_ids!(XTransferDeviceIds, XTransferDeviceId, u64); -pub struct XIpcDevice { - pub id: XIpcDeviceId, +pub struct XTransferDevice { + pub id: XTransferDeviceId, pub clipboard: DeviceData, pub primary_selection: DeviceData, pub seat: Rc, @@ -27,45 +27,45 @@ pub struct XIpcDevice { } #[derive(Default)] -pub struct XClipboardIpc; +pub struct XClipboardTransfer; #[derive(Default)] -pub struct XPrimarySelectionIpc; +pub struct XPrimarySelectionTransfer; -pub trait XIpc { - const LOCATION: IpcLocation; +pub trait XTransfer { + const LOCATION: TransferLocation; fn x_unset(seat: &Rc); - fn x_device_data(dd: &XIpcDevice) -> &DeviceData; + fn x_device_data(dd: &XTransferDevice) -> &DeviceData; } -impl XIpc for XClipboardIpc { - const LOCATION: IpcLocation = IpcLocation::Clipboard; +impl XTransfer for XClipboardTransfer { + const LOCATION: TransferLocation = TransferLocation::Clipboard; fn x_unset(seat: &Rc) { seat.unset_selection(); } - fn x_device_data(dd: &XIpcDevice) -> &DeviceData { + fn x_device_data(dd: &XTransferDevice) -> &DeviceData { &dd.clipboard } } -impl XIpc for XPrimarySelectionIpc { - const LOCATION: IpcLocation = IpcLocation::PrimarySelection; +impl XTransfer for XPrimarySelectionTransfer { + const LOCATION: TransferLocation = TransferLocation::PrimarySelection; fn x_unset(seat: &Rc) { seat.unset_primary_selection(); } - fn x_device_data(dd: &XIpcDevice) -> &DeviceData { + fn x_device_data(dd: &XTransferDevice) -> &DeviceData { &dd.primary_selection } } -impl IpcVtable for T { - type Device = XIpcDevice; +impl TransferVtable for T { + type Device = XTransferDevice; type Source = XDataSource; type Offer = XDataOffer; @@ -97,7 +97,7 @@ impl IpcVtable for T { dd.state .xwayland .queue - .push(XWaylandEvent::IpcSetSelection { + .push(XWaylandEvent::DataTransferSetSelection { seat: dd.seat.id(), location: T::LOCATION, offer: offer.cloned(), @@ -105,7 +105,7 @@ impl IpcVtable for T { } fn send_offer(dd: &Self::Device, offer: &Rc) { - dd.state.xwayland.queue.push(IpcSetOffer { + dd.state.xwayland.queue.push(DataTransferSetOffer { location: T::LOCATION, seat: dd.seat.id(), offer: offer.clone(), diff --git a/src/ifs/data_transfer/x_data_offer.rs b/src/ifs/data_transfer/x_data_offer.rs index 8b562476..a8a43cd8 100644 --- a/src/ifs/data_transfer/x_data_offer.rs +++ b/src/ifs/data_transfer/x_data_offer.rs @@ -3,28 +3,28 @@ use { client::ClientId, ifs::{ data_transfer::{ - DataOffer, DataOfferId, DynDataOffer, IpcLocation, OfferData, cancel_offer, - x_data_device::{XClipboardIpc, XIpcDevice, XPrimarySelectionIpc}, + DataOffer, DataOfferId, DynDataOffer, TransferLocation, OfferData, cancel_offer, + x_data_device::{XClipboardTransfer, XTransferDevice, XPrimarySelectionTransfer}, }, wl_seat::WlSeatGlobal, }, leaks::Tracker, xwayland::XWaylandEvent, }, - XWaylandEvent::IpcAddOfferMimeType, + XWaylandEvent::DataTransferAddOfferMimeType, std::rc::Rc, }; pub struct XDataOffer { pub offer_id: DataOfferId, - pub device: Rc, - pub data: OfferData, + pub device: Rc, + pub data: OfferData, pub tracker: Tracker, - pub location: IpcLocation, + pub location: TransferLocation, } impl DataOffer for XDataOffer { - type Device = XIpcDevice; + type Device = XTransferDevice; fn offer_data(&self) -> &OfferData { &self.data @@ -41,7 +41,7 @@ impl DynDataOffer for XDataOffer { } fn send_offer(&self, mime_type: &str) { - self.device.state.xwayland.queue.push(IpcAddOfferMimeType { + self.device.state.xwayland.queue.push(DataTransferAddOfferMimeType { location: self.location, seat: self.device.seat.id(), offer: self.offer_id, @@ -51,8 +51,8 @@ impl DynDataOffer for XDataOffer { fn cancel(&self) { match self.location { - IpcLocation::Clipboard => cancel_offer::(self), - IpcLocation::PrimarySelection => cancel_offer::(self), + TransferLocation::Clipboard => cancel_offer::(self), + TransferLocation::PrimarySelection => cancel_offer::(self), } } diff --git a/src/ifs/data_transfer/x_data_source.rs b/src/ifs/data_transfer/x_data_source.rs index d0528fc1..7361a1bf 100644 --- a/src/ifs/data_transfer/x_data_source.rs +++ b/src/ifs/data_transfer/x_data_source.rs @@ -2,13 +2,13 @@ use { crate::{ ifs::{ data_transfer::{ - DataSource, DynDataSource, IpcLocation, SourceData, cancel_offers, detach_seat, - x_data_device::XIpcDevice, + DataSource, DynDataSource, TransferLocation, SourceData, cancel_offers, detach_seat, + x_data_device::XTransferDevice, }, wl_seat::WlSeatGlobal, }, state::State, - xwayland::XWaylandEvent::{IpcCancelSource, IpcSendSource, IpcSetSelection}, + xwayland::XWaylandEvent::{DataTransferCancelSource, DataTransferSendSource, DataTransferSetSelection}, }, std::rc::Rc, uapi::OwnedFd, @@ -16,14 +16,14 @@ use { pub struct XDataSource { pub state: Rc, - pub device: Rc, + pub device: Rc, pub data: SourceData, - pub location: IpcLocation, + pub location: TransferLocation, } impl DataSource for XDataSource { fn send_cancelled(&self, seat: &Rc) { - self.state.xwayland.queue.push(IpcCancelSource { + self.state.xwayland.queue.push(DataTransferCancelSource { location: self.location, seat: seat.id(), source: self.data.id, @@ -37,7 +37,7 @@ impl DynDataSource for XDataSource { } fn send_send(&self, mime_type: &str, fd: Rc) { - self.state.xwayland.queue.push(IpcSendSource { + self.state.xwayland.queue.push(DataTransferSendSource { location: self.location, seat: self.device.seat.id(), source: self.data.id, @@ -46,9 +46,9 @@ impl DynDataSource for XDataSource { }); } - fn offer_to_x(self: Rc, _dd: &Rc) { + fn offer_to_x(self: Rc, _dd: &Rc) { self.cancel_unprivileged_offers(); - self.state.xwayland.queue.push(IpcSetSelection { + self.state.xwayland.queue.push(DataTransferSetSelection { location: self.location, seat: self.device.seat.id(), offer: None, diff --git a/src/ifs/data_transfer/zwp_primary_selection_device_v1.rs b/src/ifs/data_transfer/zwp_primary_selection_device_v1.rs index c66ec93d..1c045c21 100644 --- a/src/ifs/data_transfer/zwp_primary_selection_device_v1.rs +++ b/src/ifs/data_transfer/zwp_primary_selection_device_v1.rs @@ -3,7 +3,7 @@ use { client::{Client, ClientError, ClientId}, ifs::{ data_transfer::{ - DeviceData, IpcVtable, IterableIpcVtable, OfferData, Role, break_device_loops, + DeviceData, TransferVtable, IterableTransferVtable, OfferData, Role, break_device_loops, destroy_data_device, zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1, zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, }, @@ -89,16 +89,16 @@ impl ZwpPrimarySelectionDeviceV1RequestHandler for ZwpPrimarySelectionDeviceV1 { } fn destroy(&self, _req: Destroy, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_device::(self); + destroy_data_device::(self); self.seat.remove_primary_selection_device(self); self.client.remove_obj(self)?; Ok(()) } } -pub struct PrimarySelectionIpc; +pub struct PrimarySelectionTransfer; -impl IterableIpcVtable for PrimarySelectionIpc { +impl IterableTransferVtable for PrimarySelectionTransfer { fn for_each_device(seat: &WlSeatGlobal, client: ClientId, f: C) where C: FnMut(&Rc), @@ -107,7 +107,7 @@ impl IterableIpcVtable for PrimarySelectionIpc { } } -impl IpcVtable for PrimarySelectionIpc { +impl TransferVtable for PrimarySelectionTransfer { type Device = ZwpPrimarySelectionDeviceV1; type Source = ZwpPrimarySelectionSourceV1; type Offer = ZwpPrimarySelectionOfferV1; @@ -162,7 +162,7 @@ object_base! { impl Object for ZwpPrimarySelectionDeviceV1 { fn break_loops(&self) { - break_device_loops::(self); + break_device_loops::(self); self.seat.remove_primary_selection_device(self); } } diff --git a/src/ifs/data_transfer/zwp_primary_selection_offer_v1.rs b/src/ifs/data_transfer/zwp_primary_selection_offer_v1.rs index 71553a03..d4f22603 100644 --- a/src/ifs/data_transfer/zwp_primary_selection_offer_v1.rs +++ b/src/ifs/data_transfer/zwp_primary_selection_offer_v1.rs @@ -6,7 +6,7 @@ use { DataOffer, DataOfferId, DynDataOffer, OfferData, break_offer_loops, cancel_offer, destroy_data_offer, receive_data_offer, zwp_primary_selection_device_v1::{ - PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, + PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1, }, }, wl_seat::WlSeatGlobal, @@ -51,7 +51,7 @@ impl DynDataOffer for ZwpPrimarySelectionOfferV1 { } fn cancel(&self) { - cancel_offer::(self); + cancel_offer::(self); } fn get_seat(&self) -> Rc { @@ -72,12 +72,12 @@ impl ZwpPrimarySelectionOfferV1RequestHandler for ZwpPrimarySelectionOfferV1 { type Error = ZwpPrimarySelectionOfferV1Error; fn receive(&self, req: Receive, _slf: &Rc) -> Result<(), Self::Error> { - receive_data_offer::(self, req.mime_type, req.fd); + receive_data_offer::(self, req.mime_type, req.fd); Ok(()) } fn destroy(&self, _req: Destroy, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_offer::(self); + destroy_data_offer::(self); self.client.remove_obj(self)?; Ok(()) } @@ -90,7 +90,7 @@ object_base! { impl Object for ZwpPrimarySelectionOfferV1 { fn break_loops(&self) { - break_offer_loops::(self); + break_offer_loops::(self); } } diff --git a/src/ifs/data_transfer/zwp_primary_selection_source_v1.rs b/src/ifs/data_transfer/zwp_primary_selection_source_v1.rs index 050a7943..ddea8f1d 100644 --- a/src/ifs/data_transfer/zwp_primary_selection_source_v1.rs +++ b/src/ifs/data_transfer/zwp_primary_selection_source_v1.rs @@ -6,8 +6,8 @@ use { DataSource, DynDataSource, SourceData, add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source, detach_seat, offer_source_to_x, - x_data_device::{XIpcDevice, XPrimarySelectionIpc}, - zwp_primary_selection_device_v1::PrimarySelectionIpc, + x_data_device::{XTransferDevice, XPrimarySelectionTransfer}, + zwp_primary_selection_device_v1::PrimarySelectionTransfer, }, wl_seat::WlSeatGlobal, }, @@ -42,8 +42,8 @@ impl DynDataSource for ZwpPrimarySelectionSourceV1 { ZwpPrimarySelectionSourceV1::send_send(self, mime_type, fd) } - fn offer_to_x(self: Rc, dd: &Rc) { - offer_source_to_x::(self, dd); + fn offer_to_x(self: Rc, dd: &Rc) { + offer_source_to_x::(self, dd); } fn detach_seat(&self, seat: &Rc) { @@ -82,12 +82,12 @@ impl ZwpPrimarySelectionSourceV1RequestHandler for ZwpPrimarySelectionSourceV1 { type Error = ZwpPrimarySelectionSourceV1Error; fn offer(&self, req: Offer, _slf: &Rc) -> Result<(), Self::Error> { - add_data_source_mime_type::(self, req.mime_type); + add_data_source_mime_type::(self, req.mime_type); Ok(()) } fn destroy(&self, _req: Destroy, _slf: &Rc) -> Result<(), Self::Error> { - destroy_data_source::(self); + destroy_data_source::(self); self.data.client.remove_obj(self)?; Ok(()) } @@ -100,7 +100,7 @@ object_base! { impl Object for ZwpPrimarySelectionSourceV1 { fn break_loops(&self) { - break_source_loops::(self); + break_source_loops::(self); } } diff --git a/src/ifs/wl_seat.rs b/src/ifs/wl_seat.rs index 4c5d02bd..2ba1fb02 100644 --- a/src/ifs/wl_seat.rs +++ b/src/ifs/wl_seat.rs @@ -35,14 +35,14 @@ use { ifs::{ ext_idle_notification_v1::ExtIdleNotificationV1, data_transfer::{ - self, DynDataSource, IpcError, IpcLocation, + self, DynDataSource, TransferError, TransferLocation, data_control::{DataControlDeviceId, DynDataControlDevice}, offer_source_to_regular_client, - wl_data_device::{ClipboardIpc, WlDataDevice}, + wl_data_device::{ClipboardTransfer, WlDataDevice}, wl_data_source::WlDataSource, - x_data_device::{XClipboardIpc, XIpcDevice, XIpcDeviceId, XPrimarySelectionIpc}, + x_data_device::{XClipboardTransfer, XTransferDevice, XTransferDeviceId, XPrimarySelectionTransfer}, zwp_primary_selection_device_v1::{ - PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, + PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1, }, zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, }, @@ -191,7 +191,7 @@ pub struct WlSeatGlobal { found_tree: RefCell>, keyboard_node: CloneCell>, bindings: RefCell>>>, - x_data_devices: SmallMap, 1>, + x_data_devices: SmallMap, 1>, data_devices: RefCell>>>, primary_selection_devices: RefCell< AHashMap< @@ -474,15 +474,15 @@ impl WlSeatGlobal { .insert(device.id, device.clone()); } - pub fn set_x_data_device(&self, device: &Rc) { + pub fn set_x_data_device(&self, device: &Rc) { self.x_data_devices.insert(device.id, device.clone()); } - pub fn unset_x_data_device(&self, id: XIpcDeviceId) { + pub fn unset_x_data_device(&self, id: XTransferDeviceId) { self.x_data_devices.remove(&id); } - pub fn for_each_x_data_device(&self, mut f: impl FnMut(&Rc)) { + pub fn for_each_x_data_device(&self, mut f: impl FnMut(&Rc)) { for (_, dev) in &self.x_data_devices { f(&dev); } @@ -1284,11 +1284,11 @@ impl WlSeatGlobal { self: &Rc, field: &CloneCell>>, src: Option>, - location: IpcLocation, + location: TransferLocation, ) -> Result<(), WlSeatError> where - T: data_transfer::IterableIpcVtable, - X: data_transfer::IpcVtable, + T: data_transfer::IterableTransferVtable, + X: data_transfer::TransferVtable, S: DynDataSource, { if let (Some(new), Some(old)) = (&src, &field.get()) @@ -1319,8 +1319,8 @@ impl WlSeatGlobal { selection: Option>, client: &Rc, ) where - T: data_transfer::IterableIpcVtable, - X: data_transfer::IpcVtable, + T: data_transfer::IterableTransferVtable, + X: data_transfer::TransferVtable, { if let Some(src) = &selection { src.cancel_unprivileged_offers(); @@ -1415,10 +1415,10 @@ impl WlSeatGlobal { self: &Rc, selection: Option>, ) -> Result<(), WlSeatError> { - self.set_selection_::( + self.set_selection_::( &self.selection, selection, - IpcLocation::Clipboard, + TransferLocation::Clipboard, ) } @@ -1462,10 +1462,10 @@ impl WlSeatGlobal { self: &Rc, selection: Option>, ) -> Result<(), WlSeatError> { - self.set_selection_::( + self.set_selection_::( &self.primary_selection, selection, - IpcLocation::PrimarySelection, + TransferLocation::PrimarySelection, ) } @@ -1915,7 +1915,7 @@ pub enum WlSeatError { #[error(transparent)] ClientError(Box), #[error(transparent)] - IpcError(#[from] IpcError), + TransferError(#[from] TransferError), #[error(transparent)] WlKeyboardError(Box), #[error("Data source has a toplevel attached")] diff --git a/src/ifs/wl_seat/event_handling.rs b/src/ifs/wl_seat/event_handling.rs index 53a030de..cef66089 100644 --- a/src/ifs/wl_seat/event_handling.rs +++ b/src/ifs/wl_seat/event_handling.rs @@ -11,10 +11,10 @@ use { ifs::{ data_transfer::{ offer_source_to_regular_client, - wl_data_device::{ClipboardIpc, WlDataDevice}, - x_data_device::{XClipboardIpc, XPrimarySelectionIpc}, + wl_data_device::{ClipboardTransfer, WlDataDevice}, + x_data_device::{XClipboardTransfer, XPrimarySelectionTransfer}, zwp_primary_selection_device_v1::{ - PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, + PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1, }, }, wl_seat::{ @@ -1611,11 +1611,11 @@ impl WlSeatGlobal { }); if self.keyboard_node.get().node_client_id() != Some(surface.client.id) { - self.offer_selection_to_client::( + self.offer_selection_to_client::( self.selection.get(), &surface.client, ); - self.offer_selection_to_client::( + self.offer_selection_to_client::( self.primary_selection.get(), &surface.client, ); @@ -1739,7 +1739,7 @@ impl WlSeatGlobal { ) { if let Some(src) = &dnd.src { if !surface.client.is_xwayland { - offer_source_to_regular_client::(src.clone(), &surface.client); + offer_source_to_regular_client::(src.clone(), &surface.client); } src.for_each_data_offer(|offer| { offer.send_enter(surface.id, x, y, serial); diff --git a/src/state.rs b/src/state.rs index 232dc085..bcb4f63e 100644 --- a/src/state.rs +++ b/src/state.rs @@ -65,7 +65,7 @@ use { }, data_transfer::{ DataOfferIds, DataSourceIds, data_control::DataControlDeviceIds, - x_data_device::XIpcDeviceIds, + x_data_device::XTransferDeviceIds, }, jay_render_ctx::JayRenderCtx, jay_screencast::JayScreencast, @@ -435,7 +435,7 @@ pub struct XWaylandState { pub pidfd: CloneCell>>, pub handler: RefCell>>, pub queue: Rc>, - pub ipc_device_ids: XIpcDeviceIds, + pub ipc_device_ids: XTransferDeviceIds, pub use_wire_scale: Cell, pub wire_scale: Cell>, pub windows: CopyHashMap>, diff --git a/src/xwayland.rs b/src/xwayland.rs index b0e409e3..37949193 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -7,7 +7,7 @@ use { compositor::DISPLAY, forker::{ForkerError, ForkerProxy}, ifs::{ - data_transfer::{DataOfferId, DataSourceId, IpcLocation, x_data_offer::XDataOffer}, + data_transfer::{DataOfferId, DataSourceId, TransferLocation, x_data_offer::XDataOffer}, wl_seat::SeatId, wl_surface::x_surface::xwindow::{Xwindow, XwindowData}, }, @@ -264,30 +264,30 @@ pub enum XWaylandEvent { #[expect(dead_code)] SeatChanged, - IpcCancelSource { - location: IpcLocation, + DataTransferCancelSource { + location: TransferLocation, seat: SeatId, source: DataSourceId, }, - IpcSendSource { - location: IpcLocation, + DataTransferSendSource { + location: TransferLocation, seat: SeatId, source: DataSourceId, mime_type: String, fd: Rc, }, - IpcSetOffer { - location: IpcLocation, + DataTransferSetOffer { + location: TransferLocation, seat: SeatId, offer: Rc, }, - IpcSetSelection { - location: IpcLocation, + DataTransferSetSelection { + location: TransferLocation, seat: SeatId, offer: Option>, }, - IpcAddOfferMimeType { - location: IpcLocation, + DataTransferAddOfferMimeType { + location: TransferLocation, seat: SeatId, offer: DataOfferId, mime_type: String, diff --git a/src/xwayland/xwm.rs b/src/xwayland/xwm.rs index effaf682..43532f61 100644 --- a/src/xwayland/xwm.rs +++ b/src/xwayland/xwm.rs @@ -7,10 +7,10 @@ use { criteria::tlm::{TL_CHANGED_CLASS_INST, TL_CHANGED_ROLE}, ifs::{ data_transfer::{ - DataOfferId, DataSourceId, DynDataOffer, DynDataSource, IpcLocation, IpcVtable, + DataOfferId, DataSourceId, DynDataOffer, DynDataSource, TransferLocation, TransferVtable, SourceData, add_data_source_mime_type, destroy_data_device, destroy_data_offer, destroy_data_source, receive_data_offer, - x_data_device::{XClipboardIpc, XIpc, XIpcDevice, XPrimarySelectionIpc}, + x_data_device::{XClipboardTransfer, XTransfer, XTransferDevice, XPrimarySelectionTransfer}, x_data_offer::XDataOffer, x_data_source::XDataSource, }, @@ -168,7 +168,7 @@ struct EnhancedOffer { } #[derive(Default)] -struct SelectionData { +struct SelectionData { sources: CopyHashMap>, offers: CopyHashMap>, active_offer: CloneCell>>, @@ -178,7 +178,7 @@ struct SelectionData { _phantom: PhantomData, } -impl SelectionData { +impl SelectionData { fn destroy(&self) { for offer in self.offers.lock().drain_values() { destroy_data_offer::(&offer.offer); @@ -206,9 +206,9 @@ impl SelectionData { #[derive(Default)] pub struct XwmShared { - devices: CopyHashMap>, - data: SelectionData, - primary_selection: SelectionData, + devices: CopyHashMap>, + data: SelectionData, + primary_selection: SelectionData, transfers: CopyHashMap>, } @@ -217,8 +217,8 @@ impl Drop for XwmShared { self.data.destroy(); self.primary_selection.destroy(); for device in self.devices.lock().drain_values() { - destroy_data_device::(&device); - destroy_data_device::(&device); + destroy_data_device::(&device); + destroy_data_device::(&device); device.seat.unset_x_data_device(device.id); } self.transfers.clear(); @@ -566,7 +566,7 @@ impl Wm { self.shared.devices.remove(&seat); } for seat in new_seats { - let dd = Rc::new(XIpcDevice { + let dd = Rc::new(XTransferDevice { id: self.state.xwayland.ipc_device_ids.next(), clipboard: Default::default(), primary_selection: Default::default(), @@ -609,29 +609,29 @@ impl Wm { XWaylandEvent::ActivateRoot => self.activate_window(None, Initiator::Wayland).await, XWaylandEvent::Close(window) => self.close_window(&window).await, XWaylandEvent::SeatChanged => self.seats_changed(), - XWaylandEvent::IpcCancelSource { + XWaylandEvent::DataTransferCancelSource { location, seat, source, } => match location { - IpcLocation::Clipboard => { - self.dd_cancel_source::(&self.shared.clone().data, seat, source) + TransferLocation::Clipboard => { + self.dd_cancel_source::(&self.shared.clone().data, seat, source) } - IpcLocation::PrimarySelection => self.dd_cancel_source::( + TransferLocation::PrimarySelection => self.dd_cancel_source::( &self.shared.clone().primary_selection, seat, source, ), }, - XWaylandEvent::IpcSendSource { + XWaylandEvent::DataTransferSendSource { location, seat, source, mime_type, fd, } => match location { - IpcLocation::Clipboard => { - self.dd_send_source::( + TransferLocation::Clipboard => { + self.dd_send_source::( &self.shared.clone().data, seat, source, @@ -640,8 +640,8 @@ impl Wm { ) .await } - IpcLocation::PrimarySelection => { - self.dd_send_source::( + TransferLocation::PrimarySelection => { + self.dd_send_source::( &self.shared.clone().primary_selection, seat, source, @@ -651,17 +651,17 @@ impl Wm { .await } }, - XWaylandEvent::IpcSetOffer { + XWaylandEvent::DataTransferSetOffer { location, seat, offer, } => match location { - IpcLocation::Clipboard => { - self.dd_set_offer::(&self.shared.clone().data, seat, offer) + TransferLocation::Clipboard => { + self.dd_set_offer::(&self.shared.clone().data, seat, offer) .await } - IpcLocation::PrimarySelection => { - self.dd_set_offer::( + TransferLocation::PrimarySelection => { + self.dd_set_offer::( &self.shared.clone().primary_selection, seat, offer, @@ -669,17 +669,17 @@ impl Wm { .await } }, - XWaylandEvent::IpcSetSelection { + XWaylandEvent::DataTransferSetSelection { seat, location, offer, } => match location { - IpcLocation::Clipboard => { - self.dd_set_selection::(&self.shared.clone().data, seat, offer) + TransferLocation::Clipboard => { + self.dd_set_selection::(&self.shared.clone().data, seat, offer) .await } - IpcLocation::PrimarySelection => { - self.dd_set_selection::( + TransferLocation::PrimarySelection => { + self.dd_set_selection::( &self.shared.clone().primary_selection, seat, offer, @@ -687,14 +687,14 @@ impl Wm { .await } }, - XWaylandEvent::IpcAddOfferMimeType { + XWaylandEvent::DataTransferAddOfferMimeType { location, seat, offer, mime_type, } => match location { - IpcLocation::Clipboard => { - self.dd_add_offer_mime_type::( + TransferLocation::Clipboard => { + self.dd_add_offer_mime_type::( &self.shared.clone().data, seat, offer, @@ -702,8 +702,8 @@ impl Wm { ) .await } - IpcLocation::PrimarySelection => { - self.dd_add_offer_mime_type::( + TransferLocation::PrimarySelection => { + self.dd_add_offer_mime_type::( &self.shared.clone().primary_selection, seat, offer, @@ -715,7 +715,7 @@ impl Wm { } } - async fn dd_add_offer_mime_type( + async fn dd_add_offer_mime_type( &mut self, sd: &SelectionData, seat: SeatId, @@ -741,7 +741,7 @@ impl Wm { enhanced.mime_types.borrow_mut().push(mt); } - async fn dd_set_offer( + async fn dd_set_offer( &mut self, sd: &SelectionData, seat: SeatId, @@ -762,7 +762,7 @@ impl Wm { ); } - async fn dd_set_selection( + async fn dd_set_selection( &mut self, sd: &SelectionData, seat: SeatId, @@ -857,7 +857,7 @@ impl Wm { } } - async fn dd_send_source( + async fn dd_send_source( &mut self, sd: &SelectionData, seat: SeatId, @@ -898,7 +898,7 @@ impl Wm { .push(PendingTransfer { mime_type, fd }); } - fn dd_cancel_source( + fn dd_cancel_source( &mut self, sd: &SelectionData, seat: SeatId, @@ -1604,7 +1604,7 @@ impl Wm { } } - async fn handle_xfixes_selection_notify_( + async fn handle_xfixes_selection_notify_( &mut self, sd: &SelectionData, event: &XfixesSelectionNotify, @@ -1658,7 +1658,7 @@ impl Wm { } } - async fn handle_selection_request_( + async fn handle_selection_request_( &mut self, sd: &SelectionData, event: &SelectionRequest, @@ -1762,7 +1762,7 @@ impl Wm { } } - async fn handle_selection_notify_( + async fn handle_selection_notify_( &mut self, sd: &SelectionData, event: &SelectionNotify, @@ -1790,8 +1790,8 @@ impl Wm { add_data_source_mime_type::(&source, target); } let res = match source.location { - IpcLocation::Clipboard => seat.set_selection(Some(source.clone())), - IpcLocation::PrimarySelection => { + TransferLocation::Clipboard => seat.set_selection(Some(source.clone())), + TransferLocation::PrimarySelection => { seat.set_primary_selection(Some(source.clone())) } };