ifs: rename data transfer interfaces
This commit is contained in:
parent
f9e8d614ce
commit
5cb7b5973f
21 changed files with 223 additions and 223 deletions
|
|
@ -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<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 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)
|
||||
where
|
||||
C: FnMut(&Rc<Self::Device>);
|
||||
}
|
||||
|
||||
pub trait IpcVtable: Sized {
|
||||
pub trait TransferVtable: Sized {
|
||||
type Device;
|
||||
type Source: DataSource;
|
||||
type Offer: DataOffer<Device = Self::Device>;
|
||||
|
|
@ -167,7 +167,7 @@ pub struct OfferData<D> {
|
|||
}
|
||||
|
||||
#[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<S: DynDataSource>(
|
|||
src: &S,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
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<S: DynDataSource>(src: &S, cancel_privileged: bool) {
|
|||
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();
|
||||
data.source.take();
|
||||
destroy_data_offer::<T>(&offer);
|
||||
|
|
@ -299,7 +299,7 @@ pub fn detach_seat<S: DataSource>(src: &S, seat: &Rc<WlSeatGlobal>) {
|
|||
// data.client.flush();
|
||||
}
|
||||
|
||||
fn offer_source_to_device<T: IpcVtable>(
|
||||
fn offer_source_to_device<T: TransferVtable>(
|
||||
src: &Rc<dyn DynDataSource>,
|
||||
dd: &Rc<T::Device>,
|
||||
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
|
||||
T: IpcVtable<Device = XIpcDevice>,
|
||||
T: TransferVtable<Device = XTransferDevice>,
|
||||
{
|
||||
let data = src.source_data();
|
||||
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>)
|
||||
where
|
||||
T: IpcVtable,
|
||||
T: TransferVtable,
|
||||
{
|
||||
let data = src.source_data();
|
||||
let shared = data.shared.get();
|
||||
|
|
@ -356,7 +356,7 @@ where
|
|||
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>,
|
||||
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();
|
||||
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<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();
|
||||
if let Some(seat) = data.seat.take() {
|
||||
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();
|
||||
if let Some(device) = data.device.take() {
|
||||
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 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<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 mut remove = SmallVec::<[DataOfferId; 1]>::new();
|
||||
for (id, offer) in &data.offers {
|
||||
|
|
@ -444,20 +444,20 @@ fn break_source_loops<T: IpcVtable>(src: &T::Source) {
|
|||
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();
|
||||
data.device.set(None);
|
||||
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);
|
||||
data.selection.take();
|
||||
data.dnd.take();
|
||||
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();
|
||||
if let Some(src) = data.source.get() {
|
||||
src.send_send(mime_type, fd);
|
||||
|
|
|
|||
|
|
@ -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<Self>,
|
||||
location: IpcLocation,
|
||||
location: TransferLocation,
|
||||
source: Option<Rc<dyn DynDataSource>>,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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<T: DataControlIpc> {
|
|||
pub client: Rc<Client>,
|
||||
pub device: Rc<T::Device>,
|
||||
pub data: OfferData<T::Device>,
|
||||
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<IpcLocation>,
|
||||
pub location: Cell<TransferLocation>,
|
||||
pub used: Cell<bool>,
|
||||
}
|
||||
|
||||
|
|
@ -99,22 +99,22 @@ impl<T: DataControlDevice> DynDataControlDevice for T {
|
|||
|
||||
fn handle_new_source(
|
||||
self: Rc<Self>,
|
||||
location: IpcLocation,
|
||||
location: TransferLocation,
|
||||
source: Option<Rc<dyn DynDataSource>>,
|
||||
) {
|
||||
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::<Clipboard<T::Ipc>>(src, &self);
|
||||
}
|
||||
_ => self.send_selection(None),
|
||||
},
|
||||
IpcLocation::PrimarySelection => match source {
|
||||
TransferLocation::PrimarySelection => match source {
|
||||
Some(src) => {
|
||||
offer_source_to_data_control_device::<PrimarySelection<T::Ipc>>(src, &self);
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ type PrimarySelection<T> = DataControlIpcImpl<PrimarySelectionCore<T>>;
|
|||
|
||||
pub trait DataControlLocationIpc {
|
||||
type Ipc: DataControlIpc;
|
||||
const LOCATION: IpcLocation;
|
||||
const LOCATION: TransferLocation;
|
||||
|
||||
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> {
|
||||
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>> {
|
||||
&dd.data().clipboard_data
|
||||
|
|
@ -157,7 +157,7 @@ impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> {
|
|||
|
||||
impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<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>> {
|
||||
&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 Source = Source<T::Ipc>;
|
||||
type Offer = Offer<T::Ipc>;
|
||||
|
|
@ -234,10 +234,10 @@ impl<T: DataControlSource> DynDataSource for T {
|
|||
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() {
|
||||
IpcLocation::Clipboard => offer_source_to_x::<XClipboardIpc>(self, dd),
|
||||
IpcLocation::PrimarySelection => offer_source_to_x::<XPrimarySelectionIpc>(self, dd),
|
||||
TransferLocation::Clipboard => offer_source_to_x::<XClipboardTransfer>(self, dd),
|
||||
TransferLocation::PrimarySelection => offer_source_to_x::<XPrimarySelectionTransfer>(self, dd),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -273,8 +273,8 @@ impl<T: DataControlOffer> DynDataOffer for T {
|
|||
|
||||
fn cancel(&self) {
|
||||
match self.data().location {
|
||||
IpcLocation::Clipboard => cancel_offer::<Clipboard<T::Ipc>>(self),
|
||||
IpcLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Ipc>>(self),
|
||||
TransferLocation::Clipboard => cancel_offer::<Clipboard<T::Ipc>>(self),
|
||||
TransferLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Ipc>>(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<D: DataControlDevice>(
|
||||
device: &D,
|
||||
source: Option<SourceId<D::Ipc>>,
|
||||
location: IpcLocation,
|
||||
location: TransferLocation,
|
||||
) -> Result<Option<Rc<Source<D::Ipc>>>, DataControlError> {
|
||||
if let Some(source) = source {
|
||||
let src = device.data().client.lookup(source)?;
|
||||
|
|
@ -337,7 +337,7 @@ pub mod logic {
|
|||
d: &D,
|
||||
source: Option<SourceId<D::Ipc>>,
|
||||
) -> 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<SourceId<D::Ipc>>,
|
||||
) -> 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: DataControlSource>(s: &S) -> Result<(), DataControlError> {
|
||||
match s.data().location.get() {
|
||||
IpcLocation::Clipboard => destroy_data_source::<Clipboard<S::Ipc>>(s),
|
||||
IpcLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Ipc>>(s),
|
||||
TransferLocation::Clipboard => destroy_data_source::<Clipboard<S::Ipc>>(s),
|
||||
TransferLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Ipc>>(s),
|
||||
}
|
||||
s.data().data.client.remove_obj(s)?;
|
||||
Ok(())
|
||||
|
|
@ -381,15 +381,15 @@ pub mod logic {
|
|||
|
||||
pub fn data_source_break_loops<S: DataControlSource>(s: &S) {
|
||||
match s.data().location.get() {
|
||||
IpcLocation::Clipboard => break_source_loops::<Clipboard<S::Ipc>>(s),
|
||||
IpcLocation::PrimarySelection => break_source_loops::<PrimarySelection<S::Ipc>>(s),
|
||||
TransferLocation::Clipboard => break_source_loops::<Clipboard<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>) {
|
||||
match o.data().location {
|
||||
IpcLocation::Clipboard => receive_data_offer::<Clipboard<O::Ipc>>(o, mime_type, fd),
|
||||
IpcLocation::PrimarySelection => {
|
||||
TransferLocation::Clipboard => receive_data_offer::<Clipboard<O::Ipc>>(o, mime_type, fd),
|
||||
TransferLocation::PrimarySelection => {
|
||||
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> {
|
||||
match o.data().location {
|
||||
IpcLocation::Clipboard => destroy_data_offer::<Clipboard<O::Ipc>>(o),
|
||||
IpcLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Ipc>>(o),
|
||||
TransferLocation::Clipboard => destroy_data_offer::<Clipboard<O::Ipc>>(o),
|
||||
TransferLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Ipc>>(o),
|
||||
}
|
||||
o.data().client.remove_obj(o)?;
|
||||
Ok(())
|
||||
|
|
@ -406,8 +406,8 @@ pub mod logic {
|
|||
|
||||
pub fn data_offer_break_loops<O: DataControlOffer>(o: &O) {
|
||||
match o.data().location {
|
||||
IpcLocation::Clipboard => break_offer_loops::<Clipboard<O::Ipc>>(o),
|
||||
IpcLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Ipc>>(o),
|
||||
TransferLocation::Clipboard => break_offer_loops::<Clipboard<O::Ipc>>(o),
|
||||
TransferLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Ipc>>(o),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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<Self>) -> Result<(), Self::Error> {
|
||||
destroy_data_device::<ClipboardIpc>(self);
|
||||
destroy_data_device::<ClipboardTransfer>(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<C>(seat: &WlSeatGlobal, client: ClientId, f: C)
|
||||
where
|
||||
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 Source = WlDataSource;
|
||||
type Offer = WlDataOffer;
|
||||
|
|
@ -216,7 +216,7 @@ object_base! {
|
|||
|
||||
impl Object for WlDataDevice {
|
||||
fn break_loops(&self) {
|
||||
break_device_loops::<ClipboardIpc>(self);
|
||||
break_device_loops::<ClipboardTransfer>(self);
|
||||
self.seat.remove_data_device(self);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::<ClipboardIpc>(self);
|
||||
cancel_offer::<ClipboardTransfer>(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::<ClipboardIpc>(self, req.mime_type, req.fd);
|
||||
receive_data_offer::<ClipboardTransfer>(self, req.mime_type, req.fd);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ object_base! {
|
|||
|
||||
impl Object for WlDataOffer {
|
||||
fn break_loops(&self) {
|
||||
break_offer_loops::<ClipboardIpc>(self);
|
||||
break_offer_loops::<ClipboardTransfer>(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Self>, dd: &Rc<XIpcDevice>) {
|
||||
offer_source_to_x::<XClipboardIpc>(self, dd);
|
||||
fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>) {
|
||||
offer_source_to_x::<XClipboardTransfer>(self, dd);
|
||||
}
|
||||
|
||||
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -201,12 +201,12 @@ impl WlDataSourceRequestHandler for WlDataSource {
|
|||
type Error = WlDataSourceError;
|
||||
|
||||
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(())
|
||||
}
|
||||
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ object_base! {
|
|||
|
||||
impl Object for WlDataSource {
|
||||
fn break_loops(&self) {
|
||||
break_source_loops::<ClipboardIpc>(self);
|
||||
break_source_loops::<ClipboardTransfer>(self);
|
||||
self.toplevel_drag.take();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<XDataOffer>,
|
||||
pub primary_selection: DeviceData<XDataOffer>,
|
||||
pub seat: Rc<WlSeatGlobal>,
|
||||
|
|
@ -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<WlSeatGlobal>);
|
||||
|
||||
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer>;
|
||||
fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer>;
|
||||
}
|
||||
|
||||
impl XIpc for XClipboardIpc {
|
||||
const LOCATION: IpcLocation = IpcLocation::Clipboard;
|
||||
impl XTransfer for XClipboardTransfer {
|
||||
const LOCATION: TransferLocation = TransferLocation::Clipboard;
|
||||
|
||||
fn x_unset(seat: &Rc<WlSeatGlobal>) {
|
||||
seat.unset_selection();
|
||||
}
|
||||
|
||||
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer> {
|
||||
fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer> {
|
||||
&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<WlSeatGlobal>) {
|
||||
seat.unset_primary_selection();
|
||||
}
|
||||
|
||||
fn x_device_data(dd: &XIpcDevice) -> &DeviceData<XDataOffer> {
|
||||
fn x_device_data(dd: &XTransferDevice) -> &DeviceData<XDataOffer> {
|
||||
&dd.primary_selection
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: XIpc> IpcVtable for T {
|
||||
type Device = XIpcDevice;
|
||||
impl<T: XTransfer> TransferVtable for T {
|
||||
type Device = XTransferDevice;
|
||||
type Source = XDataSource;
|
||||
type Offer = XDataOffer;
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ impl<T: XIpc> 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<T: XIpc> IpcVtable for T {
|
|||
}
|
||||
|
||||
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,
|
||||
seat: dd.seat.id(),
|
||||
offer: offer.clone(),
|
||||
|
|
|
|||
|
|
@ -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<XIpcDevice>,
|
||||
pub data: OfferData<XIpcDevice>,
|
||||
pub device: Rc<XTransferDevice>,
|
||||
pub data: OfferData<XTransferDevice>,
|
||||
pub tracker: Tracker<Self>,
|
||||
pub location: IpcLocation,
|
||||
pub location: TransferLocation,
|
||||
}
|
||||
|
||||
impl DataOffer for XDataOffer {
|
||||
type Device = XIpcDevice;
|
||||
type Device = XTransferDevice;
|
||||
|
||||
fn offer_data(&self) -> &OfferData<Self::Device> {
|
||||
&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::<XClipboardIpc>(self),
|
||||
IpcLocation::PrimarySelection => cancel_offer::<XPrimarySelectionIpc>(self),
|
||||
TransferLocation::Clipboard => cancel_offer::<XClipboardTransfer>(self),
|
||||
TransferLocation::PrimarySelection => cancel_offer::<XPrimarySelectionTransfer>(self),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<State>,
|
||||
pub device: Rc<XIpcDevice>,
|
||||
pub device: Rc<XTransferDevice>,
|
||||
pub data: SourceData,
|
||||
pub location: IpcLocation,
|
||||
pub location: TransferLocation,
|
||||
}
|
||||
|
||||
impl DataSource for XDataSource {
|
||||
fn send_cancelled(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
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<OwnedFd>) {
|
||||
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<Self>, _dd: &Rc<XIpcDevice>) {
|
||||
fn offer_to_x(self: Rc<Self>, _dd: &Rc<XTransferDevice>) {
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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<Self>) -> Result<(), Self::Error> {
|
||||
destroy_data_device::<PrimarySelectionIpc>(self);
|
||||
destroy_data_device::<PrimarySelectionTransfer>(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<C>(seat: &WlSeatGlobal, client: ClientId, f: C)
|
||||
where
|
||||
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 Source = ZwpPrimarySelectionSourceV1;
|
||||
type Offer = ZwpPrimarySelectionOfferV1;
|
||||
|
|
@ -162,7 +162,7 @@ object_base! {
|
|||
|
||||
impl Object for ZwpPrimarySelectionDeviceV1 {
|
||||
fn break_loops(&self) {
|
||||
break_device_loops::<PrimarySelectionIpc>(self);
|
||||
break_device_loops::<PrimarySelectionTransfer>(self);
|
||||
self.seat.remove_primary_selection_device(self);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::<PrimarySelectionIpc>(self);
|
||||
cancel_offer::<PrimarySelectionTransfer>(self);
|
||||
}
|
||||
|
||||
fn get_seat(&self) -> Rc<WlSeatGlobal> {
|
||||
|
|
@ -72,12 +72,12 @@ impl ZwpPrimarySelectionOfferV1RequestHandler for ZwpPrimarySelectionOfferV1 {
|
|||
type Error = ZwpPrimarySelectionOfferV1Error;
|
||||
|
||||
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(())
|
||||
}
|
||||
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ object_base! {
|
|||
|
||||
impl Object for ZwpPrimarySelectionOfferV1 {
|
||||
fn break_loops(&self) {
|
||||
break_offer_loops::<PrimarySelectionIpc>(self);
|
||||
break_offer_loops::<PrimarySelectionTransfer>(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Self>, dd: &Rc<XIpcDevice>) {
|
||||
offer_source_to_x::<XPrimarySelectionIpc>(self, dd);
|
||||
fn offer_to_x(self: Rc<Self>, dd: &Rc<XTransferDevice>) {
|
||||
offer_source_to_x::<XPrimarySelectionTransfer>(self, dd);
|
||||
}
|
||||
|
||||
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
@ -82,12 +82,12 @@ impl ZwpPrimarySelectionSourceV1RequestHandler for ZwpPrimarySelectionSourceV1 {
|
|||
type Error = ZwpPrimarySelectionSourceV1Error;
|
||||
|
||||
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(())
|
||||
}
|
||||
|
||||
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)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ object_base! {
|
|||
|
||||
impl Object for ZwpPrimarySelectionSourceV1 {
|
||||
fn break_loops(&self) {
|
||||
break_source_loops::<PrimarySelectionIpc>(self);
|
||||
break_source_loops::<PrimarySelectionTransfer>(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Vec<FoundNode>>,
|
||||
keyboard_node: CloneCell<Rc<dyn Node>>,
|
||||
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>>>>,
|
||||
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<XIpcDevice>) {
|
||||
pub fn set_x_data_device(&self, device: &Rc<XTransferDevice>) {
|
||||
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<XIpcDevice>)) {
|
||||
pub fn for_each_x_data_device(&self, mut f: impl FnMut(&Rc<XTransferDevice>)) {
|
||||
for (_, dev) in &self.x_data_devices {
|
||||
f(&dev);
|
||||
}
|
||||
|
|
@ -1284,11 +1284,11 @@ impl WlSeatGlobal {
|
|||
self: &Rc<Self>,
|
||||
field: &CloneCell<Option<Rc<dyn DynDataSource>>>,
|
||||
src: Option<Rc<S>>,
|
||||
location: IpcLocation,
|
||||
location: TransferLocation,
|
||||
) -> Result<(), WlSeatError>
|
||||
where
|
||||
T: data_transfer::IterableIpcVtable,
|
||||
X: data_transfer::IpcVtable<Device = XIpcDevice>,
|
||||
T: data_transfer::IterableTransferVtable,
|
||||
X: data_transfer::TransferVtable<Device = XTransferDevice>,
|
||||
S: DynDataSource,
|
||||
{
|
||||
if let (Some(new), Some(old)) = (&src, &field.get())
|
||||
|
|
@ -1319,8 +1319,8 @@ impl WlSeatGlobal {
|
|||
selection: Option<Rc<dyn DynDataSource>>,
|
||||
client: &Rc<Client>,
|
||||
) where
|
||||
T: data_transfer::IterableIpcVtable,
|
||||
X: data_transfer::IpcVtable<Device = XIpcDevice>,
|
||||
T: data_transfer::IterableTransferVtable,
|
||||
X: data_transfer::TransferVtable<Device = XTransferDevice>,
|
||||
{
|
||||
if let Some(src) = &selection {
|
||||
src.cancel_unprivileged_offers();
|
||||
|
|
@ -1415,10 +1415,10 @@ impl WlSeatGlobal {
|
|||
self: &Rc<Self>,
|
||||
selection: Option<Rc<S>>,
|
||||
) -> Result<(), WlSeatError> {
|
||||
self.set_selection_::<ClipboardIpc, XClipboardIpc, _>(
|
||||
self.set_selection_::<ClipboardTransfer, XClipboardTransfer, _>(
|
||||
&self.selection,
|
||||
selection,
|
||||
IpcLocation::Clipboard,
|
||||
TransferLocation::Clipboard,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1462,10 +1462,10 @@ impl WlSeatGlobal {
|
|||
self: &Rc<Self>,
|
||||
selection: Option<Rc<S>>,
|
||||
) -> Result<(), WlSeatError> {
|
||||
self.set_selection_::<PrimarySelectionIpc, XPrimarySelectionIpc, _>(
|
||||
self.set_selection_::<PrimarySelectionTransfer, XPrimarySelectionTransfer, _>(
|
||||
&self.primary_selection,
|
||||
selection,
|
||||
IpcLocation::PrimarySelection,
|
||||
TransferLocation::PrimarySelection,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1915,7 +1915,7 @@ pub enum WlSeatError {
|
|||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
IpcError(#[from] IpcError),
|
||||
TransferError(#[from] TransferError),
|
||||
#[error(transparent)]
|
||||
WlKeyboardError(Box<WlKeyboardError>),
|
||||
#[error("Data source has a toplevel attached")]
|
||||
|
|
|
|||
|
|
@ -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::<ClipboardIpc, XClipboardIpc>(
|
||||
self.offer_selection_to_client::<ClipboardTransfer, XClipboardTransfer>(
|
||||
self.selection.get(),
|
||||
&surface.client,
|
||||
);
|
||||
self.offer_selection_to_client::<PrimarySelectionIpc, XPrimarySelectionIpc>(
|
||||
self.offer_selection_to_client::<PrimarySelectionTransfer, XPrimarySelectionTransfer>(
|
||||
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::<ClipboardIpc>(src.clone(), &surface.client);
|
||||
offer_source_to_regular_client::<ClipboardTransfer>(src.clone(), &surface.client);
|
||||
}
|
||||
src.for_each_data_offer(|offer| {
|
||||
offer.send_enter(surface.id, x, y, serial);
|
||||
|
|
|
|||
|
|
@ -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<Option<Rc<OwnedFd>>>,
|
||||
pub handler: RefCell<Option<SpawnedFuture<()>>>,
|
||||
pub queue: Rc<AsyncQueue<XWaylandEvent>>,
|
||||
pub ipc_device_ids: XIpcDeviceIds,
|
||||
pub ipc_device_ids: XTransferDeviceIds,
|
||||
pub use_wire_scale: Cell<bool>,
|
||||
pub wire_scale: Cell<Option<i32>>,
|
||||
pub windows: CopyHashMap<XwindowId, Rc<Xwindow>>,
|
||||
|
|
|
|||
|
|
@ -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<OwnedFd>,
|
||||
},
|
||||
IpcSetOffer {
|
||||
location: IpcLocation,
|
||||
DataTransferSetOffer {
|
||||
location: TransferLocation,
|
||||
seat: SeatId,
|
||||
offer: Rc<XDataOffer>,
|
||||
},
|
||||
IpcSetSelection {
|
||||
location: IpcLocation,
|
||||
DataTransferSetSelection {
|
||||
location: TransferLocation,
|
||||
seat: SeatId,
|
||||
offer: Option<Rc<XDataOffer>>,
|
||||
},
|
||||
IpcAddOfferMimeType {
|
||||
location: IpcLocation,
|
||||
DataTransferAddOfferMimeType {
|
||||
location: TransferLocation,
|
||||
seat: SeatId,
|
||||
offer: DataOfferId,
|
||||
mime_type: String,
|
||||
|
|
|
|||
|
|
@ -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()))
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue