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

@ -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<T: XIpc> {
struct SelectionData<T: XTransfer> {
sources: CopyHashMap<SeatId, Rc<XDataSource>>,
offers: CopyHashMap<SeatId, Rc<EnhancedOffer>>,
active_offer: CloneCell<Option<Rc<EnhancedOffer>>>,
@ -178,7 +178,7 @@ struct SelectionData<T: XIpc> {
_phantom: PhantomData<T>,
}
impl<T: XIpc> SelectionData<T> {
impl<T: XTransfer> SelectionData<T> {
fn destroy(&self) {
for offer in self.offers.lock().drain_values() {
destroy_data_offer::<T>(&offer.offer);
@ -206,9 +206,9 @@ impl<T: XIpc> SelectionData<T> {
#[derive(Default)]
pub struct XwmShared {
devices: CopyHashMap<SeatId, Rc<XIpcDevice>>,
data: SelectionData<XClipboardIpc>,
primary_selection: SelectionData<XPrimarySelectionIpc>,
devices: CopyHashMap<SeatId, Rc<XTransferDevice>>,
data: SelectionData<XClipboardTransfer>,
primary_selection: SelectionData<XPrimarySelectionTransfer>,
transfers: CopyHashMap<u64, SpawnedFuture<()>>,
}
@ -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::<XClipboardIpc>(&device);
destroy_data_device::<XPrimarySelectionIpc>(&device);
destroy_data_device::<XClipboardTransfer>(&device);
destroy_data_device::<XPrimarySelectionTransfer>(&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::<XClipboardIpc>(&self.shared.clone().data, seat, source)
TransferLocation::Clipboard => {
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,
seat,
source,
),
},
XWaylandEvent::IpcSendSource {
XWaylandEvent::DataTransferSendSource {
location,
seat,
source,
mime_type,
fd,
} => match location {
IpcLocation::Clipboard => {
self.dd_send_source::<XClipboardIpc>(
TransferLocation::Clipboard => {
self.dd_send_source::<XClipboardTransfer>(
&self.shared.clone().data,
seat,
source,
@ -640,8 +640,8 @@ impl Wm {
)
.await
}
IpcLocation::PrimarySelection => {
self.dd_send_source::<XPrimarySelectionIpc>(
TransferLocation::PrimarySelection => {
self.dd_send_source::<XPrimarySelectionTransfer>(
&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::<XClipboardIpc>(&self.shared.clone().data, seat, offer)
TransferLocation::Clipboard => {
self.dd_set_offer::<XClipboardTransfer>(&self.shared.clone().data, seat, offer)
.await
}
IpcLocation::PrimarySelection => {
self.dd_set_offer::<XPrimarySelectionIpc>(
TransferLocation::PrimarySelection => {
self.dd_set_offer::<XPrimarySelectionTransfer>(
&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::<XClipboardIpc>(&self.shared.clone().data, seat, offer)
TransferLocation::Clipboard => {
self.dd_set_selection::<XClipboardTransfer>(&self.shared.clone().data, seat, offer)
.await
}
IpcLocation::PrimarySelection => {
self.dd_set_selection::<XPrimarySelectionIpc>(
TransferLocation::PrimarySelection => {
self.dd_set_selection::<XPrimarySelectionTransfer>(
&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::<XClipboardIpc>(
TransferLocation::Clipboard => {
self.dd_add_offer_mime_type::<XClipboardTransfer>(
&self.shared.clone().data,
seat,
offer,
@ -702,8 +702,8 @@ impl Wm {
)
.await
}
IpcLocation::PrimarySelection => {
self.dd_add_offer_mime_type::<XPrimarySelectionIpc>(
TransferLocation::PrimarySelection => {
self.dd_add_offer_mime_type::<XPrimarySelectionTransfer>(
&self.shared.clone().primary_selection,
seat,
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,
sd: &SelectionData<T>,
seat: SeatId,
@ -741,7 +741,7 @@ impl Wm {
enhanced.mime_types.borrow_mut().push(mt);
}
async fn dd_set_offer<T: XIpc>(
async fn dd_set_offer<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
seat: SeatId,
@ -762,7 +762,7 @@ impl Wm {
);
}
async fn dd_set_selection<T: XIpc>(
async fn dd_set_selection<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
seat: SeatId,
@ -857,7 +857,7 @@ impl Wm {
}
}
async fn dd_send_source<T: XIpc>(
async fn dd_send_source<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
seat: SeatId,
@ -898,7 +898,7 @@ impl Wm {
.push(PendingTransfer { mime_type, fd });
}
fn dd_cancel_source<T: XIpc>(
fn dd_cancel_source<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
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,
sd: &SelectionData<T>,
event: &XfixesSelectionNotify,
@ -1658,7 +1658,7 @@ impl Wm {
}
}
async fn handle_selection_request_<T: XIpc>(
async fn handle_selection_request_<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
event: &SelectionRequest,
@ -1762,7 +1762,7 @@ impl Wm {
}
}
async fn handle_selection_notify_<T: XIpc>(
async fn handle_selection_notify_<T: XTransfer>(
&mut self,
sd: &SelectionData<T>,
event: &SelectionNotify,
@ -1790,8 +1790,8 @@ impl Wm {
add_data_source_mime_type::<T>(&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()))
}
};