From 6f913d5f69ac220c98f67480b482e5eb8ae46d40 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Fri, 29 May 2026 18:09:44 -0400 Subject: [PATCH] ifs: rename data control protocol traits --- .../ext_data_control_device_v1.rs | 18 +-- .../data_control/ext_data_control_offer_v1.rs | 8 +- .../ext_data_control_source_v1.rs | 4 +- src/ifs/data_transfer/data_control/private.rs | 126 +++++++++--------- .../zwlr_data_control_device_v1.rs | 18 +-- .../zwlr_data_control_offer_v1.rs | 8 +- .../zwlr_data_control_source_v1.rs | 4 +- 7 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/ifs/data_transfer/data_control/ext_data_control_device_v1.rs b/src/ifs/data_transfer/data_control/ext_data_control_device_v1.rs index bdb29e12..3c5d31b1 100644 --- a/src/ifs/data_transfer/data_control/ext_data_control_device_v1.rs +++ b/src/ifs/data_transfer/data_control/ext_data_control_device_v1.rs @@ -6,7 +6,7 @@ use { ext_data_control_offer_v1::ExtDataControlOfferV1, ext_data_control_source_v1::ExtDataControlSourceV1, private::{ - DataControlDevice, DataControlDeviceData, DataControlIpc, DataControlOfferData, + DataControlDevice, DataControlDeviceData, DataControlProtocol, DataControlOfferData, logic::{self, DataControlError}, }, }, @@ -25,7 +25,7 @@ use { pub struct ExtDataControlDeviceV1 { pub id: ExtDataControlDeviceV1Id, - pub data: DataControlDeviceData, + pub data: DataControlDeviceData, pub tracker: Tracker, } @@ -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); type Device = ExtDataControlDeviceV1; type OfferId = ExtDataControlOfferV1Id; @@ -119,21 +119,21 @@ impl DataControlIpc for ExtDataControlIpc { } impl DataControlDevice for ExtDataControlDeviceV1 { - type Ipc = ExtDataControlIpc; + type Protocol = ExtDataControlProtocol; - fn data(&self) -> &DataControlDeviceData { + fn data(&self) -> &DataControlDeviceData { &self.data } - fn send_data_offer(&self, offer: &Rc<::Offer>) { + fn send_data_offer(&self, offer: &Rc<::Offer>) { self.send_data_offer(offer) } - fn send_selection(&self, offer: Option<&Rc<::Offer>>) { + fn send_selection(&self, offer: Option<&Rc<::Offer>>) { self.send_selection(offer) } - fn send_primary_selection(&self, offer: Option<&Rc<::Offer>>) { + fn send_primary_selection(&self, offer: Option<&Rc<::Offer>>) { self.send_primary_selection(offer) } } diff --git a/src/ifs/data_transfer/data_control/ext_data_control_offer_v1.rs b/src/ifs/data_transfer/data_control/ext_data_control_offer_v1.rs index 66b555bb..1d83ac93 100644 --- a/src/ifs/data_transfer/data_control/ext_data_control_offer_v1.rs +++ b/src/ifs/data_transfer/data_control/ext_data_control_offer_v1.rs @@ -1,7 +1,7 @@ use { crate::{ ifs::data_transfer::data_control::{ - ext_data_control_device_v1::ExtDataControlIpc, + ext_data_control_device_v1::ExtDataControlProtocol, private::{ DataControlOffer, DataControlOfferData, logic::{self, DataControlError}, @@ -17,14 +17,14 @@ use { pub struct ExtDataControlOfferV1 { pub id: ExtDataControlOfferV1Id, - pub data: DataControlOfferData, + pub data: DataControlOfferData, pub tracker: Tracker, } impl DataControlOffer for ExtDataControlOfferV1 { - type Ipc = ExtDataControlIpc; + type Protocol = ExtDataControlProtocol; - fn data(&self) -> &DataControlOfferData { + fn data(&self) -> &DataControlOfferData { &self.data } diff --git a/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs b/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs index acea0af5..13c7e468 100644 --- a/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs +++ b/src/ifs/data_transfer/data_control/ext_data_control_source_v1.rs @@ -4,7 +4,7 @@ use { ifs::data_transfer::{ TransferLocation, SourceData, data_control::{ - ext_data_control_device_v1::ExtDataControlIpc, + ext_data_control_device_v1::ExtDataControlProtocol, private::{ DataControlSource, DataControlSourceData, logic::{self, DataControlError}, @@ -27,7 +27,7 @@ pub struct ExtDataControlSourceV1 { } impl DataControlSource for ExtDataControlSourceV1 { - type Ipc = ExtDataControlIpc; + type Protocol = ExtDataControlProtocol; fn data(&self) -> &DataControlSourceData { &self.data diff --git a/src/ifs/data_transfer/data_control/private.rs b/src/ifs/data_transfer/data_control/private.rs index f8be1b53..0b475dd1 100644 --- a/src/ifs/data_transfer/data_control/private.rs +++ b/src/ifs/data_transfer/data_control/private.rs @@ -19,26 +19,26 @@ use { struct ClipboardCore(PhantomData); struct PrimarySelectionCore(PhantomData); -struct DataControlIpcImpl(PhantomData); +struct DataControlProtocolImpl(PhantomData); -type Device = ::Device; -type Offer = ::Offer; -type Source = ::Source; -type SourceId = ::SourceId; +type Device = ::Device; +type Offer = ::Offer; +type Source = ::Source; +type SourceId = ::SourceId; -pub trait DataControlIpc: Sized + 'static { +pub trait DataControlProtocol: Sized + 'static { const PRIMARY_SELECTION_SINCE: Version; - type Device: DataControlDevice; + type Device: DataControlDevice; type OfferId: From; - type Offer: DataControlOffer; + type Offer: DataControlOffer; type SourceId: WaylandObjectLookup; - type Source: DataControlSource; + type Source: DataControlSource; fn create_offer(id: Self::OfferId, data: DataControlOfferData) -> Rc; } -pub struct DataControlDeviceData { +pub struct DataControlDeviceData { pub data_control_device_id: DataControlDeviceId, pub client: Rc, pub version: Version, @@ -48,18 +48,18 @@ pub struct DataControlDeviceData { } pub trait DataControlDevice: WaylandObject { - type Ipc: DataControlIpc; + type Protocol: DataControlProtocol; - fn data(&self) -> &DataControlDeviceData; + fn data(&self) -> &DataControlDeviceData; - fn send_data_offer(&self, offer: &Rc>); + fn send_data_offer(&self, offer: &Rc>); - fn send_selection(&self, offer: Option<&Rc>>); + fn send_selection(&self, offer: Option<&Rc>>); - fn send_primary_selection(&self, offer: Option<&Rc>>); + fn send_primary_selection(&self, offer: Option<&Rc>>); } -pub struct DataControlOfferData { +pub struct DataControlOfferData { pub offer_id: DataOfferId, pub client: Rc, pub device: Rc, @@ -68,9 +68,9 @@ pub struct DataControlOfferData { } pub trait DataControlOffer: WaylandObject { - type Ipc: DataControlIpc; + type Protocol: DataControlProtocol; - fn data(&self) -> &DataControlOfferData; + fn data(&self) -> &DataControlOfferData; fn send_offer(&self, mime_type: &str); } @@ -83,7 +83,7 @@ pub struct DataControlSourceData { } pub trait DataControlSource: WaylandObject { - type Ipc: DataControlIpc; + type Protocol: DataControlProtocol; fn data(&self) -> &DataControlSourceData; @@ -103,20 +103,20 @@ impl DynDataControlDevice for T { source: Option>, ) { if location == TransferLocation::PrimarySelection - && self.data().version < T::Ipc::PRIMARY_SELECTION_SINCE + && self.data().version < T::Protocol::PRIMARY_SELECTION_SINCE { return; } match location { TransferLocation::Clipboard => match source { Some(src) => { - offer_source_to_data_control_device::>(src, &self); + offer_source_to_data_control_device::>(src, &self); } _ => self.send_selection(None), }, TransferLocation::PrimarySelection => match source { Some(src) => { - offer_source_to_data_control_device::>(src, &self); + offer_source_to_data_control_device::>(src, &self); } _ => self.send_primary_selection(None), }, @@ -124,29 +124,29 @@ impl DynDataControlDevice for T { } } -type Clipboard = DataControlIpcImpl>; -type PrimarySelection = DataControlIpcImpl>; +type Clipboard = DataControlProtocolImpl>; +type PrimarySelection = DataControlProtocolImpl>; -pub trait DataControlLocationIpc { - type Ipc: DataControlIpc; +pub trait DataControlLocation { + type Protocol: DataControlProtocol; const LOCATION: TransferLocation; - fn loc_get_device_data(dd: &Device) -> &DeviceData>; + fn loc_get_device_data(dd: &Device) -> &DeviceData>; - fn loc_send_selection(dd: &Device, offer: Option<&Rc>>); + fn loc_send_selection(dd: &Device, offer: Option<&Rc>>); fn loc_unset(seat: &Rc); } -impl DataControlLocationIpc for ClipboardCore { - type Ipc = T; +impl DataControlLocation for ClipboardCore { + type Protocol = T; const LOCATION: TransferLocation = TransferLocation::Clipboard; - fn loc_get_device_data(dd: &Device) -> &DeviceData> { + fn loc_get_device_data(dd: &Device) -> &DeviceData> { &dd.data().clipboard_data } - fn loc_send_selection(dd: &Device, offer: Option<&Rc>>) { + fn loc_send_selection(dd: &Device, offer: Option<&Rc>>) { dd.send_selection(offer) } @@ -155,15 +155,15 @@ impl DataControlLocationIpc for ClipboardCore { } } -impl DataControlLocationIpc for PrimarySelectionCore { - type Ipc = T; +impl DataControlLocation for PrimarySelectionCore { + type Protocol = T; const LOCATION: TransferLocation = TransferLocation::PrimarySelection; - fn loc_get_device_data(dd: &Device) -> &DeviceData> { + fn loc_get_device_data(dd: &Device) -> &DeviceData> { &dd.data().primary_selection_data } - fn loc_send_selection(dd: &Device, offer: Option<&Rc>>) { + fn loc_send_selection(dd: &Device, offer: Option<&Rc>>) { dd.send_primary_selection(offer) } @@ -172,10 +172,10 @@ impl DataControlLocationIpc for PrimarySelectionCore { } } -impl TransferVtable for DataControlIpcImpl { - type Device = Device; - type Source = Source; - type Offer = Offer; +impl TransferVtable for DataControlProtocolImpl { + type Device = Device; + type Source = Source; + type Offer = Offer; fn get_device_data(dd: &Self::Device) -> &DeviceData { T::loc_get_device_data(dd) @@ -197,7 +197,7 @@ impl TransferVtable for DataControlIpcImpl { data: offer_data, 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); Ok(rc) } @@ -251,7 +251,7 @@ impl DynDataSource for T { } impl DataOffer for T { - type Device = Device; + type Device = Device; fn offer_data(&self) -> &OfferData { &self.data().data @@ -273,8 +273,8 @@ impl DynDataOffer for T { fn cancel(&self) { match self.data().location { - TransferLocation::Clipboard => cancel_offer::>(self), - TransferLocation::PrimarySelection => cancel_offer::>(self), + TransferLocation::Clipboard => cancel_offer::>(self), + TransferLocation::PrimarySelection => cancel_offer::>(self), } } @@ -311,16 +311,16 @@ pub mod logic { }; pub fn data_device_break_loops(d: &D) { - break_device_loops::>(d); - break_device_loops::>(d); + break_device_loops::>(d); + break_device_loops::>(d); d.data().seat.remove_data_control_device(d); } fn use_source( device: &D, - source: Option>, + source: Option>, location: TransferLocation, - ) -> Result>>, DataControlError> { + ) -> Result>>, DataControlError> { if let Some(source) = source { let src = device.data().client.lookup(source)?; if src.data().used.replace(true) { @@ -335,7 +335,7 @@ pub mod logic { pub fn device_set_selection( d: &D, - source: Option>, + source: Option>, ) -> Result<(), DataControlError> { let src = use_source(d, source, TransferLocation::Clipboard)?; d.data().seat.set_selection(src)?; @@ -343,8 +343,8 @@ pub mod logic { } pub fn device_destroy(d: &D) -> Result<(), DataControlError> { - destroy_data_device::>(d); - destroy_data_device::>(d); + destroy_data_device::>(d); + destroy_data_device::>(d); d.data().seat.remove_data_control_device(d); d.data().client.remove_obj(d)?; Ok(()) @@ -352,7 +352,7 @@ pub mod logic { pub fn device_set_primary_selection( d: &D, - source: Option>, + source: Option>, ) -> Result<(), DataControlError> { let src = use_source(d, source, TransferLocation::PrimarySelection)?; d.data().seat.set_primary_selection(src)?; @@ -366,14 +366,14 @@ pub mod logic { if s.data().used.get() { return Err(DataControlError::AlreadyUsed); } - add_data_source_mime_type::>(s, mime_type); + add_data_source_mime_type::>(s, mime_type); Ok(()) } pub fn data_source_destroy(s: &S) -> Result<(), DataControlError> { match s.data().location.get() { - TransferLocation::Clipboard => destroy_data_source::>(s), - TransferLocation::PrimarySelection => destroy_data_source::>(s), + TransferLocation::Clipboard => destroy_data_source::>(s), + TransferLocation::PrimarySelection => destroy_data_source::>(s), } s.data().data.client.remove_obj(s)?; Ok(()) @@ -381,24 +381,24 @@ pub mod logic { pub fn data_source_break_loops(s: &S) { match s.data().location.get() { - TransferLocation::Clipboard => break_source_loops::>(s), - TransferLocation::PrimarySelection => break_source_loops::>(s), + TransferLocation::Clipboard => break_source_loops::>(s), + TransferLocation::PrimarySelection => break_source_loops::>(s), } } pub fn data_offer_receive(o: &O, mime_type: &str, fd: Rc) { match o.data().location { - TransferLocation::Clipboard => receive_data_offer::>(o, mime_type, fd), + TransferLocation::Clipboard => receive_data_offer::>(o, mime_type, fd), TransferLocation::PrimarySelection => { - receive_data_offer::>(o, mime_type, fd) + receive_data_offer::>(o, mime_type, fd) } } } pub fn data_offer_destroy(o: &O) -> Result<(), DataControlError> { match o.data().location { - TransferLocation::Clipboard => destroy_data_offer::>(o), - TransferLocation::PrimarySelection => destroy_data_offer::>(o), + TransferLocation::Clipboard => destroy_data_offer::>(o), + TransferLocation::PrimarySelection => destroy_data_offer::>(o), } o.data().client.remove_obj(o)?; Ok(()) @@ -406,8 +406,8 @@ pub mod logic { pub fn data_offer_break_loops(o: &O) { match o.data().location { - TransferLocation::Clipboard => break_offer_loops::>(o), - TransferLocation::PrimarySelection => break_offer_loops::>(o), + TransferLocation::Clipboard => break_offer_loops::>(o), + TransferLocation::PrimarySelection => break_offer_loops::>(o), } } diff --git a/src/ifs/data_transfer/data_control/zwlr_data_control_device_v1.rs b/src/ifs/data_transfer/data_control/zwlr_data_control_device_v1.rs index f41182af..db2e8a96 100644 --- a/src/ifs/data_transfer/data_control/zwlr_data_control_device_v1.rs +++ b/src/ifs/data_transfer/data_control/zwlr_data_control_device_v1.rs @@ -4,7 +4,7 @@ use { ifs::{ data_transfer::data_control::{ private::{ - DataControlDevice, DataControlDeviceData, DataControlIpc, DataControlOfferData, + DataControlDevice, DataControlDeviceData, DataControlProtocol, DataControlOfferData, logic::{self, DataControlError}, }, zwlr_data_control_offer_v1::ZwlrDataControlOfferV1, @@ -27,7 +27,7 @@ pub const PRIMARY_SELECTION_SINCE: Version = Version(2); pub struct ZwlrDataControlDeviceV1 { pub id: ZwlrDataControlDeviceV1Id, - pub data: DataControlDeviceData, + pub data: DataControlDeviceData, pub tracker: Tracker, } @@ -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; type Device = ZwlrDataControlDeviceV1; type OfferId = ZwlrDataControlOfferV1Id; @@ -125,21 +125,21 @@ impl DataControlIpc for WlrDataControlIpc { } impl DataControlDevice for ZwlrDataControlDeviceV1 { - type Ipc = WlrDataControlIpc; + type Protocol = WlrDataControlProtocol; - fn data(&self) -> &DataControlDeviceData { + fn data(&self) -> &DataControlDeviceData { &self.data } - fn send_data_offer(&self, offer: &Rc<::Offer>) { + fn send_data_offer(&self, offer: &Rc<::Offer>) { self.send_data_offer(offer) } - fn send_selection(&self, offer: Option<&Rc<::Offer>>) { + fn send_selection(&self, offer: Option<&Rc<::Offer>>) { self.send_selection(offer) } - fn send_primary_selection(&self, offer: Option<&Rc<::Offer>>) { + fn send_primary_selection(&self, offer: Option<&Rc<::Offer>>) { self.send_primary_selection(offer) } } diff --git a/src/ifs/data_transfer/data_control/zwlr_data_control_offer_v1.rs b/src/ifs/data_transfer/data_control/zwlr_data_control_offer_v1.rs index 898342ff..51457f14 100644 --- a/src/ifs/data_transfer/data_control/zwlr_data_control_offer_v1.rs +++ b/src/ifs/data_transfer/data_control/zwlr_data_control_offer_v1.rs @@ -5,7 +5,7 @@ use { DataControlOffer, DataControlOfferData, logic::{self, DataControlError}, }, - zwlr_data_control_device_v1::WlrDataControlIpc, + zwlr_data_control_device_v1::WlrDataControlProtocol, }, leaks::Tracker, object::Object, @@ -17,14 +17,14 @@ use { pub struct ZwlrDataControlOfferV1 { pub id: ZwlrDataControlOfferV1Id, - pub data: DataControlOfferData, + pub data: DataControlOfferData, pub tracker: Tracker, } impl DataControlOffer for ZwlrDataControlOfferV1 { - type Ipc = WlrDataControlIpc; + type Protocol = WlrDataControlProtocol; - fn data(&self) -> &DataControlOfferData { + fn data(&self) -> &DataControlOfferData { &self.data } diff --git a/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs b/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs index fc75fcaa..4a8b81c2 100644 --- a/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs +++ b/src/ifs/data_transfer/data_control/zwlr_data_control_source_v1.rs @@ -8,7 +8,7 @@ use { DataControlSource, DataControlSourceData, logic::{self, DataControlError}, }, - zwlr_data_control_device_v1::WlrDataControlIpc, + zwlr_data_control_device_v1::WlrDataControlProtocol, }, }, leaks::Tracker, @@ -27,7 +27,7 @@ pub struct ZwlrDataControlSourceV1 { } impl DataControlSource for ZwlrDataControlSourceV1 { - type Ipc = WlrDataControlIpc; + type Protocol = WlrDataControlProtocol; fn data(&self) -> &DataControlSourceData { &self.data