1
0
Fork 0
forked from wry/wry

ifs: rename data transfer interfaces

This commit is contained in:
kossLAN 2026-05-29 18:08:56 -04:00
parent f9e8d614ce
commit 5cb7b5973f
No known key found for this signature in database
21 changed files with 223 additions and 223 deletions

View file

@ -2,7 +2,7 @@ use {
crate::{ crate::{
client::{Client, ClientError, ClientId}, client::{Client, ClientError, ClientId},
fixed::Fixed, fixed::Fixed,
ifs::{data_transfer::x_data_device::XIpcDevice, wl_seat::WlSeatGlobal}, ifs::{data_transfer::x_data_device::XTransferDevice, wl_seat::WlSeatGlobal},
utils::{ utils::{
bitflags::BitflagsExt, cell_ext::CellExt, clonecell::CloneCell, numcell::NumCell, bitflags::BitflagsExt, cell_ext::CellExt, clonecell::CloneCell, numcell::NumCell,
smallmap::SmallMap, smallmap::SmallMap,
@ -38,7 +38,7 @@ linear_ids!(DataSourceIds, DataSourceId, u64);
linear_ids!(DataOfferIds, DataOfferId, u64); linear_ids!(DataOfferIds, DataOfferId, u64);
#[derive(Debug, Copy, Clone, Eq, PartialEq)] #[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum IpcLocation { pub enum TransferLocation {
Clipboard, Clipboard,
PrimarySelection, PrimarySelection,
} }
@ -56,7 +56,7 @@ pub trait DataSource: DynDataSource {
pub trait DynDataSource: 'static { pub trait DynDataSource: 'static {
fn source_data(&self) -> &SourceData; fn source_data(&self) -> &SourceData;
fn send_send(&self, mime_type: &str, fd: Rc<OwnedFd>); fn send_send(&self, mime_type: &str, fd: Rc<OwnedFd>);
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>); fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>);
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>); fn detach_seat(&self, seat: &Rc<WlSeatGlobal>);
fn cancel_unprivileged_offers(&self); 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<C>(seat: &WlSeatGlobal, client: ClientId, f: C) fn for_each_device<C>(seat: &WlSeatGlobal, client: ClientId, f: C)
where where
C: FnMut(&Rc<Self::Device>); C: FnMut(&Rc<Self::Device>);
} }
pub trait IpcVtable: Sized { pub trait TransferVtable: Sized {
type Device; type Device;
type Source: DataSource; type Source: DataSource;
type Offer: DataOffer<Device = Self::Device>; type Offer: DataOffer<Device = Self::Device>;
@ -167,7 +167,7 @@ pub struct OfferData<D> {
} }
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum IpcError { pub enum TransferError {
#[error("The data source is already attached")] #[error("The data source is already attached")]
AlreadyAttached, AlreadyAttached,
#[error("The data source does not have drag-and-drop actions set")] #[error("The data source does not have drag-and-drop actions set")]
@ -248,20 +248,20 @@ pub fn attach_seat<S: DynDataSource>(
src: &S, src: &S,
seat: &Rc<WlSeatGlobal>, seat: &Rc<WlSeatGlobal>,
role: Role, role: Role,
) -> Result<(), IpcError> { ) -> Result<(), TransferError> {
let data = src.source_data(); let data = src.source_data();
let mut state = data.state.get(); let mut state = data.state.get();
if state.contains(SOURCE_STATE_USED) { if state.contains(SOURCE_STATE_USED) {
return Err(IpcError::AlreadyAttached); return Err(TransferError::AlreadyAttached);
} }
state |= SOURCE_STATE_USED; state |= SOURCE_STATE_USED;
if role == Role::Dnd { if role == Role::Dnd {
if data.actions.is_none() { if data.actions.is_none() {
return Err(IpcError::ActionsNotSet); return Err(TransferError::ActionsNotSet);
} }
} else { } else {
if data.actions.is_some() { if data.actions.is_some() {
return Err(IpcError::ActionsSet); return Err(TransferError::ActionsSet);
} }
} }
data.state.set(state); data.state.set(state);
@ -283,7 +283,7 @@ pub fn cancel_offers<S: DynDataSource>(src: &S, cancel_privileged: bool) {
data.offers.replace(offers); data.offers.replace(offers);
} }
pub fn cancel_offer<T: IpcVtable>(offer: &T::Offer) { pub fn cancel_offer<T: TransferVtable>(offer: &T::Offer) {
let data = offer.offer_data(); let data = offer.offer_data();
data.source.take(); data.source.take();
destroy_data_offer::<T>(&offer); destroy_data_offer::<T>(&offer);
@ -299,7 +299,7 @@ pub fn detach_seat<S: DataSource>(src: &S, seat: &Rc<WlSeatGlobal>) {
// data.client.flush(); // data.client.flush();
} }
fn offer_source_to_device<T: IpcVtable>( fn offer_source_to_device<T: TransferVtable>(
src: &Rc<dyn DynDataSource>, src: &Rc<dyn DynDataSource>,
dd: &Rc<T::Device>, dd: &Rc<T::Device>,
data: &SourceData, data: &SourceData,
@ -335,9 +335,9 @@ fn offer_source_to_device<T: IpcVtable>(
} }
} }
fn offer_source_to_x<T>(src: Rc<dyn DynDataSource>, dd: &Rc<XIpcDevice>) fn offer_source_to_x<T>(src: Rc<dyn DynDataSource>, dd: &Rc<XTransferDevice>)
where where
T: IpcVtable<Device = XIpcDevice>, T: TransferVtable<Device = XTransferDevice>,
{ {
let data = src.source_data(); let data = src.source_data();
src.cancel_unprivileged_offers(); src.cancel_unprivileged_offers();
@ -348,7 +348,7 @@ where
pub fn offer_source_to_data_control_device<T>(src: Rc<dyn DynDataSource>, dd: &Rc<T::Device>) pub fn offer_source_to_data_control_device<T>(src: Rc<dyn DynDataSource>, dd: &Rc<T::Device>)
where where
T: IpcVtable, T: TransferVtable,
{ {
let data = src.source_data(); let data = src.source_data();
let shared = data.shared.get(); let shared = data.shared.get();
@ -356,7 +356,7 @@ where
offer_source_to_device::<T>(&src, dd, data, shared); offer_source_to_device::<T>(&src, dd, data, shared);
} }
pub fn offer_source_to_regular_client<T: IterableIpcVtable>( pub fn offer_source_to_regular_client<T: IterableTransferVtable>(
src: Rc<dyn DynDataSource>, src: Rc<dyn DynDataSource>,
client: &Rc<Client>, client: &Rc<Client>,
) { ) {
@ -376,7 +376,7 @@ pub fn offer_source_to_regular_client<T: IterableIpcVtable>(
}); });
} }
pub fn add_data_source_mime_type<T: IpcVtable>(src: &T::Source, mime_type: &str) { pub fn add_data_source_mime_type<T: TransferVtable>(src: &T::Source, mime_type: &str) {
let data = src.source_data(); let data = src.source_data();
if data.mime_types.borrow_mut().insert(mime_type.to_string()) { if data.mime_types.borrow_mut().insert(mime_type.to_string()) {
for (_, offer) in &data.offers { for (_, offer) in &data.offers {
@ -387,14 +387,14 @@ pub fn add_data_source_mime_type<T: IpcVtable>(src: &T::Source, mime_type: &str)
} }
} }
pub fn destroy_data_source<T: IpcVtable>(src: &T::Source) { pub fn destroy_data_source<T: TransferVtable>(src: &T::Source) {
let data = src.source_data(); let data = src.source_data();
if let Some(seat) = data.seat.take() { if let Some(seat) = data.seat.take() {
T::unset(&seat, data.role.get()); T::unset(&seat, data.role.get());
} }
} }
pub fn destroy_data_offer<T: IpcVtable>(offer: &T::Offer) { pub fn destroy_data_offer<T: TransferVtable>(offer: &T::Offer) {
let data = offer.offer_data(); let data = offer.offer_data();
if let Some(device) = data.device.take() { if let Some(device) = data.device.take() {
let device_data = T::get_device_data(&device); let device_data = T::get_device_data(&device);
@ -421,7 +421,7 @@ pub fn destroy_data_offer<T: IpcVtable>(offer: &T::Offer) {
} }
} }
pub fn destroy_data_device<T: IpcVtable>(dd: &T::Device) { pub fn destroy_data_device<T: TransferVtable>(dd: &T::Device) {
let data = T::get_device_data(dd); let data = T::get_device_data(dd);
let offers = [data.selection.take(), data.dnd.take()]; let offers = [data.selection.take(), data.dnd.take()];
for offer in offers.into_iter().flat_map(|o| o.into_iter()) { for offer in offers.into_iter().flat_map(|o| o.into_iter()) {
@ -430,7 +430,7 @@ pub fn destroy_data_device<T: IpcVtable>(dd: &T::Device) {
} }
} }
fn break_source_loops<T: IpcVtable>(src: &T::Source) { fn break_source_loops<T: TransferVtable>(src: &T::Source) {
let data = src.source_data(); let data = src.source_data();
let mut remove = SmallVec::<[DataOfferId; 1]>::new(); let mut remove = SmallVec::<[DataOfferId; 1]>::new();
for (id, offer) in &data.offers { for (id, offer) in &data.offers {
@ -444,20 +444,20 @@ fn break_source_loops<T: IpcVtable>(src: &T::Source) {
destroy_data_source::<T>(src); destroy_data_source::<T>(src);
} }
fn break_offer_loops<T: IpcVtable>(offer: &T::Offer) { fn break_offer_loops<T: TransferVtable>(offer: &T::Offer) {
let data = offer.offer_data(); let data = offer.offer_data();
data.device.set(None); data.device.set(None);
destroy_data_offer::<T>(offer); destroy_data_offer::<T>(offer);
} }
fn break_device_loops<T: IpcVtable>(dd: &T::Device) { fn break_device_loops<T: TransferVtable>(dd: &T::Device) {
let data = T::get_device_data(dd); let data = T::get_device_data(dd);
data.selection.take(); data.selection.take();
data.dnd.take(); data.dnd.take();
destroy_data_device::<T>(dd); destroy_data_device::<T>(dd);
} }
pub fn receive_data_offer<T: IpcVtable>(offer: &T::Offer, mime_type: &str, fd: Rc<OwnedFd>) { pub fn receive_data_offer<T: TransferVtable>(offer: &T::Offer, mime_type: &str, fd: Rc<OwnedFd>) {
let data = offer.offer_data(); let data = offer.offer_data();
if let Some(src) = data.source.get() { if let Some(src) = data.source.get() {
src.send_send(mime_type, fd); src.send_send(mime_type, fd);

View file

@ -1,5 +1,5 @@
use { use {
crate::ifs::data_transfer::{DynDataSource, IpcLocation}, crate::ifs::data_transfer::{DynDataSource, TransferLocation},
std::rc::Rc, std::rc::Rc,
}; };
@ -20,7 +20,7 @@ pub trait DynDataControlDevice {
fn handle_new_source( fn handle_new_source(
self: Rc<Self>, self: Rc<Self>,
location: IpcLocation, location: TransferLocation,
source: Option<Rc<dyn DynDataSource>>, source: Option<Rc<dyn DynDataSource>>,
); );
} }

View file

@ -3,7 +3,7 @@ use {
client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError}, client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError},
globals::{Global, GlobalName}, globals::{Global, GlobalName},
ifs::data_transfer::{ ifs::data_transfer::{
IpcLocation, TransferLocation,
data_control::{ data_control::{
DynDataControlDevice, ext_data_control_device_v1::ExtDataControlDeviceV1, DynDataControlDevice, ext_data_control_device_v1::ExtDataControlDeviceV1,
ext_data_control_source_v1::ExtDataControlSourceV1, ext_data_control_source_v1::ExtDataControlSourceV1,
@ -81,9 +81,9 @@ impl ExtDataControlManagerV1RequestHandler for ExtDataControlManagerV1 {
seat.global.add_data_control_device(dev.clone()); seat.global.add_data_control_device(dev.clone());
self.client.add_client_obj(&dev)?; self.client.add_client_obj(&dev)?;
dev.clone() 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( dev.clone().handle_new_source(
IpcLocation::PrimarySelection, TransferLocation::PrimarySelection,
seat.global.get_primary_selection(), seat.global.get_primary_selection(),
); );
Ok(()) Ok(())

View file

@ -2,7 +2,7 @@ use {
crate::{ crate::{
client::Client, client::Client,
ifs::data_transfer::{ ifs::data_transfer::{
IpcLocation, SourceData, TransferLocation, SourceData,
data_control::{ data_control::{
ext_data_control_device_v1::ExtDataControlIpc, ext_data_control_device_v1::ExtDataControlIpc,
private::{ private::{
@ -49,7 +49,7 @@ impl ExtDataControlSourceV1 {
data: DataControlSourceData { data: DataControlSourceData {
data: SourceData::new(client), data: SourceData::new(client),
version, version,
location: Cell::new(IpcLocation::Clipboard), location: Cell::new(TransferLocation::Clipboard),
used: Cell::new(false), used: Cell::new(false),
}, },
tracker: Default::default(), tracker: Default::default(),

View file

@ -4,10 +4,10 @@ use {
ifs::{ ifs::{
data_transfer::{ data_transfer::{
DataOffer, DataOfferId, DataSource, DeviceData, DynDataOffer, DynDataSource, 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}, data_control::{DataControlDeviceId, DynDataControlDevice},
detach_seat, offer_source_to_data_control_device, offer_source_to_x, 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, wl_seat::WlSeatGlobal,
}, },
@ -64,7 +64,7 @@ pub struct DataControlOfferData<T: DataControlIpc> {
pub client: Rc<Client>, pub client: Rc<Client>,
pub device: Rc<T::Device>, pub device: Rc<T::Device>,
pub data: OfferData<T::Device>, pub data: OfferData<T::Device>,
pub location: IpcLocation, pub location: TransferLocation,
} }
pub trait DataControlOffer: WaylandObject { pub trait DataControlOffer: WaylandObject {
@ -78,7 +78,7 @@ pub trait DataControlOffer: WaylandObject {
pub struct DataControlSourceData { pub struct DataControlSourceData {
pub data: SourceData, pub data: SourceData,
pub version: Version, pub version: Version,
pub location: Cell<IpcLocation>, pub location: Cell<TransferLocation>,
pub used: Cell<bool>, pub used: Cell<bool>,
} }
@ -99,22 +99,22 @@ impl<T: DataControlDevice> DynDataControlDevice for T {
fn handle_new_source( fn handle_new_source(
self: Rc<Self>, self: Rc<Self>,
location: IpcLocation, location: TransferLocation,
source: Option<Rc<dyn DynDataSource>>, source: Option<Rc<dyn DynDataSource>>,
) { ) {
if location == IpcLocation::PrimarySelection if location == TransferLocation::PrimarySelection
&& self.data().version < T::Ipc::PRIMARY_SELECTION_SINCE && self.data().version < T::Ipc::PRIMARY_SELECTION_SINCE
{ {
return; return;
} }
match location { match location {
IpcLocation::Clipboard => match source { TransferLocation::Clipboard => match source {
Some(src) => { Some(src) => {
offer_source_to_data_control_device::<Clipboard<T::Ipc>>(src, &self); offer_source_to_data_control_device::<Clipboard<T::Ipc>>(src, &self);
} }
_ => self.send_selection(None), _ => self.send_selection(None),
}, },
IpcLocation::PrimarySelection => match source { TransferLocation::PrimarySelection => match source {
Some(src) => { Some(src) => {
offer_source_to_data_control_device::<PrimarySelection<T::Ipc>>(src, &self); offer_source_to_data_control_device::<PrimarySelection<T::Ipc>>(src, &self);
} }
@ -129,7 +129,7 @@ type PrimarySelection<T> = DataControlIpcImpl<PrimarySelectionCore<T>>;
pub trait DataControlLocationIpc { pub trait DataControlLocationIpc {
type Ipc: DataControlIpc; type Ipc: DataControlIpc;
const LOCATION: IpcLocation; const LOCATION: TransferLocation;
fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>>; fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>>;
@ -140,7 +140,7 @@ pub trait DataControlLocationIpc {
impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> { impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> {
type Ipc = T; type Ipc = T;
const LOCATION: IpcLocation = IpcLocation::Clipboard; const LOCATION: TransferLocation = TransferLocation::Clipboard;
fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>> { fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>> {
&dd.data().clipboard_data &dd.data().clipboard_data
@ -157,7 +157,7 @@ impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> {
impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<T> { impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<T> {
type Ipc = T; type Ipc = T;
const LOCATION: IpcLocation = IpcLocation::PrimarySelection; const LOCATION: TransferLocation = TransferLocation::PrimarySelection;
fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>> { fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>> {
&dd.data().primary_selection_data &dd.data().primary_selection_data
@ -172,7 +172,7 @@ impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<T> {
} }
} }
impl<T: DataControlLocationIpc> IpcVtable for DataControlIpcImpl<T> { impl<T: DataControlLocationIpc> TransferVtable for DataControlIpcImpl<T> {
type Device = Device<T::Ipc>; type Device = Device<T::Ipc>;
type Source = Source<T::Ipc>; type Source = Source<T::Ipc>;
type Offer = Offer<T::Ipc>; type Offer = Offer<T::Ipc>;
@ -234,10 +234,10 @@ impl<T: DataControlSource> DynDataSource for T {
self.send_send(mime_type, fd); self.send_send(mime_type, fd);
} }
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) { fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>) {
match self.data().location.get() { match self.data().location.get() {
IpcLocation::Clipboard => offer_source_to_x::<XClipboardIpc>(self, dd), TransferLocation::Clipboard => offer_source_to_x::<XClipboardTransfer>(self, dd),
IpcLocation::PrimarySelection => offer_source_to_x::<XPrimarySelectionIpc>(self, dd), TransferLocation::PrimarySelection => offer_source_to_x::<XPrimarySelectionTransfer>(self, dd),
} }
} }
@ -273,8 +273,8 @@ impl<T: DataControlOffer> DynDataOffer for T {
fn cancel(&self) { fn cancel(&self) {
match self.data().location { match self.data().location {
IpcLocation::Clipboard => cancel_offer::<Clipboard<T::Ipc>>(self), TransferLocation::Clipboard => cancel_offer::<Clipboard<T::Ipc>>(self),
IpcLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Ipc>>(self), TransferLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Ipc>>(self),
} }
} }
@ -293,7 +293,7 @@ pub mod logic {
client::ClientError, client::ClientError,
ifs::{ ifs::{
data_transfer::{ 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, break_source_loops,
data_control::private::{ data_control::private::{
Clipboard, DataControlDevice, DataControlOffer, DataControlSource, Clipboard, DataControlDevice, DataControlOffer, DataControlSource,
@ -319,7 +319,7 @@ pub mod logic {
fn use_source<D: DataControlDevice>( fn use_source<D: DataControlDevice>(
device: &D, device: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Ipc>>,
location: IpcLocation, location: TransferLocation,
) -> Result<Option<Rc<Source<D::Ipc>>>, DataControlError> { ) -> Result<Option<Rc<Source<D::Ipc>>>, DataControlError> {
if let Some(source) = source { if let Some(source) = source {
let src = device.data().client.lookup(source)?; let src = device.data().client.lookup(source)?;
@ -337,7 +337,7 @@ pub mod logic {
d: &D, d: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Ipc>>,
) -> Result<(), DataControlError> { ) -> Result<(), DataControlError> {
let src = use_source(d, source, IpcLocation::Clipboard)?; let src = use_source(d, source, TransferLocation::Clipboard)?;
d.data().seat.set_selection(src)?; d.data().seat.set_selection(src)?;
Ok(()) Ok(())
} }
@ -354,7 +354,7 @@ pub mod logic {
d: &D, d: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Ipc>>,
) -> Result<(), DataControlError> { ) -> 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)?; d.data().seat.set_primary_selection(src)?;
Ok(()) Ok(())
} }
@ -372,8 +372,8 @@ pub mod logic {
pub fn data_source_destroy<S: DataControlSource>(s: &S) -> Result<(), DataControlError> { pub fn data_source_destroy<S: DataControlSource>(s: &S) -> Result<(), DataControlError> {
match s.data().location.get() { match s.data().location.get() {
IpcLocation::Clipboard => destroy_data_source::<Clipboard<S::Ipc>>(s), TransferLocation::Clipboard => destroy_data_source::<Clipboard<S::Ipc>>(s),
IpcLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Ipc>>(s), TransferLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Ipc>>(s),
} }
s.data().data.client.remove_obj(s)?; s.data().data.client.remove_obj(s)?;
Ok(()) Ok(())
@ -381,15 +381,15 @@ pub mod logic {
pub fn data_source_break_loops<S: DataControlSource>(s: &S) { pub fn data_source_break_loops<S: DataControlSource>(s: &S) {
match s.data().location.get() { match s.data().location.get() {
IpcLocation::Clipboard => break_source_loops::<Clipboard<S::Ipc>>(s), TransferLocation::Clipboard => break_source_loops::<Clipboard<S::Ipc>>(s),
IpcLocation::PrimarySelection => break_source_loops::<PrimarySelection<S::Ipc>>(s), TransferLocation::PrimarySelection => break_source_loops::<PrimarySelection<S::Ipc>>(s),
} }
} }
pub fn data_offer_receive<O: DataControlOffer>(o: &O, mime_type: &str, fd: Rc<OwnedFd>) { pub fn data_offer_receive<O: DataControlOffer>(o: &O, mime_type: &str, fd: Rc<OwnedFd>) {
match o.data().location { match o.data().location {
IpcLocation::Clipboard => receive_data_offer::<Clipboard<O::Ipc>>(o, mime_type, fd), TransferLocation::Clipboard => receive_data_offer::<Clipboard<O::Ipc>>(o, mime_type, fd),
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
receive_data_offer::<PrimarySelection<O::Ipc>>(o, mime_type, fd) receive_data_offer::<PrimarySelection<O::Ipc>>(o, mime_type, fd)
} }
} }
@ -397,8 +397,8 @@ pub mod logic {
pub fn data_offer_destroy<O: DataControlOffer>(o: &O) -> Result<(), DataControlError> { pub fn data_offer_destroy<O: DataControlOffer>(o: &O) -> Result<(), DataControlError> {
match o.data().location { match o.data().location {
IpcLocation::Clipboard => destroy_data_offer::<Clipboard<O::Ipc>>(o), TransferLocation::Clipboard => destroy_data_offer::<Clipboard<O::Ipc>>(o),
IpcLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Ipc>>(o), TransferLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Ipc>>(o),
} }
o.data().client.remove_obj(o)?; o.data().client.remove_obj(o)?;
Ok(()) Ok(())
@ -406,8 +406,8 @@ pub mod logic {
pub fn data_offer_break_loops<O: DataControlOffer>(o: &O) { pub fn data_offer_break_loops<O: DataControlOffer>(o: &O) {
match o.data().location { match o.data().location {
IpcLocation::Clipboard => break_offer_loops::<Clipboard<O::Ipc>>(o), TransferLocation::Clipboard => break_offer_loops::<Clipboard<O::Ipc>>(o),
IpcLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Ipc>>(o), TransferLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Ipc>>(o),
} }
} }

View file

@ -3,7 +3,7 @@ use {
client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError}, client::{CAP_DATA_CONTROL_MANAGER, Client, ClientCaps, ClientError},
globals::{Global, GlobalName}, globals::{Global, GlobalName},
ifs::data_transfer::{ ifs::data_transfer::{
IpcLocation, TransferLocation,
data_control::{ data_control::{
DynDataControlDevice, zwlr_data_control_device_v1::ZwlrDataControlDeviceV1, DynDataControlDevice, zwlr_data_control_device_v1::ZwlrDataControlDeviceV1,
zwlr_data_control_source_v1::ZwlrDataControlSourceV1, zwlr_data_control_source_v1::ZwlrDataControlSourceV1,
@ -81,9 +81,9 @@ impl ZwlrDataControlManagerV1RequestHandler for ZwlrDataControlManagerV1 {
seat.global.add_data_control_device(dev.clone()); seat.global.add_data_control_device(dev.clone());
self.client.add_client_obj(&dev)?; self.client.add_client_obj(&dev)?;
dev.clone() 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( dev.clone().handle_new_source(
IpcLocation::PrimarySelection, TransferLocation::PrimarySelection,
seat.global.get_primary_selection(), seat.global.get_primary_selection(),
); );
Ok(()) Ok(())

View file

@ -2,7 +2,7 @@ use {
crate::{ crate::{
client::Client, client::Client,
ifs::data_transfer::{ ifs::data_transfer::{
IpcLocation, SourceData, TransferLocation, SourceData,
data_control::{ data_control::{
private::{ private::{
DataControlSource, DataControlSourceData, DataControlSource, DataControlSourceData,
@ -49,7 +49,7 @@ impl ZwlrDataControlSourceV1 {
data: DataControlSourceData { data: DataControlSourceData {
data: SourceData::new(client), data: SourceData::new(client),
version, version,
location: Cell::new(IpcLocation::Clipboard), location: Cell::new(TransferLocation::Clipboard),
used: Cell::new(false), used: Cell::new(false),
}, },
tracker: Default::default(), tracker: Default::default(),

View file

@ -4,7 +4,7 @@ use {
fixed::Fixed, fixed::Fixed,
ifs::{ ifs::{
data_transfer::{ 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, destroy_data_device, wl_data_offer::WlDataOffer, wl_data_source::WlDataSource,
}, },
wl_seat::{WlSeatError, WlSeatGlobal}, wl_seat::{WlSeatError, WlSeatGlobal},
@ -141,16 +141,16 @@ impl WlDataDeviceRequestHandler for WlDataDevice {
} }
fn release(&self, _req: Release, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn release(&self, _req: Release, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_device::<ClipboardIpc>(self); destroy_data_device::<ClipboardTransfer>(self);
self.seat.remove_data_device(self); self.seat.remove_data_device(self);
self.client.remove_obj(self)?; self.client.remove_obj(self)?;
Ok(()) Ok(())
} }
} }
pub struct ClipboardIpc; pub struct ClipboardTransfer;
impl IterableIpcVtable for ClipboardIpc { impl IterableTransferVtable for ClipboardTransfer {
fn for_each_device<C>(seat: &WlSeatGlobal, client: ClientId, f: C) fn for_each_device<C>(seat: &WlSeatGlobal, client: ClientId, f: C)
where where
C: FnMut(&Rc<Self::Device>), C: FnMut(&Rc<Self::Device>),
@ -159,7 +159,7 @@ impl IterableIpcVtable for ClipboardIpc {
} }
} }
impl IpcVtable for ClipboardIpc { impl TransferVtable for ClipboardTransfer {
type Device = WlDataDevice; type Device = WlDataDevice;
type Source = WlDataSource; type Source = WlDataSource;
type Offer = WlDataOffer; type Offer = WlDataOffer;
@ -216,7 +216,7 @@ object_base! {
impl Object for WlDataDevice { impl Object for WlDataDevice {
fn break_loops(&self) { fn break_loops(&self) {
break_device_loops::<ClipboardIpc>(self); break_device_loops::<ClipboardTransfer>(self);
self.seat.remove_data_device(self); self.seat.remove_data_device(self);
} }
} }

View file

@ -7,7 +7,7 @@ use {
DataOffer, DataOfferId, DynDataOffer, OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED, DataOffer, DataOfferId, DynDataOffer, OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED,
OFFER_STATE_FINISHED, OfferData, Role, SOURCE_STATE_FINISHED, break_offer_loops, OFFER_STATE_FINISHED, OfferData, Role, SOURCE_STATE_FINISHED, break_offer_loops,
cancel_offer, destroy_data_offer, receive_data_offer, 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_data_device_manager::DND_ALL,
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
@ -65,7 +65,7 @@ impl DynDataOffer for WlDataOffer {
} }
fn cancel(&self) { fn cancel(&self) {
cancel_offer::<ClipboardIpc>(self); cancel_offer::<ClipboardTransfer>(self);
} }
fn send_enter(&self, surface: WlSurfaceId, x: Fixed, y: Fixed, serial: u64) { 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) { if self.data.shared.state.get().contains(OFFER_STATE_FINISHED) {
return Err(WlDataOfferError::AlreadyFinished); return Err(WlDataOfferError::AlreadyFinished);
} }
receive_data_offer::<ClipboardIpc>(self, req.mime_type, req.fd); receive_data_offer::<ClipboardTransfer>(self, req.mime_type, req.fd);
Ok(()) Ok(())
} }
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_offer::<ClipboardIpc>(self); destroy_data_offer::<ClipboardTransfer>(self);
self.client.remove_obj(self)?; self.client.remove_obj(self)?;
Ok(()) Ok(())
} }
@ -198,7 +198,7 @@ object_base! {
impl Object for WlDataOffer { impl Object for WlDataOffer {
fn break_loops(&self) { fn break_loops(&self) {
break_offer_loops::<ClipboardIpc>(self); break_offer_loops::<ClipboardTransfer>(self);
} }
} }

View file

@ -7,9 +7,9 @@ use {
SOURCE_STATE_CANCELLED, SOURCE_STATE_DROPPED, SharedState, SourceData, SOURCE_STATE_CANCELLED, SOURCE_STATE_DROPPED, SharedState, SourceData,
add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source, add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source,
detach_seat, offer_source_to_x, detach_seat, offer_source_to_x,
wl_data_device::ClipboardIpc, wl_data_device::ClipboardTransfer,
wl_data_device_manager::{DND_ALL, DND_NONE}, wl_data_device_manager::{DND_ALL, DND_NONE},
x_data_device::{XClipboardIpc, XIpcDevice}, x_data_device::{XClipboardTransfer, XTransferDevice},
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
xdg_toplevel_drag_v1::XdgToplevelDragV1, xdg_toplevel_drag_v1::XdgToplevelDragV1,
@ -52,8 +52,8 @@ impl DynDataSource for WlDataSource {
WlDataSource::send_send(self, mime_type, fd); WlDataSource::send_send(self, mime_type, fd);
} }
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) { fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>) {
offer_source_to_x::<XClipboardIpc>(self, dd); offer_source_to_x::<XClipboardTransfer>(self, dd);
} }
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) { fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
@ -201,12 +201,12 @@ impl WlDataSourceRequestHandler for WlDataSource {
type Error = WlDataSourceError; type Error = WlDataSourceError;
fn offer(&self, req: Offer, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn offer(&self, req: Offer, _slf: &Rc<Self>) -> Result<(), Self::Error> {
add_data_source_mime_type::<ClipboardIpc>(self, req.mime_type); add_data_source_mime_type::<ClipboardTransfer>(self, req.mime_type);
Ok(()) Ok(())
} }
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_source::<ClipboardIpc>(self); destroy_data_source::<ClipboardTransfer>(self);
self.data.client.remove_obj(self)?; self.data.client.remove_obj(self)?;
Ok(()) Ok(())
} }
@ -230,7 +230,7 @@ object_base! {
impl Object for WlDataSource { impl Object for WlDataSource {
fn break_loops(&self) { fn break_loops(&self) {
break_source_loops::<ClipboardIpc>(self); break_source_loops::<ClipboardTransfer>(self);
self.toplevel_drag.take(); self.toplevel_drag.take();
} }
} }

View file

@ -3,7 +3,7 @@ use {
client::{Client, ClientError}, client::{Client, ClientError},
ifs::{ ifs::{
data_transfer::{ data_transfer::{
DeviceData, IpcLocation, IpcVtable, OfferData, Role, x_data_offer::XDataOffer, DeviceData, TransferLocation, TransferVtable, OfferData, Role, x_data_offer::XDataOffer,
x_data_source::XDataSource, x_data_source::XDataSource,
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
@ -11,14 +11,14 @@ use {
state::State, state::State,
xwayland::XWaylandEvent, xwayland::XWaylandEvent,
}, },
XWaylandEvent::IpcSetOffer, XWaylandEvent::DataTransferSetOffer,
std::rc::Rc, std::rc::Rc,
}; };
linear_ids!(XIpcDeviceIds, XIpcDeviceId, u64); linear_ids!(XTransferDeviceIds, XTransferDeviceId, u64);
pub struct XIpcDevice { pub struct XTransferDevice {
pub id: XIpcDeviceId, pub id: XTransferDeviceId,
pub clipboard: DeviceData<XDataOffer>, pub clipboard: DeviceData<XDataOffer>,
pub primary_selection: DeviceData<XDataOffer>, pub primary_selection: DeviceData<XDataOffer>,
pub seat: Rc<WlSeatGlobal>, pub seat: Rc<WlSeatGlobal>,
@ -27,45 +27,45 @@ pub struct XIpcDevice {
} }
#[derive(Default)] #[derive(Default)]
pub struct XClipboardIpc; pub struct XClipboardTransfer;
#[derive(Default)] #[derive(Default)]
pub struct XPrimarySelectionIpc; pub struct XPrimarySelectionTransfer;
pub trait XIpc { pub trait XTransfer {
const LOCATION: IpcLocation; const LOCATION: TransferLocation;
fn x_unset(seat: &Rc<WlSeatGlobal>); fn x_unset(seat: &Rc<WlSeatGlobal>);
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer>; fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer>;
} }
impl XIpc for XClipboardIpc { impl XTransfer for XClipboardTransfer {
const LOCATION: IpcLocation = IpcLocation::Clipboard; const LOCATION: TransferLocation = TransferLocation::Clipboard;
fn x_unset(seat: &Rc<WlSeatGlobal>) { fn x_unset(seat: &Rc<WlSeatGlobal>) {
seat.unset_selection(); seat.unset_selection();
} }
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer> { fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer> {
&dd.clipboard &dd.clipboard
} }
} }
impl XIpc for XPrimarySelectionIpc { impl XTransfer for XPrimarySelectionTransfer {
const LOCATION: IpcLocation = IpcLocation::PrimarySelection; const LOCATION: TransferLocation = TransferLocation::PrimarySelection;
fn x_unset(seat: &Rc<WlSeatGlobal>) { fn x_unset(seat: &Rc<WlSeatGlobal>) {
seat.unset_primary_selection(); seat.unset_primary_selection();
} }
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer> { fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer> {
&dd.primary_selection &dd.primary_selection
} }
} }
impl<T: XIpc> IpcVtable for T { impl<T: XTransfer> TransferVtable for T {
type Device = XIpcDevice; type Device = XTransferDevice;
type Source = XDataSource; type Source = XDataSource;
type Offer = XDataOffer; type Offer = XDataOffer;
@ -97,7 +97,7 @@ impl<T: XIpc> IpcVtable for T {
dd.state dd.state
.xwayland .xwayland
.queue .queue
.push(XWaylandEvent::IpcSetSelection { .push(XWaylandEvent::DataTransferSetSelection {
seat: dd.seat.id(), seat: dd.seat.id(),
location: T::LOCATION, location: T::LOCATION,
offer: offer.cloned(), offer: offer.cloned(),
@ -105,7 +105,7 @@ impl<T: XIpc> IpcVtable for T {
} }
fn send_offer(dd: &Self::Device, offer: &Rc<Self::Offer>) { fn send_offer(dd: &Self::Device, offer: &Rc<Self::Offer>) {
dd.state.xwayland.queue.push(IpcSetOffer { dd.state.xwayland.queue.push(DataTransferSetOffer {
location: T::LOCATION, location: T::LOCATION,
seat: dd.seat.id(), seat: dd.seat.id(),
offer: offer.clone(), offer: offer.clone(),

View file

@ -3,28 +3,28 @@ use {
client::ClientId, client::ClientId,
ifs::{ ifs::{
data_transfer::{ data_transfer::{
DataOffer, DataOfferId, DynDataOffer, IpcLocation, OfferData, cancel_offer, DataOffer, DataOfferId, DynDataOffer, TransferLocation, OfferData, cancel_offer,
x_data_device::{XClipboardIpc, XIpcDevice, XPrimarySelectionIpc}, x_data_device::{XClipboardTransfer, XTransferDevice, XPrimarySelectionTransfer},
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
}, },
leaks::Tracker, leaks::Tracker,
xwayland::XWaylandEvent, xwayland::XWaylandEvent,
}, },
XWaylandEvent::IpcAddOfferMimeType, XWaylandEvent::DataTransferAddOfferMimeType,
std::rc::Rc, std::rc::Rc,
}; };
pub struct XDataOffer { pub struct XDataOffer {
pub offer_id: DataOfferId, pub offer_id: DataOfferId,
pub device: Rc<XIpcDevice>, pub device: Rc<XTransferDevice>,
pub data: OfferData<XIpcDevice>, pub data: OfferData<XTransferDevice>,
pub tracker: Tracker<Self>, pub tracker: Tracker<Self>,
pub location: IpcLocation, pub location: TransferLocation,
} }
impl DataOffer for XDataOffer { impl DataOffer for XDataOffer {
type Device = XIpcDevice; type Device = XTransferDevice;
fn offer_data(&self) -> &OfferData<Self::Device> { fn offer_data(&self) -> &OfferData<Self::Device> {
&self.data &self.data
@ -41,7 +41,7 @@ impl DynDataOffer for XDataOffer {
} }
fn send_offer(&self, mime_type: &str) { fn send_offer(&self, mime_type: &str) {
self.device.state.xwayland.queue.push(IpcAddOfferMimeType { self.device.state.xwayland.queue.push(DataTransferAddOfferMimeType {
location: self.location, location: self.location,
seat: self.device.seat.id(), seat: self.device.seat.id(),
offer: self.offer_id, offer: self.offer_id,
@ -51,8 +51,8 @@ impl DynDataOffer for XDataOffer {
fn cancel(&self) { fn cancel(&self) {
match self.location { match self.location {
IpcLocation::Clipboard => cancel_offer::<XClipboardIpc>(self), TransferLocation::Clipboard => cancel_offer::<XClipboardTransfer>(self),
IpcLocation::PrimarySelection => cancel_offer::<XPrimarySelectionIpc>(self), TransferLocation::PrimarySelection => cancel_offer::<XPrimarySelectionTransfer>(self),
} }
} }

View file

@ -2,13 +2,13 @@ use {
crate::{ crate::{
ifs::{ ifs::{
data_transfer::{ data_transfer::{
DataSource, DynDataSource, IpcLocation, SourceData, cancel_offers, detach_seat, DataSource, DynDataSource, TransferLocation, SourceData, cancel_offers, detach_seat,
x_data_device::XIpcDevice, x_data_device::XTransferDevice,
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
}, },
state::State, state::State,
xwayland::XWaylandEvent::{IpcCancelSource, IpcSendSource, IpcSetSelection}, xwayland::XWaylandEvent::{DataTransferCancelSource, DataTransferSendSource, DataTransferSetSelection},
}, },
std::rc::Rc, std::rc::Rc,
uapi::OwnedFd, uapi::OwnedFd,
@ -16,14 +16,14 @@ use {
pub struct XDataSource { pub struct XDataSource {
pub state: Rc<State>, pub state: Rc<State>,
pub device: Rc<XIpcDevice>, pub device: Rc<XTransferDevice>,
pub data: SourceData, pub data: SourceData,
pub location: IpcLocation, pub location: TransferLocation,
} }
impl DataSource for XDataSource { impl DataSource for XDataSource {
fn send_cancelled(&self, seat: &Rc<WlSeatGlobal>) { fn send_cancelled(&self, seat: &Rc<WlSeatGlobal>) {
self.state.xwayland.queue.push(IpcCancelSource { self.state.xwayland.queue.push(DataTransferCancelSource {
location: self.location, location: self.location,
seat: seat.id(), seat: seat.id(),
source: self.data.id, source: self.data.id,
@ -37,7 +37,7 @@ impl DynDataSource for XDataSource {
} }
fn send_send(&self, mime_type: &str, fd: Rc<OwnedFd>) { fn send_send(&self, mime_type: &str, fd: Rc<OwnedFd>) {
self.state.xwayland.queue.push(IpcSendSource { self.state.xwayland.queue.push(DataTransferSendSource {
location: self.location, location: self.location,
seat: self.device.seat.id(), seat: self.device.seat.id(),
source: self.data.id, source: self.data.id,
@ -46,9 +46,9 @@ impl DynDataSource for XDataSource {
}); });
} }
fn offer_to_x(self: Rc<Self>, _dd: &Rc<XIpcDevice>) { fn offer_to_x(self: Rc<Self>, _dd: &Rc<XTransferDevice>) {
self.cancel_unprivileged_offers(); self.cancel_unprivileged_offers();
self.state.xwayland.queue.push(IpcSetSelection { self.state.xwayland.queue.push(DataTransferSetSelection {
location: self.location, location: self.location,
seat: self.device.seat.id(), seat: self.device.seat.id(),
offer: None, offer: None,

View file

@ -3,7 +3,7 @@ use {
client::{Client, ClientError, ClientId}, client::{Client, ClientError, ClientId},
ifs::{ ifs::{
data_transfer::{ 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, destroy_data_device, zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1,
zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
}, },
@ -89,16 +89,16 @@ impl ZwpPrimarySelectionDeviceV1RequestHandler for ZwpPrimarySelectionDeviceV1 {
} }
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_device::<PrimarySelectionIpc>(self); destroy_data_device::<PrimarySelectionTransfer>(self);
self.seat.remove_primary_selection_device(self); self.seat.remove_primary_selection_device(self);
self.client.remove_obj(self)?; self.client.remove_obj(self)?;
Ok(()) Ok(())
} }
} }
pub struct PrimarySelectionIpc; pub struct PrimarySelectionTransfer;
impl IterableIpcVtable for PrimarySelectionIpc { impl IterableTransferVtable for PrimarySelectionTransfer {
fn for_each_device<C>(seat: &WlSeatGlobal, client: ClientId, f: C) fn for_each_device<C>(seat: &WlSeatGlobal, client: ClientId, f: C)
where where
C: FnMut(&Rc<Self::Device>), C: FnMut(&Rc<Self::Device>),
@ -107,7 +107,7 @@ impl IterableIpcVtable for PrimarySelectionIpc {
} }
} }
impl IpcVtable for PrimarySelectionIpc { impl TransferVtable for PrimarySelectionTransfer {
type Device = ZwpPrimarySelectionDeviceV1; type Device = ZwpPrimarySelectionDeviceV1;
type Source = ZwpPrimarySelectionSourceV1; type Source = ZwpPrimarySelectionSourceV1;
type Offer = ZwpPrimarySelectionOfferV1; type Offer = ZwpPrimarySelectionOfferV1;
@ -162,7 +162,7 @@ object_base! {
impl Object for ZwpPrimarySelectionDeviceV1 { impl Object for ZwpPrimarySelectionDeviceV1 {
fn break_loops(&self) { fn break_loops(&self) {
break_device_loops::<PrimarySelectionIpc>(self); break_device_loops::<PrimarySelectionTransfer>(self);
self.seat.remove_primary_selection_device(self); self.seat.remove_primary_selection_device(self);
} }
} }

View file

@ -6,7 +6,7 @@ use {
DataOffer, DataOfferId, DynDataOffer, OfferData, break_offer_loops, cancel_offer, DataOffer, DataOfferId, DynDataOffer, OfferData, break_offer_loops, cancel_offer,
destroy_data_offer, receive_data_offer, destroy_data_offer, receive_data_offer,
zwp_primary_selection_device_v1::{ zwp_primary_selection_device_v1::{
PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1,
}, },
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
@ -51,7 +51,7 @@ impl DynDataOffer for ZwpPrimarySelectionOfferV1 {
} }
fn cancel(&self) { fn cancel(&self) {
cancel_offer::<PrimarySelectionIpc>(self); cancel_offer::<PrimarySelectionTransfer>(self);
} }
fn get_seat(&self) -> Rc<WlSeatGlobal> { fn get_seat(&self) -> Rc<WlSeatGlobal> {
@ -72,12 +72,12 @@ impl ZwpPrimarySelectionOfferV1RequestHandler for ZwpPrimarySelectionOfferV1 {
type Error = ZwpPrimarySelectionOfferV1Error; type Error = ZwpPrimarySelectionOfferV1Error;
fn receive(&self, req: Receive, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn receive(&self, req: Receive, _slf: &Rc<Self>) -> Result<(), Self::Error> {
receive_data_offer::<PrimarySelectionIpc>(self, req.mime_type, req.fd); receive_data_offer::<PrimarySelectionTransfer>(self, req.mime_type, req.fd);
Ok(()) Ok(())
} }
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_offer::<PrimarySelectionIpc>(self); destroy_data_offer::<PrimarySelectionTransfer>(self);
self.client.remove_obj(self)?; self.client.remove_obj(self)?;
Ok(()) Ok(())
} }
@ -90,7 +90,7 @@ object_base! {
impl Object for ZwpPrimarySelectionOfferV1 { impl Object for ZwpPrimarySelectionOfferV1 {
fn break_loops(&self) { fn break_loops(&self) {
break_offer_loops::<PrimarySelectionIpc>(self); break_offer_loops::<PrimarySelectionTransfer>(self);
} }
} }

View file

@ -6,8 +6,8 @@ use {
DataSource, DynDataSource, SourceData, add_data_source_mime_type, DataSource, DynDataSource, SourceData, add_data_source_mime_type,
break_source_loops, cancel_offers, destroy_data_source, detach_seat, break_source_loops, cancel_offers, destroy_data_source, detach_seat,
offer_source_to_x, offer_source_to_x,
x_data_device::{XIpcDevice, XPrimarySelectionIpc}, x_data_device::{XTransferDevice, XPrimarySelectionTransfer},
zwp_primary_selection_device_v1::PrimarySelectionIpc, zwp_primary_selection_device_v1::PrimarySelectionTransfer,
}, },
wl_seat::WlSeatGlobal, wl_seat::WlSeatGlobal,
}, },
@ -42,8 +42,8 @@ impl DynDataSource for ZwpPrimarySelectionSourceV1 {
ZwpPrimarySelectionSourceV1::send_send(self, mime_type, fd) ZwpPrimarySelectionSourceV1::send_send(self, mime_type, fd)
} }
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) { fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>) {
offer_source_to_x::<XPrimarySelectionIpc>(self, dd); offer_source_to_x::<XPrimarySelectionTransfer>(self, dd);
} }
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) { fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
@ -82,12 +82,12 @@ impl ZwpPrimarySelectionSourceV1RequestHandler for ZwpPrimarySelectionSourceV1 {
type Error = ZwpPrimarySelectionSourceV1Error; type Error = ZwpPrimarySelectionSourceV1Error;
fn offer(&self, req: Offer, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn offer(&self, req: Offer, _slf: &Rc<Self>) -> Result<(), Self::Error> {
add_data_source_mime_type::<PrimarySelectionIpc>(self, req.mime_type); add_data_source_mime_type::<PrimarySelectionTransfer>(self, req.mime_type);
Ok(()) Ok(())
} }
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> { fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
destroy_data_source::<PrimarySelectionIpc>(self); destroy_data_source::<PrimarySelectionTransfer>(self);
self.data.client.remove_obj(self)?; self.data.client.remove_obj(self)?;
Ok(()) Ok(())
} }
@ -100,7 +100,7 @@ object_base! {
impl Object for ZwpPrimarySelectionSourceV1 { impl Object for ZwpPrimarySelectionSourceV1 {
fn break_loops(&self) { fn break_loops(&self) {
break_source_loops::<PrimarySelectionIpc>(self); break_source_loops::<PrimarySelectionTransfer>(self);
} }
} }

View file

@ -35,14 +35,14 @@ use {
ifs::{ ifs::{
ext_idle_notification_v1::ExtIdleNotificationV1, ext_idle_notification_v1::ExtIdleNotificationV1,
data_transfer::{ data_transfer::{
self, DynDataSource, IpcError, IpcLocation, self, DynDataSource, TransferError, TransferLocation,
data_control::{DataControlDeviceId, DynDataControlDevice}, data_control::{DataControlDeviceId, DynDataControlDevice},
offer_source_to_regular_client, offer_source_to_regular_client,
wl_data_device::{ClipboardIpc, WlDataDevice}, wl_data_device::{ClipboardTransfer, WlDataDevice},
wl_data_source::WlDataSource, wl_data_source::WlDataSource,
x_data_device::{XClipboardIpc, XIpcDevice, XIpcDeviceId, XPrimarySelectionIpc}, x_data_device::{XClipboardTransfer, XTransferDevice, XTransferDeviceId, XPrimarySelectionTransfer},
zwp_primary_selection_device_v1::{ zwp_primary_selection_device_v1::{
PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1,
}, },
zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1, zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
}, },
@ -191,7 +191,7 @@ pub struct WlSeatGlobal {
found_tree: RefCell<Vec<FoundNode>>, found_tree: RefCell<Vec<FoundNode>>,
keyboard_node: CloneCell<Rc<dyn Node>>, keyboard_node: CloneCell<Rc<dyn Node>>,
bindings: RefCell<AHashMap<ClientId, AHashMap<WlSeatId, Rc<WlSeat>>>>, bindings: RefCell<AHashMap<ClientId, AHashMap<WlSeatId, Rc<WlSeat>>>>,
x_data_devices: SmallMap<XIpcDeviceId, Rc<XIpcDevice>, 1>, x_data_devices: SmallMap<XTransferDeviceId, Rc<XTransferDevice>, 1>,
data_devices: RefCell<AHashMap<ClientId, AHashMap<WlDataDeviceId, Rc<WlDataDevice>>>>, data_devices: RefCell<AHashMap<ClientId, AHashMap<WlDataDeviceId, Rc<WlDataDevice>>>>,
primary_selection_devices: RefCell< primary_selection_devices: RefCell<
AHashMap< AHashMap<
@ -474,15 +474,15 @@ impl WlSeatGlobal {
.insert(device.id, device.clone()); .insert(device.id, device.clone());
} }
pub fn set_x_data_device(&self, device: &Rc<XIpcDevice>) { pub fn set_x_data_device(&self, device: &Rc<XTransferDevice>) {
self.x_data_devices.insert(device.id, device.clone()); 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); self.x_data_devices.remove(&id);
} }
pub fn for_each_x_data_device(&self, mut f: impl FnMut(&Rc<XIpcDevice>)) { pub fn for_each_x_data_device(&self, mut f: impl FnMut(&Rc<XTransferDevice>)) {
for (_, dev) in &self.x_data_devices { for (_, dev) in &self.x_data_devices {
f(&dev); f(&dev);
} }
@ -1284,11 +1284,11 @@ impl WlSeatGlobal {
self: &Rc<Self>, self: &Rc<Self>,
field: &CloneCell<Option<Rc<dyn DynDataSource>>>, field: &CloneCell<Option<Rc<dyn DynDataSource>>>,
src: Option<Rc<S>>, src: Option<Rc<S>>,
location: IpcLocation, location: TransferLocation,
) -> Result<(), WlSeatError> ) -> Result<(), WlSeatError>
where where
T: data_transfer::IterableIpcVtable, T: data_transfer::IterableTransferVtable,
X: data_transfer::IpcVtable<Device = XIpcDevice>, X: data_transfer::TransferVtable<Device = XTransferDevice>,
S: DynDataSource, S: DynDataSource,
{ {
if let (Some(new), Some(old)) = (&src, &field.get()) if let (Some(new), Some(old)) = (&src, &field.get())
@ -1319,8 +1319,8 @@ impl WlSeatGlobal {
selection: Option<Rc<dyn DynDataSource>>, selection: Option<Rc<dyn DynDataSource>>,
client: &Rc<Client>, client: &Rc<Client>,
) where ) where
T: data_transfer::IterableIpcVtable, T: data_transfer::IterableTransferVtable,
X: data_transfer::IpcVtable<Device = XIpcDevice>, X: data_transfer::TransferVtable<Device = XTransferDevice>,
{ {
if let Some(src) = &selection { if let Some(src) = &selection {
src.cancel_unprivileged_offers(); src.cancel_unprivileged_offers();
@ -1415,10 +1415,10 @@ impl WlSeatGlobal {
self: &Rc<Self>, self: &Rc<Self>,
selection: Option<Rc<S>>, selection: Option<Rc<S>>,
) -> Result<(), WlSeatError> { ) -> Result<(), WlSeatError> {
self.set_selection_::<ClipboardIpc, XClipboardIpc, _>( self.set_selection_::<ClipboardTransfer, XClipboardTransfer, _>(
&self.selection, &self.selection,
selection, selection,
IpcLocation::Clipboard, TransferLocation::Clipboard,
) )
} }
@ -1462,10 +1462,10 @@ impl WlSeatGlobal {
self: &Rc<Self>, self: &Rc<Self>,
selection: Option<Rc<S>>, selection: Option<Rc<S>>,
) -> Result<(), WlSeatError> { ) -> Result<(), WlSeatError> {
self.set_selection_::<PrimarySelectionIpc, XPrimarySelectionIpc, _>( self.set_selection_::<PrimarySelectionTransfer, XPrimarySelectionTransfer, _>(
&self.primary_selection, &self.primary_selection,
selection, selection,
IpcLocation::PrimarySelection, TransferLocation::PrimarySelection,
) )
} }
@ -1915,7 +1915,7 @@ pub enum WlSeatError {
#[error(transparent)] #[error(transparent)]
ClientError(Box<ClientError>), ClientError(Box<ClientError>),
#[error(transparent)] #[error(transparent)]
IpcError(#[from] IpcError), TransferError(#[from] TransferError),
#[error(transparent)] #[error(transparent)]
WlKeyboardError(Box<WlKeyboardError>), WlKeyboardError(Box<WlKeyboardError>),
#[error("Data source has a toplevel attached")] #[error("Data source has a toplevel attached")]

View file

@ -11,10 +11,10 @@ use {
ifs::{ ifs::{
data_transfer::{ data_transfer::{
offer_source_to_regular_client, offer_source_to_regular_client,
wl_data_device::{ClipboardIpc, WlDataDevice}, wl_data_device::{ClipboardTransfer, WlDataDevice},
x_data_device::{XClipboardIpc, XPrimarySelectionIpc}, x_data_device::{XClipboardTransfer, XPrimarySelectionTransfer},
zwp_primary_selection_device_v1::{ zwp_primary_selection_device_v1::{
PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1, PrimarySelectionTransfer, ZwpPrimarySelectionDeviceV1,
}, },
}, },
wl_seat::{ wl_seat::{
@ -1611,11 +1611,11 @@ impl WlSeatGlobal {
}); });
if self.keyboard_node.get().node_client_id() != Some(surface.client.id) { if self.keyboard_node.get().node_client_id() != Some(surface.client.id) {
self.offer_selection_to_client::<ClipboardIpc, XClipboardIpc>( self.offer_selection_to_client::<ClipboardTransfer, XClipboardTransfer>(
self.selection.get(), self.selection.get(),
&surface.client, &surface.client,
); );
self.offer_selection_to_client::<PrimarySelectionIpc, XPrimarySelectionIpc>( self.offer_selection_to_client::<PrimarySelectionTransfer, XPrimarySelectionTransfer>(
self.primary_selection.get(), self.primary_selection.get(),
&surface.client, &surface.client,
); );
@ -1739,7 +1739,7 @@ impl WlSeatGlobal {
) { ) {
if let Some(src) = &dnd.src { if let Some(src) = &dnd.src {
if !surface.client.is_xwayland { if !surface.client.is_xwayland {
offer_source_to_regular_client::<ClipboardIpc>(src.clone(), &surface.client); offer_source_to_regular_client::<ClipboardTransfer>(src.clone(), &surface.client);
} }
src.for_each_data_offer(|offer| { src.for_each_data_offer(|offer| {
offer.send_enter(surface.id, x, y, serial); offer.send_enter(surface.id, x, y, serial);

View file

@ -65,7 +65,7 @@ use {
}, },
data_transfer::{ data_transfer::{
DataOfferIds, DataSourceIds, data_control::DataControlDeviceIds, DataOfferIds, DataSourceIds, data_control::DataControlDeviceIds,
x_data_device::XIpcDeviceIds, x_data_device::XTransferDeviceIds,
}, },
jay_render_ctx::JayRenderCtx, jay_render_ctx::JayRenderCtx,
jay_screencast::JayScreencast, jay_screencast::JayScreencast,
@ -435,7 +435,7 @@ pub struct XWaylandState {
pub pidfd: CloneCell<Option<Rc<OwnedFd>>>, pub pidfd: CloneCell<Option<Rc<OwnedFd>>>,
pub handler: RefCell<Option<SpawnedFuture<()>>>, pub handler: RefCell<Option<SpawnedFuture<()>>>,
pub queue: Rc<AsyncQueue<XWaylandEvent>>, pub queue: Rc<AsyncQueue<XWaylandEvent>>,
pub ipc_device_ids: XIpcDeviceIds, pub ipc_device_ids: XTransferDeviceIds,
pub use_wire_scale: Cell<bool>, pub use_wire_scale: Cell<bool>,
pub wire_scale: Cell<Option<i32>>, pub wire_scale: Cell<Option<i32>>,
pub windows: CopyHashMap<XwindowId, Rc<Xwindow>>, pub windows: CopyHashMap<XwindowId, Rc<Xwindow>>,

View file

@ -7,7 +7,7 @@ use {
compositor::DISPLAY, compositor::DISPLAY,
forker::{ForkerError, ForkerProxy}, forker::{ForkerError, ForkerProxy},
ifs::{ ifs::{
data_transfer::{DataOfferId, DataSourceId, IpcLocation, x_data_offer::XDataOffer}, data_transfer::{DataOfferId, DataSourceId, TransferLocation, x_data_offer::XDataOffer},
wl_seat::SeatId, wl_seat::SeatId,
wl_surface::x_surface::xwindow::{Xwindow, XwindowData}, wl_surface::x_surface::xwindow::{Xwindow, XwindowData},
}, },
@ -264,30 +264,30 @@ pub enum XWaylandEvent {
#[expect(dead_code)] #[expect(dead_code)]
SeatChanged, SeatChanged,
IpcCancelSource { DataTransferCancelSource {
location: IpcLocation, location: TransferLocation,
seat: SeatId, seat: SeatId,
source: DataSourceId, source: DataSourceId,
}, },
IpcSendSource { DataTransferSendSource {
location: IpcLocation, location: TransferLocation,
seat: SeatId, seat: SeatId,
source: DataSourceId, source: DataSourceId,
mime_type: String, mime_type: String,
fd: Rc<OwnedFd>, fd: Rc<OwnedFd>,
}, },
IpcSetOffer { DataTransferSetOffer {
location: IpcLocation, location: TransferLocation,
seat: SeatId, seat: SeatId,
offer: Rc<XDataOffer>, offer: Rc<XDataOffer>,
}, },
IpcSetSelection { DataTransferSetSelection {
location: IpcLocation, location: TransferLocation,
seat: SeatId, seat: SeatId,
offer: Option<Rc<XDataOffer>>, offer: Option<Rc<XDataOffer>>,
}, },
IpcAddOfferMimeType { DataTransferAddOfferMimeType {
location: IpcLocation, location: TransferLocation,
seat: SeatId, seat: SeatId,
offer: DataOfferId, offer: DataOfferId,
mime_type: String, mime_type: String,

View file

@ -7,10 +7,10 @@ use {
criteria::tlm::{TL_CHANGED_CLASS_INST, TL_CHANGED_ROLE}, criteria::tlm::{TL_CHANGED_CLASS_INST, TL_CHANGED_ROLE},
ifs::{ ifs::{
data_transfer::{ 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, SourceData, add_data_source_mime_type, destroy_data_device, destroy_data_offer,
destroy_data_source, receive_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_offer::XDataOffer,
x_data_source::XDataSource, x_data_source::XDataSource,
}, },
@ -168,7 +168,7 @@ struct EnhancedOffer {
} }
#[derive(Default)] #[derive(Default)]
struct SelectionData<T: XIpc> { struct SelectionData<T: XTransfer> {
sources: CopyHashMap<SeatId, Rc<XDataSource>>, sources: CopyHashMap<SeatId, Rc<XDataSource>>,
offers: CopyHashMap<SeatId, Rc<EnhancedOffer>>, offers: CopyHashMap<SeatId, Rc<EnhancedOffer>>,
active_offer: CloneCell<Option<Rc<EnhancedOffer>>>, active_offer: CloneCell<Option<Rc<EnhancedOffer>>>,
@ -178,7 +178,7 @@ struct SelectionData<T: XIpc> {
_phantom: PhantomData<T>, _phantom: PhantomData<T>,
} }
impl<T: XIpc> SelectionData<T> { impl<T: XTransfer> SelectionData<T> {
fn destroy(&self) { fn destroy(&self) {
for offer in self.offers.lock().drain_values() { for offer in self.offers.lock().drain_values() {
destroy_data_offer::<T>(&offer.offer); destroy_data_offer::<T>(&offer.offer);
@ -206,9 +206,9 @@ impl<T: XIpc> SelectionData<T> {
#[derive(Default)] #[derive(Default)]
pub struct XwmShared { pub struct XwmShared {
devices: CopyHashMap<SeatId, Rc<XIpcDevice>>, devices: CopyHashMap<SeatId, Rc<XTransferDevice>>,
data: SelectionData<XClipboardIpc>, data: SelectionData<XClipboardTransfer>,
primary_selection: SelectionData<XPrimarySelectionIpc>, primary_selection: SelectionData<XPrimarySelectionTransfer>,
transfers: CopyHashMap<u64, SpawnedFuture<()>>, transfers: CopyHashMap<u64, SpawnedFuture<()>>,
} }
@ -217,8 +217,8 @@ impl Drop for XwmShared {
self.data.destroy(); self.data.destroy();
self.primary_selection.destroy(); self.primary_selection.destroy();
for device in self.devices.lock().drain_values() { for device in self.devices.lock().drain_values() {
destroy_data_device::<XClipboardIpc>(&device); destroy_data_device::<XClipboardTransfer>(&device);
destroy_data_device::<XPrimarySelectionIpc>(&device); destroy_data_device::<XPrimarySelectionTransfer>(&device);
device.seat.unset_x_data_device(device.id); device.seat.unset_x_data_device(device.id);
} }
self.transfers.clear(); self.transfers.clear();
@ -566,7 +566,7 @@ impl Wm {
self.shared.devices.remove(&seat); self.shared.devices.remove(&seat);
} }
for seat in new_seats { for seat in new_seats {
let dd = Rc::new(XIpcDevice { let dd = Rc::new(XTransferDevice {
id: self.state.xwayland.ipc_device_ids.next(), id: self.state.xwayland.ipc_device_ids.next(),
clipboard: Default::default(), clipboard: Default::default(),
primary_selection: Default::default(), primary_selection: Default::default(),
@ -609,29 +609,29 @@ impl Wm {
XWaylandEvent::ActivateRoot => self.activate_window(None, Initiator::Wayland).await, XWaylandEvent::ActivateRoot => self.activate_window(None, Initiator::Wayland).await,
XWaylandEvent::Close(window) => self.close_window(&window).await, XWaylandEvent::Close(window) => self.close_window(&window).await,
XWaylandEvent::SeatChanged => self.seats_changed(), XWaylandEvent::SeatChanged => self.seats_changed(),
XWaylandEvent::IpcCancelSource { XWaylandEvent::DataTransferCancelSource {
location, location,
seat, seat,
source, source,
} => match location { } => match location {
IpcLocation::Clipboard => { TransferLocation::Clipboard => {
self.dd_cancel_source::<XClipboardIpc>(&self.shared.clone().data, seat, source) self.dd_cancel_source::<XClipboardTransfer>(&self.shared.clone().data, seat, source)
} }
IpcLocation::PrimarySelection => self.dd_cancel_source::<XPrimarySelectionIpc>( TransferLocation::PrimarySelection => self.dd_cancel_source::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection, &self.shared.clone().primary_selection,
seat, seat,
source, source,
), ),
}, },
XWaylandEvent::IpcSendSource { XWaylandEvent::DataTransferSendSource {
location, location,
seat, seat,
source, source,
mime_type, mime_type,
fd, fd,
} => match location { } => match location {
IpcLocation::Clipboard => { TransferLocation::Clipboard => {
self.dd_send_source::<XClipboardIpc>( self.dd_send_source::<XClipboardTransfer>(
&self.shared.clone().data, &self.shared.clone().data,
seat, seat,
source, source,
@ -640,8 +640,8 @@ impl Wm {
) )
.await .await
} }
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
self.dd_send_source::<XPrimarySelectionIpc>( self.dd_send_source::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection, &self.shared.clone().primary_selection,
seat, seat,
source, source,
@ -651,17 +651,17 @@ impl Wm {
.await .await
} }
}, },
XWaylandEvent::IpcSetOffer { XWaylandEvent::DataTransferSetOffer {
location, location,
seat, seat,
offer, offer,
} => match location { } => match location {
IpcLocation::Clipboard => { TransferLocation::Clipboard => {
self.dd_set_offer::<XClipboardIpc>(&self.shared.clone().data, seat, offer) self.dd_set_offer::<XClipboardTransfer>(&self.shared.clone().data, seat, offer)
.await .await
} }
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
self.dd_set_offer::<XPrimarySelectionIpc>( self.dd_set_offer::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection, &self.shared.clone().primary_selection,
seat, seat,
offer, offer,
@ -669,17 +669,17 @@ impl Wm {
.await .await
} }
}, },
XWaylandEvent::IpcSetSelection { XWaylandEvent::DataTransferSetSelection {
seat, seat,
location, location,
offer, offer,
} => match location { } => match location {
IpcLocation::Clipboard => { TransferLocation::Clipboard => {
self.dd_set_selection::<XClipboardIpc>(&self.shared.clone().data, seat, offer) self.dd_set_selection::<XClipboardTransfer>(&self.shared.clone().data, seat, offer)
.await .await
} }
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
self.dd_set_selection::<XPrimarySelectionIpc>( self.dd_set_selection::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection, &self.shared.clone().primary_selection,
seat, seat,
offer, offer,
@ -687,14 +687,14 @@ impl Wm {
.await .await
} }
}, },
XWaylandEvent::IpcAddOfferMimeType { XWaylandEvent::DataTransferAddOfferMimeType {
location, location,
seat, seat,
offer, offer,
mime_type, mime_type,
} => match location { } => match location {
IpcLocation::Clipboard => { TransferLocation::Clipboard => {
self.dd_add_offer_mime_type::<XClipboardIpc>( self.dd_add_offer_mime_type::<XClipboardTransfer>(
&self.shared.clone().data, &self.shared.clone().data,
seat, seat,
offer, offer,
@ -702,8 +702,8 @@ impl Wm {
) )
.await .await
} }
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
self.dd_add_offer_mime_type::<XPrimarySelectionIpc>( self.dd_add_offer_mime_type::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection, &self.shared.clone().primary_selection,
seat, seat,
offer, offer,
@ -715,7 +715,7 @@ impl Wm {
} }
} }
async fn dd_add_offer_mime_type<T: XIpc>( async fn dd_add_offer_mime_type<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
seat: SeatId, seat: SeatId,
@ -741,7 +741,7 @@ impl Wm {
enhanced.mime_types.borrow_mut().push(mt); enhanced.mime_types.borrow_mut().push(mt);
} }
async fn dd_set_offer<T: XIpc>( async fn dd_set_offer<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
seat: SeatId, seat: SeatId,
@ -762,7 +762,7 @@ impl Wm {
); );
} }
async fn dd_set_selection<T: XIpc>( async fn dd_set_selection<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
seat: SeatId, seat: SeatId,
@ -857,7 +857,7 @@ impl Wm {
} }
} }
async fn dd_send_source<T: XIpc>( async fn dd_send_source<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
seat: SeatId, seat: SeatId,
@ -898,7 +898,7 @@ impl Wm {
.push(PendingTransfer { mime_type, fd }); .push(PendingTransfer { mime_type, fd });
} }
fn dd_cancel_source<T: XIpc>( fn dd_cancel_source<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
seat: SeatId, seat: SeatId,
@ -1604,7 +1604,7 @@ impl Wm {
} }
} }
async fn handle_xfixes_selection_notify_<T: XIpc>( async fn handle_xfixes_selection_notify_<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
event: &XfixesSelectionNotify, event: &XfixesSelectionNotify,
@ -1658,7 +1658,7 @@ impl Wm {
} }
} }
async fn handle_selection_request_<T: XIpc>( async fn handle_selection_request_<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
event: &SelectionRequest, event: &SelectionRequest,
@ -1762,7 +1762,7 @@ impl Wm {
} }
} }
async fn handle_selection_notify_<T: XIpc>( async fn handle_selection_notify_<T: XTransfer>(
&mut self, &mut self,
sd: &SelectionData<T>, sd: &SelectionData<T>,
event: &SelectionNotify, event: &SelectionNotify,
@ -1790,8 +1790,8 @@ impl Wm {
add_data_source_mime_type::<T>(&source, target); add_data_source_mime_type::<T>(&source, target);
} }
let res = match source.location { let res = match source.location {
IpcLocation::Clipboard => seat.set_selection(Some(source.clone())), TransferLocation::Clipboard => seat.set_selection(Some(source.clone())),
IpcLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
seat.set_primary_selection(Some(source.clone())) seat.set_primary_selection(Some(source.clone()))
} }
}; };