1
0
Fork 0
forked from wry/wry

ifs: rename data control protocol traits

This commit is contained in:
kossLAN 2026-05-29 18:09:44 -04:00
parent 5cb7b5973f
commit 6f913d5f69
No known key found for this signature in database
7 changed files with 93 additions and 93 deletions

View file

@ -6,7 +6,7 @@ use {
ext_data_control_offer_v1::ExtDataControlOfferV1, ext_data_control_offer_v1::ExtDataControlOfferV1,
ext_data_control_source_v1::ExtDataControlSourceV1, ext_data_control_source_v1::ExtDataControlSourceV1,
private::{ private::{
DataControlDevice, DataControlDeviceData, DataControlIpc, DataControlOfferData, DataControlDevice, DataControlDeviceData, DataControlProtocol, DataControlOfferData,
logic::{self, DataControlError}, logic::{self, DataControlError},
}, },
}, },
@ -25,7 +25,7 @@ use {
pub struct ExtDataControlDeviceV1 { pub struct ExtDataControlDeviceV1 {
pub id: ExtDataControlDeviceV1Id, pub id: ExtDataControlDeviceV1Id,
pub data: DataControlDeviceData<ExtDataControlIpc>, pub data: DataControlDeviceData<ExtDataControlProtocol>,
pub tracker: Tracker<Self>, pub tracker: Tracker<Self>,
} }
@ -97,9 +97,9 @@ impl ExtDataControlDeviceV1RequestHandler for ExtDataControlDeviceV1 {
} }
} }
pub struct ExtDataControlIpc; pub struct ExtDataControlProtocol;
impl DataControlIpc for ExtDataControlIpc { impl DataControlProtocol for ExtDataControlProtocol {
const PRIMARY_SELECTION_SINCE: Version = Version(1); const PRIMARY_SELECTION_SINCE: Version = Version(1);
type Device = ExtDataControlDeviceV1; type Device = ExtDataControlDeviceV1;
type OfferId = ExtDataControlOfferV1Id; type OfferId = ExtDataControlOfferV1Id;
@ -119,21 +119,21 @@ impl DataControlIpc for ExtDataControlIpc {
} }
impl DataControlDevice for ExtDataControlDeviceV1 { impl DataControlDevice for ExtDataControlDeviceV1 {
type Ipc = ExtDataControlIpc; type Protocol = ExtDataControlProtocol;
fn data(&self) -> &DataControlDeviceData<Self::Ipc> { fn data(&self) -> &DataControlDeviceData<Self::Protocol> {
&self.data &self.data
} }
fn send_data_offer(&self, offer: &Rc<<Self::Ipc as DataControlIpc>::Offer>) { fn send_data_offer(&self, offer: &Rc<<Self::Protocol as DataControlProtocol>::Offer>) {
self.send_data_offer(offer) self.send_data_offer(offer)
} }
fn send_selection(&self, offer: Option<&Rc<<Self::Ipc as DataControlIpc>::Offer>>) { fn send_selection(&self, offer: Option<&Rc<<Self::Protocol as DataControlProtocol>::Offer>>) {
self.send_selection(offer) self.send_selection(offer)
} }
fn send_primary_selection(&self, offer: Option<&Rc<<Self::Ipc as DataControlIpc>::Offer>>) { fn send_primary_selection(&self, offer: Option<&Rc<<Self::Protocol as DataControlProtocol>::Offer>>) {
self.send_primary_selection(offer) self.send_primary_selection(offer)
} }
} }

View file

@ -1,7 +1,7 @@
use { use {
crate::{ crate::{
ifs::data_transfer::data_control::{ ifs::data_transfer::data_control::{
ext_data_control_device_v1::ExtDataControlIpc, ext_data_control_device_v1::ExtDataControlProtocol,
private::{ private::{
DataControlOffer, DataControlOfferData, DataControlOffer, DataControlOfferData,
logic::{self, DataControlError}, logic::{self, DataControlError},
@ -17,14 +17,14 @@ use {
pub struct ExtDataControlOfferV1 { pub struct ExtDataControlOfferV1 {
pub id: ExtDataControlOfferV1Id, pub id: ExtDataControlOfferV1Id,
pub data: DataControlOfferData<ExtDataControlIpc>, pub data: DataControlOfferData<ExtDataControlProtocol>,
pub tracker: Tracker<Self>, pub tracker: Tracker<Self>,
} }
impl DataControlOffer for ExtDataControlOfferV1 { impl DataControlOffer for ExtDataControlOfferV1 {
type Ipc = ExtDataControlIpc; type Protocol = ExtDataControlProtocol;
fn data(&self) -> &DataControlOfferData<Self::Ipc> { fn data(&self) -> &DataControlOfferData<Self::Protocol> {
&self.data &self.data
} }

View file

@ -4,7 +4,7 @@ use {
ifs::data_transfer::{ ifs::data_transfer::{
TransferLocation, SourceData, TransferLocation, SourceData,
data_control::{ data_control::{
ext_data_control_device_v1::ExtDataControlIpc, ext_data_control_device_v1::ExtDataControlProtocol,
private::{ private::{
DataControlSource, DataControlSourceData, DataControlSource, DataControlSourceData,
logic::{self, DataControlError}, logic::{self, DataControlError},
@ -27,7 +27,7 @@ pub struct ExtDataControlSourceV1 {
} }
impl DataControlSource for ExtDataControlSourceV1 { impl DataControlSource for ExtDataControlSourceV1 {
type Ipc = ExtDataControlIpc; type Protocol = ExtDataControlProtocol;
fn data(&self) -> &DataControlSourceData { fn data(&self) -> &DataControlSourceData {
&self.data &self.data

View file

@ -19,26 +19,26 @@ use {
struct ClipboardCore<T>(PhantomData<T>); struct ClipboardCore<T>(PhantomData<T>);
struct PrimarySelectionCore<T>(PhantomData<T>); struct PrimarySelectionCore<T>(PhantomData<T>);
struct DataControlIpcImpl<T>(PhantomData<T>); struct DataControlProtocolImpl<T>(PhantomData<T>);
type Device<T> = <T as DataControlIpc>::Device; type Device<T> = <T as DataControlProtocol>::Device;
type Offer<T> = <T as DataControlIpc>::Offer; type Offer<T> = <T as DataControlProtocol>::Offer;
type Source<T> = <T as DataControlIpc>::Source; type Source<T> = <T as DataControlProtocol>::Source;
type SourceId<T> = <T as DataControlIpc>::SourceId; type SourceId<T> = <T as DataControlProtocol>::SourceId;
pub trait DataControlIpc: Sized + 'static { pub trait DataControlProtocol: Sized + 'static {
const PRIMARY_SELECTION_SINCE: Version; const PRIMARY_SELECTION_SINCE: Version;
type Device: DataControlDevice<Ipc = Self>; type Device: DataControlDevice<Protocol = Self>;
type OfferId: From<ObjectId>; type OfferId: From<ObjectId>;
type Offer: DataControlOffer<Ipc = Self>; type Offer: DataControlOffer<Protocol = Self>;
type SourceId: WaylandObjectLookup<Object = Self::Source>; type SourceId: WaylandObjectLookup<Object = Self::Source>;
type Source: DataControlSource<Ipc = Self>; type Source: DataControlSource<Protocol = Self>;
fn create_offer(id: Self::OfferId, data: DataControlOfferData<Self>) -> Rc<Self::Offer>; fn create_offer(id: Self::OfferId, data: DataControlOfferData<Self>) -> Rc<Self::Offer>;
} }
pub struct DataControlDeviceData<T: DataControlIpc> { pub struct DataControlDeviceData<T: DataControlProtocol> {
pub data_control_device_id: DataControlDeviceId, pub data_control_device_id: DataControlDeviceId,
pub client: Rc<Client>, pub client: Rc<Client>,
pub version: Version, pub version: Version,
@ -48,18 +48,18 @@ pub struct DataControlDeviceData<T: DataControlIpc> {
} }
pub trait DataControlDevice: WaylandObject { pub trait DataControlDevice: WaylandObject {
type Ipc: DataControlIpc<Device = Self>; type Protocol: DataControlProtocol<Device = Self>;
fn data(&self) -> &DataControlDeviceData<Self::Ipc>; fn data(&self) -> &DataControlDeviceData<Self::Protocol>;
fn send_data_offer(&self, offer: &Rc<Offer<Self::Ipc>>); fn send_data_offer(&self, offer: &Rc<Offer<Self::Protocol>>);
fn send_selection(&self, offer: Option<&Rc<Offer<Self::Ipc>>>); fn send_selection(&self, offer: Option<&Rc<Offer<Self::Protocol>>>);
fn send_primary_selection(&self, offer: Option<&Rc<Offer<Self::Ipc>>>); fn send_primary_selection(&self, offer: Option<&Rc<Offer<Self::Protocol>>>);
} }
pub struct DataControlOfferData<T: DataControlIpc> { pub struct DataControlOfferData<T: DataControlProtocol> {
pub offer_id: DataOfferId, pub offer_id: DataOfferId,
pub client: Rc<Client>, pub client: Rc<Client>,
pub device: Rc<T::Device>, pub device: Rc<T::Device>,
@ -68,9 +68,9 @@ pub struct DataControlOfferData<T: DataControlIpc> {
} }
pub trait DataControlOffer: WaylandObject { pub trait DataControlOffer: WaylandObject {
type Ipc: DataControlIpc<Offer = Self>; type Protocol: DataControlProtocol<Offer = Self>;
fn data(&self) -> &DataControlOfferData<Self::Ipc>; fn data(&self) -> &DataControlOfferData<Self::Protocol>;
fn send_offer(&self, mime_type: &str); fn send_offer(&self, mime_type: &str);
} }
@ -83,7 +83,7 @@ pub struct DataControlSourceData {
} }
pub trait DataControlSource: WaylandObject { pub trait DataControlSource: WaylandObject {
type Ipc: DataControlIpc<Source = Self>; type Protocol: DataControlProtocol<Source = Self>;
fn data(&self) -> &DataControlSourceData; fn data(&self) -> &DataControlSourceData;
@ -103,20 +103,20 @@ impl<T: DataControlDevice> DynDataControlDevice for T {
source: Option<Rc<dyn DynDataSource>>, source: Option<Rc<dyn DynDataSource>>,
) { ) {
if location == TransferLocation::PrimarySelection if location == TransferLocation::PrimarySelection
&& self.data().version < T::Ipc::PRIMARY_SELECTION_SINCE && self.data().version < T::Protocol::PRIMARY_SELECTION_SINCE
{ {
return; return;
} }
match location { match location {
TransferLocation::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::Protocol>>(src, &self);
} }
_ => self.send_selection(None), _ => self.send_selection(None),
}, },
TransferLocation::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::Protocol>>(src, &self);
} }
_ => self.send_primary_selection(None), _ => self.send_primary_selection(None),
}, },
@ -124,29 +124,29 @@ impl<T: DataControlDevice> DynDataControlDevice for T {
} }
} }
type Clipboard<T> = DataControlIpcImpl<ClipboardCore<T>>; type Clipboard<T> = DataControlProtocolImpl<ClipboardCore<T>>;
type PrimarySelection<T> = DataControlIpcImpl<PrimarySelectionCore<T>>; type PrimarySelection<T> = DataControlProtocolImpl<PrimarySelectionCore<T>>;
pub trait DataControlLocationIpc { pub trait DataControlLocation {
type Ipc: DataControlIpc; type Protocol: DataControlProtocol;
const LOCATION: TransferLocation; const LOCATION: TransferLocation;
fn loc_get_device_data(dd: &Device<Self::Ipc>) -> &DeviceData<Offer<Self::Ipc>>; fn loc_get_device_data(dd: &Device<Self::Protocol>) -> &DeviceData<Offer<Self::Protocol>>;
fn loc_send_selection(dd: &Device<Self::Ipc>, offer: Option<&Rc<Offer<Self::Ipc>>>); fn loc_send_selection(dd: &Device<Self::Protocol>, offer: Option<&Rc<Offer<Self::Protocol>>>);
fn loc_unset(seat: &Rc<WlSeatGlobal>); fn loc_unset(seat: &Rc<WlSeatGlobal>);
} }
impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> { impl<T: DataControlProtocol> DataControlLocation for ClipboardCore<T> {
type Ipc = T; type Protocol = T;
const LOCATION: TransferLocation = TransferLocation::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::Protocol>) -> &DeviceData<Offer<Self::Protocol>> {
&dd.data().clipboard_data &dd.data().clipboard_data
} }
fn loc_send_selection(dd: &Device<Self::Ipc>, offer: Option<&Rc<Offer<Self::Ipc>>>) { fn loc_send_selection(dd: &Device<Self::Protocol>, offer: Option<&Rc<Offer<Self::Protocol>>>) {
dd.send_selection(offer) dd.send_selection(offer)
} }
@ -155,15 +155,15 @@ impl<T: DataControlIpc> DataControlLocationIpc for ClipboardCore<T> {
} }
} }
impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<T> { impl<T: DataControlProtocol> DataControlLocation for PrimarySelectionCore<T> {
type Ipc = T; type Protocol = T;
const LOCATION: TransferLocation = TransferLocation::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::Protocol>) -> &DeviceData<Offer<Self::Protocol>> {
&dd.data().primary_selection_data &dd.data().primary_selection_data
} }
fn loc_send_selection(dd: &Device<Self::Ipc>, offer: Option<&Rc<Offer<Self::Ipc>>>) { fn loc_send_selection(dd: &Device<Self::Protocol>, offer: Option<&Rc<Offer<Self::Protocol>>>) {
dd.send_primary_selection(offer) dd.send_primary_selection(offer)
} }
@ -172,10 +172,10 @@ impl<T: DataControlIpc> DataControlLocationIpc for PrimarySelectionCore<T> {
} }
} }
impl<T: DataControlLocationIpc> TransferVtable for DataControlIpcImpl<T> { impl<T: DataControlLocation> TransferVtable for DataControlProtocolImpl<T> {
type Device = Device<T::Ipc>; type Device = Device<T::Protocol>;
type Source = Source<T::Ipc>; type Source = Source<T::Protocol>;
type Offer = Offer<T::Ipc>; type Offer = Offer<T::Protocol>;
fn get_device_data(dd: &Self::Device) -> &DeviceData<Self::Offer> { fn get_device_data(dd: &Self::Device) -> &DeviceData<Self::Offer> {
T::loc_get_device_data(dd) T::loc_get_device_data(dd)
@ -197,7 +197,7 @@ impl<T: DataControlLocationIpc> TransferVtable for DataControlIpcImpl<T> {
data: offer_data, data: offer_data,
location: T::LOCATION, location: T::LOCATION,
}; };
let rc = T::Ipc::create_offer(data.client.new_id()?, offer); let rc = T::Protocol::create_offer(data.client.new_id()?, offer);
data.client.add_server_obj(&rc); data.client.add_server_obj(&rc);
Ok(rc) Ok(rc)
} }
@ -251,7 +251,7 @@ impl<T: DataControlSource> DynDataSource for T {
} }
impl<T: DataControlOffer> DataOffer for T { impl<T: DataControlOffer> DataOffer for T {
type Device = Device<T::Ipc>; type Device = Device<T::Protocol>;
fn offer_data(&self) -> &OfferData<Self::Device> { fn offer_data(&self) -> &OfferData<Self::Device> {
&self.data().data &self.data().data
@ -273,8 +273,8 @@ impl<T: DataControlOffer> DynDataOffer for T {
fn cancel(&self) { fn cancel(&self) {
match self.data().location { match self.data().location {
TransferLocation::Clipboard => cancel_offer::<Clipboard<T::Ipc>>(self), TransferLocation::Clipboard => cancel_offer::<Clipboard<T::Protocol>>(self),
TransferLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Ipc>>(self), TransferLocation::PrimarySelection => cancel_offer::<PrimarySelection<T::Protocol>>(self),
} }
} }
@ -311,16 +311,16 @@ pub mod logic {
}; };
pub fn data_device_break_loops<D: DataControlDevice>(d: &D) { pub fn data_device_break_loops<D: DataControlDevice>(d: &D) {
break_device_loops::<Clipboard<D::Ipc>>(d); break_device_loops::<Clipboard<D::Protocol>>(d);
break_device_loops::<PrimarySelection<D::Ipc>>(d); break_device_loops::<PrimarySelection<D::Protocol>>(d);
d.data().seat.remove_data_control_device(d); d.data().seat.remove_data_control_device(d);
} }
fn use_source<D: DataControlDevice>( fn use_source<D: DataControlDevice>(
device: &D, device: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Protocol>>,
location: TransferLocation, location: TransferLocation,
) -> Result<Option<Rc<Source<D::Ipc>>>, DataControlError> { ) -> Result<Option<Rc<Source<D::Protocol>>>, 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)?;
if src.data().used.replace(true) { if src.data().used.replace(true) {
@ -335,7 +335,7 @@ pub mod logic {
pub fn device_set_selection<D: DataControlDevice>( pub fn device_set_selection<D: DataControlDevice>(
d: &D, d: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Protocol>>,
) -> Result<(), DataControlError> { ) -> Result<(), DataControlError> {
let src = use_source(d, source, TransferLocation::Clipboard)?; let src = use_source(d, source, TransferLocation::Clipboard)?;
d.data().seat.set_selection(src)?; d.data().seat.set_selection(src)?;
@ -343,8 +343,8 @@ pub mod logic {
} }
pub fn device_destroy<D: DataControlDevice>(d: &D) -> Result<(), DataControlError> { pub fn device_destroy<D: DataControlDevice>(d: &D) -> Result<(), DataControlError> {
destroy_data_device::<Clipboard<D::Ipc>>(d); destroy_data_device::<Clipboard<D::Protocol>>(d);
destroy_data_device::<PrimarySelection<D::Ipc>>(d); destroy_data_device::<PrimarySelection<D::Protocol>>(d);
d.data().seat.remove_data_control_device(d); d.data().seat.remove_data_control_device(d);
d.data().client.remove_obj(d)?; d.data().client.remove_obj(d)?;
Ok(()) Ok(())
@ -352,7 +352,7 @@ pub mod logic {
pub fn device_set_primary_selection<D: DataControlDevice>( pub fn device_set_primary_selection<D: DataControlDevice>(
d: &D, d: &D,
source: Option<SourceId<D::Ipc>>, source: Option<SourceId<D::Protocol>>,
) -> Result<(), DataControlError> { ) -> Result<(), DataControlError> {
let src = use_source(d, source, TransferLocation::PrimarySelection)?; let src = use_source(d, source, TransferLocation::PrimarySelection)?;
d.data().seat.set_primary_selection(src)?; d.data().seat.set_primary_selection(src)?;
@ -366,14 +366,14 @@ pub mod logic {
if s.data().used.get() { if s.data().used.get() {
return Err(DataControlError::AlreadyUsed); return Err(DataControlError::AlreadyUsed);
} }
add_data_source_mime_type::<Clipboard<S::Ipc>>(s, mime_type); add_data_source_mime_type::<Clipboard<S::Protocol>>(s, mime_type);
Ok(()) Ok(())
} }
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() {
TransferLocation::Clipboard => destroy_data_source::<Clipboard<S::Ipc>>(s), TransferLocation::Clipboard => destroy_data_source::<Clipboard<S::Protocol>>(s),
TransferLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Ipc>>(s), TransferLocation::PrimarySelection => destroy_data_source::<PrimarySelection<S::Protocol>>(s),
} }
s.data().data.client.remove_obj(s)?; s.data().data.client.remove_obj(s)?;
Ok(()) Ok(())
@ -381,24 +381,24 @@ 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() {
TransferLocation::Clipboard => break_source_loops::<Clipboard<S::Ipc>>(s), TransferLocation::Clipboard => break_source_loops::<Clipboard<S::Protocol>>(s),
TransferLocation::PrimarySelection => break_source_loops::<PrimarySelection<S::Ipc>>(s), TransferLocation::PrimarySelection => break_source_loops::<PrimarySelection<S::Protocol>>(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 {
TransferLocation::Clipboard => receive_data_offer::<Clipboard<O::Ipc>>(o, mime_type, fd), TransferLocation::Clipboard => receive_data_offer::<Clipboard<O::Protocol>>(o, mime_type, fd),
TransferLocation::PrimarySelection => { TransferLocation::PrimarySelection => {
receive_data_offer::<PrimarySelection<O::Ipc>>(o, mime_type, fd) receive_data_offer::<PrimarySelection<O::Protocol>>(o, mime_type, fd)
} }
} }
} }
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 {
TransferLocation::Clipboard => destroy_data_offer::<Clipboard<O::Ipc>>(o), TransferLocation::Clipboard => destroy_data_offer::<Clipboard<O::Protocol>>(o),
TransferLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Ipc>>(o), TransferLocation::PrimarySelection => destroy_data_offer::<PrimarySelection<O::Protocol>>(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 {
TransferLocation::Clipboard => break_offer_loops::<Clipboard<O::Ipc>>(o), TransferLocation::Clipboard => break_offer_loops::<Clipboard<O::Protocol>>(o),
TransferLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Ipc>>(o), TransferLocation::PrimarySelection => break_offer_loops::<PrimarySelection<O::Protocol>>(o),
} }
} }

View file

@ -4,7 +4,7 @@ use {
ifs::{ ifs::{
data_transfer::data_control::{ data_transfer::data_control::{
private::{ private::{
DataControlDevice, DataControlDeviceData, DataControlIpc, DataControlOfferData, DataControlDevice, DataControlDeviceData, DataControlProtocol, DataControlOfferData,
logic::{self, DataControlError}, logic::{self, DataControlError},
}, },
zwlr_data_control_offer_v1::ZwlrDataControlOfferV1, zwlr_data_control_offer_v1::ZwlrDataControlOfferV1,
@ -27,7 +27,7 @@ pub const PRIMARY_SELECTION_SINCE: Version = Version(2);
pub struct ZwlrDataControlDeviceV1 { pub struct ZwlrDataControlDeviceV1 {
pub id: ZwlrDataControlDeviceV1Id, pub id: ZwlrDataControlDeviceV1Id,
pub data: DataControlDeviceData<WlrDataControlIpc>, pub data: DataControlDeviceData<WlrDataControlProtocol>,
pub tracker: Tracker<Self>, pub tracker: Tracker<Self>,
} }
@ -103,9 +103,9 @@ impl ZwlrDataControlDeviceV1RequestHandler for ZwlrDataControlDeviceV1 {
} }
} }
pub struct WlrDataControlIpc; pub struct WlrDataControlProtocol;
impl DataControlIpc for WlrDataControlIpc { impl DataControlProtocol for WlrDataControlProtocol {
const PRIMARY_SELECTION_SINCE: Version = PRIMARY_SELECTION_SINCE; const PRIMARY_SELECTION_SINCE: Version = PRIMARY_SELECTION_SINCE;
type Device = ZwlrDataControlDeviceV1; type Device = ZwlrDataControlDeviceV1;
type OfferId = ZwlrDataControlOfferV1Id; type OfferId = ZwlrDataControlOfferV1Id;
@ -125,21 +125,21 @@ impl DataControlIpc for WlrDataControlIpc {
} }
impl DataControlDevice for ZwlrDataControlDeviceV1 { impl DataControlDevice for ZwlrDataControlDeviceV1 {
type Ipc = WlrDataControlIpc; type Protocol = WlrDataControlProtocol;
fn data(&self) -> &DataControlDeviceData<Self::Ipc> { fn data(&self) -> &DataControlDeviceData<Self::Protocol> {
&self.data &self.data
} }
fn send_data_offer(&self, offer: &Rc<<Self::Ipc as DataControlIpc>::Offer>) { fn send_data_offer(&self, offer: &Rc<<Self::Protocol as DataControlProtocol>::Offer>) {
self.send_data_offer(offer) self.send_data_offer(offer)
} }
fn send_selection(&self, offer: Option<&Rc<<Self::Ipc as DataControlIpc>::Offer>>) { fn send_selection(&self, offer: Option<&Rc<<Self::Protocol as DataControlProtocol>::Offer>>) {
self.send_selection(offer) self.send_selection(offer)
} }
fn send_primary_selection(&self, offer: Option<&Rc<<Self::Ipc as DataControlIpc>::Offer>>) { fn send_primary_selection(&self, offer: Option<&Rc<<Self::Protocol as DataControlProtocol>::Offer>>) {
self.send_primary_selection(offer) self.send_primary_selection(offer)
} }
} }

View file

@ -5,7 +5,7 @@ use {
DataControlOffer, DataControlOfferData, DataControlOffer, DataControlOfferData,
logic::{self, DataControlError}, logic::{self, DataControlError},
}, },
zwlr_data_control_device_v1::WlrDataControlIpc, zwlr_data_control_device_v1::WlrDataControlProtocol,
}, },
leaks::Tracker, leaks::Tracker,
object::Object, object::Object,
@ -17,14 +17,14 @@ use {
pub struct ZwlrDataControlOfferV1 { pub struct ZwlrDataControlOfferV1 {
pub id: ZwlrDataControlOfferV1Id, pub id: ZwlrDataControlOfferV1Id,
pub data: DataControlOfferData<WlrDataControlIpc>, pub data: DataControlOfferData<WlrDataControlProtocol>,
pub tracker: Tracker<Self>, pub tracker: Tracker<Self>,
} }
impl DataControlOffer for ZwlrDataControlOfferV1 { impl DataControlOffer for ZwlrDataControlOfferV1 {
type Ipc = WlrDataControlIpc; type Protocol = WlrDataControlProtocol;
fn data(&self) -> &DataControlOfferData<Self::Ipc> { fn data(&self) -> &DataControlOfferData<Self::Protocol> {
&self.data &self.data
} }

View file

@ -8,7 +8,7 @@ use {
DataControlSource, DataControlSourceData, DataControlSource, DataControlSourceData,
logic::{self, DataControlError}, logic::{self, DataControlError},
}, },
zwlr_data_control_device_v1::WlrDataControlIpc, zwlr_data_control_device_v1::WlrDataControlProtocol,
}, },
}, },
leaks::Tracker, leaks::Tracker,
@ -27,7 +27,7 @@ pub struct ZwlrDataControlSourceV1 {
} }
impl DataControlSource for ZwlrDataControlSourceV1 { impl DataControlSource for ZwlrDataControlSourceV1 {
type Ipc = WlrDataControlIpc; type Protocol = WlrDataControlProtocol;
fn data(&self) -> &DataControlSourceData { fn data(&self) -> &DataControlSourceData {
&self.data &self.data