ipc: remove DynDataSource::offer_to_regular/wlr
This commit is contained in:
parent
487efafdf5
commit
40f7bc2542
8 changed files with 31 additions and 110 deletions
|
|
@ -4,12 +4,10 @@ use {
|
|||
ifs::{
|
||||
ipc::{
|
||||
add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source,
|
||||
detach_seat, offer_source_to_regular_client, offer_source_to_wlr_device,
|
||||
offer_source_to_x,
|
||||
detach_seat, offer_source_to_x,
|
||||
wl_data_device::ClipboardIpc,
|
||||
wl_data_device_manager::{DND_ALL, DND_NONE},
|
||||
x_data_device::{XClipboardIpc, XIpcDevice},
|
||||
zwlr_data_control_device_v1::{WlrClipboardIpc, ZwlrDataControlDeviceV1},
|
||||
DataSource, DynDataOffer, DynDataSource, SharedState, SourceData,
|
||||
OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED, SOURCE_STATE_CANCELLED,
|
||||
SOURCE_STATE_DROPPED,
|
||||
|
|
@ -55,16 +53,8 @@ impl DynDataSource for WlDataSource {
|
|||
WlDataSource::send_send(self, mime_type, fd);
|
||||
}
|
||||
|
||||
fn offer_to_regular_client(self: Rc<Self>, client: &Rc<Client>) {
|
||||
offer_source_to_regular_client::<ClipboardIpc, Self>(&self, client);
|
||||
}
|
||||
|
||||
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) {
|
||||
offer_source_to_x::<XClipboardIpc, Self>(&self, dd);
|
||||
}
|
||||
|
||||
fn offer_to_wlr_device(self: Rc<Self>, dd: &Rc<ZwlrDataControlDeviceV1>) {
|
||||
offer_source_to_wlr_device::<WlrClipboardIpc, Self>(&self, dd)
|
||||
offer_source_to_x::<XClipboardIpc>(self, dd);
|
||||
}
|
||||
|
||||
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,9 @@
|
|||
use {
|
||||
crate::{
|
||||
client::Client,
|
||||
ifs::{
|
||||
ipc::{
|
||||
cancel_offers, detach_seat, offer_source_to_regular_client,
|
||||
offer_source_to_wlr_device,
|
||||
wl_data_device::ClipboardIpc,
|
||||
x_data_device::XIpcDevice,
|
||||
zwlr_data_control_device_v1::{
|
||||
WlrClipboardIpc, WlrPrimarySelectionIpc, ZwlrDataControlDeviceV1,
|
||||
},
|
||||
zwp_primary_selection_device_v1::PrimarySelectionIpc,
|
||||
DataSource, DynDataSource, IpcLocation, SourceData,
|
||||
cancel_offers, detach_seat, x_data_device::XIpcDevice, DataSource, DynDataSource,
|
||||
IpcLocation, SourceData,
|
||||
},
|
||||
wl_seat::WlSeatGlobal,
|
||||
},
|
||||
|
|
@ -54,17 +46,6 @@ impl DynDataSource for XDataSource {
|
|||
});
|
||||
}
|
||||
|
||||
fn offer_to_regular_client(self: Rc<Self>, client: &Rc<Client>) {
|
||||
match self.location {
|
||||
IpcLocation::Clipboard => {
|
||||
offer_source_to_regular_client::<ClipboardIpc, Self>(&self, client)
|
||||
}
|
||||
IpcLocation::PrimarySelection => {
|
||||
offer_source_to_regular_client::<PrimarySelectionIpc, Self>(&self, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn offer_to_x(self: Rc<Self>, _dd: &Rc<XIpcDevice>) {
|
||||
self.cancel_unprivileged_offers();
|
||||
self.state.xwayland.queue.push(IpcSetSelection {
|
||||
|
|
@ -74,17 +55,6 @@ impl DynDataSource for XDataSource {
|
|||
});
|
||||
}
|
||||
|
||||
fn offer_to_wlr_device(self: Rc<Self>, dd: &Rc<ZwlrDataControlDeviceV1>) {
|
||||
match self.location {
|
||||
IpcLocation::Clipboard => {
|
||||
offer_source_to_wlr_device::<WlrClipboardIpc, Self>(&self, dd)
|
||||
}
|
||||
IpcLocation::PrimarySelection => {
|
||||
offer_source_to_wlr_device::<WlrPrimarySelectionIpc, Self>(&self, dd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
detach_seat(self, seat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ use {
|
|||
client::{Client, ClientCaps, ClientError, CAP_DATA_CONTROL_MANAGER},
|
||||
globals::{Global, GlobalName},
|
||||
ifs::ipc::{
|
||||
zwlr_data_control_device_v1::{ZwlrDataControlDeviceV1, PRIMARY_SELECTION_SINCE},
|
||||
offer_source_to_wlr_device,
|
||||
zwlr_data_control_device_v1::{
|
||||
WlrClipboardIpc, WlrPrimarySelectionIpc, ZwlrDataControlDeviceV1,
|
||||
PRIMARY_SELECTION_SINCE,
|
||||
},
|
||||
zwlr_data_control_source_v1::ZwlrDataControlSourceV1,
|
||||
},
|
||||
leaks::Tracker,
|
||||
|
|
@ -78,12 +82,12 @@ impl ZwlrDataControlManagerV1RequestHandler for ZwlrDataControlManagerV1 {
|
|||
seat.global.add_wlr_device(&dev);
|
||||
self.client.add_client_obj(&dev)?;
|
||||
match seat.global.get_selection() {
|
||||
Some(s) => s.offer_to_wlr_device(&dev),
|
||||
Some(s) => offer_source_to_wlr_device::<WlrClipboardIpc>(s, &dev),
|
||||
_ => dev.send_selection(None),
|
||||
}
|
||||
if self.version >= PRIMARY_SELECTION_SINCE {
|
||||
match seat.global.get_primary_selection() {
|
||||
Some(s) => s.offer_to_wlr_device(&dev),
|
||||
Some(s) => offer_source_to_wlr_device::<WlrPrimarySelectionIpc>(s, &dev),
|
||||
_ => dev.send_primary_selection(None),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,9 @@ use {
|
|||
ifs::{
|
||||
ipc::{
|
||||
add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source,
|
||||
detach_seat, offer_source_to_regular_client, offer_source_to_wlr_device,
|
||||
offer_source_to_x,
|
||||
wl_data_device::ClipboardIpc,
|
||||
detach_seat, offer_source_to_x,
|
||||
x_data_device::{XClipboardIpc, XIpcDevice, XPrimarySelectionIpc},
|
||||
zwlr_data_control_device_v1::{
|
||||
WlrClipboardIpc, WlrPrimarySelectionIpc, ZwlrDataControlDeviceV1,
|
||||
},
|
||||
zwp_primary_selection_device_v1::PrimarySelectionIpc,
|
||||
zwlr_data_control_device_v1::{WlrClipboardIpc, WlrPrimarySelectionIpc},
|
||||
DataSource, DynDataSource, IpcLocation, SourceData,
|
||||
},
|
||||
wl_seat::WlSeatGlobal,
|
||||
|
|
@ -49,34 +44,10 @@ impl DynDataSource for ZwlrDataControlSourceV1 {
|
|||
ZwlrDataControlSourceV1::send_send(&self, mime_type, fd);
|
||||
}
|
||||
|
||||
fn offer_to_regular_client(self: Rc<Self>, client: &Rc<Client>) {
|
||||
match self.location.get() {
|
||||
IpcLocation::Clipboard => {
|
||||
offer_source_to_regular_client::<ClipboardIpc, Self>(&self, client)
|
||||
}
|
||||
IpcLocation::PrimarySelection => {
|
||||
offer_source_to_regular_client::<PrimarySelectionIpc, Self>(&self, client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) {
|
||||
match self.location.get() {
|
||||
IpcLocation::Clipboard => offer_source_to_x::<XClipboardIpc, Self>(&self, dd),
|
||||
IpcLocation::PrimarySelection => {
|
||||
offer_source_to_x::<XPrimarySelectionIpc, Self>(&self, dd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn offer_to_wlr_device(self: Rc<Self>, dd: &Rc<ZwlrDataControlDeviceV1>) {
|
||||
match self.location.get() {
|
||||
IpcLocation::Clipboard => {
|
||||
offer_source_to_wlr_device::<WlrClipboardIpc, Self>(&self, dd)
|
||||
}
|
||||
IpcLocation::PrimarySelection => {
|
||||
offer_source_to_wlr_device::<WlrPrimarySelectionIpc, Self>(&self, dd)
|
||||
}
|
||||
IpcLocation::Clipboard => offer_source_to_x::<XClipboardIpc>(self, dd),
|
||||
IpcLocation::PrimarySelection => offer_source_to_x::<XPrimarySelectionIpc>(self, dd),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ use {
|
|||
ifs::{
|
||||
ipc::{
|
||||
add_data_source_mime_type, break_source_loops, cancel_offers, destroy_data_source,
|
||||
detach_seat, offer_source_to_regular_client, offer_source_to_wlr_device,
|
||||
offer_source_to_x,
|
||||
detach_seat, offer_source_to_x,
|
||||
x_data_device::{XIpcDevice, XPrimarySelectionIpc},
|
||||
zwlr_data_control_device_v1::{WlrPrimarySelectionIpc, ZwlrDataControlDeviceV1},
|
||||
zwp_primary_selection_device_v1::PrimarySelectionIpc,
|
||||
DataSource, DynDataSource, SourceData,
|
||||
},
|
||||
|
|
@ -44,16 +42,8 @@ impl DynDataSource for ZwpPrimarySelectionSourceV1 {
|
|||
ZwpPrimarySelectionSourceV1::send_send(self, mime_type, fd)
|
||||
}
|
||||
|
||||
fn offer_to_regular_client(self: Rc<Self>, client: &Rc<Client>) {
|
||||
offer_source_to_regular_client::<PrimarySelectionIpc, Self>(&self, client);
|
||||
}
|
||||
|
||||
fn offer_to_x(self: Rc<Self>, dd: &Rc<XIpcDevice>) {
|
||||
offer_source_to_x::<XPrimarySelectionIpc, Self>(&self, dd);
|
||||
}
|
||||
|
||||
fn offer_to_wlr_device(self: Rc<Self>, dd: &Rc<ZwlrDataControlDeviceV1>) {
|
||||
offer_source_to_wlr_device::<WlrPrimarySelectionIpc, Self>(&self, dd)
|
||||
offer_source_to_x::<XPrimarySelectionIpc>(self, dd);
|
||||
}
|
||||
|
||||
fn detach_seat(&self, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue