xwayland: implement copy/paste
This commit is contained in:
parent
c8068ee2e7
commit
d6fabcb2b5
22 changed files with 1565 additions and 380 deletions
|
|
@ -6,8 +6,10 @@ use {
|
|||
ifs::{
|
||||
ipc,
|
||||
ipc::{
|
||||
wl_data_device::WlDataDevice,
|
||||
zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1,
|
||||
wl_data_device::{ClipboardIpc, WlDataDevice},
|
||||
zwp_primary_selection_device_v1::{
|
||||
PrimarySelectionIpc, ZwpPrimarySelectionDeviceV1,
|
||||
},
|
||||
},
|
||||
wl_seat::{
|
||||
wl_keyboard::{self, WlKeyboard},
|
||||
|
|
@ -21,7 +23,6 @@ use {
|
|||
},
|
||||
wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
|
||||
},
|
||||
object::ObjectId,
|
||||
tree::{FloatNode, Node, ToplevelNode},
|
||||
utils::{bitflags::BitflagsExt, clonecell::CloneCell, smallmap::SmallMap},
|
||||
wire::WlDataOfferId,
|
||||
|
|
@ -328,7 +329,7 @@ impl WlSeatGlobal {
|
|||
self.kb_owner.set_kb_node(self, node);
|
||||
}
|
||||
|
||||
fn offer_selection<T: ipc::Vtable>(
|
||||
fn offer_selection<T: ipc::IpcVtable>(
|
||||
&self,
|
||||
field: &CloneCell<Option<Rc<T::Source>>>,
|
||||
client: &Rc<Client>,
|
||||
|
|
@ -336,7 +337,7 @@ impl WlSeatGlobal {
|
|||
match field.get() {
|
||||
Some(sel) => ipc::offer_source_to::<T>(&sel, client),
|
||||
None => T::for_each_device(self, client.id, |dd| {
|
||||
T::send_selection(dd, ObjectId::NONE.into());
|
||||
T::send_selection(dd, None);
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
@ -398,7 +399,7 @@ impl WlSeatGlobal {
|
|||
let dd = self.data_devices.borrow_mut();
|
||||
if let Some(dd) = dd.get(&client) {
|
||||
for dd in dd.values() {
|
||||
if dd.manager.version >= ver {
|
||||
if dd.version >= ver {
|
||||
f(dd);
|
||||
}
|
||||
}
|
||||
|
|
@ -412,7 +413,7 @@ impl WlSeatGlobal {
|
|||
let dd = self.primary_selection_devices.borrow_mut();
|
||||
if let Some(dd) = dd.get(&client) {
|
||||
for dd in dd.values() {
|
||||
if dd.manager.version >= ver {
|
||||
if dd.version >= ver {
|
||||
f(dd);
|
||||
}
|
||||
}
|
||||
|
|
@ -624,11 +625,8 @@ impl WlSeatGlobal {
|
|||
});
|
||||
|
||||
if self.keyboard_node.get().node_client_id() != Some(surface.client.id) {
|
||||
self.offer_selection::<WlDataDevice>(&self.selection, &surface.client);
|
||||
self.offer_selection::<ZwpPrimarySelectionDeviceV1>(
|
||||
&self.primary_selection,
|
||||
&surface.client,
|
||||
);
|
||||
self.offer_selection::<ClipboardIpc>(&self.selection, &surface.client);
|
||||
self.offer_selection::<PrimarySelectionIpc>(&self.primary_selection, &surface.client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -692,7 +690,7 @@ impl WlSeatGlobal {
|
|||
serial: u32,
|
||||
) {
|
||||
if let Some(src) = &dnd.src {
|
||||
ipc::offer_source_to::<WlDataDevice>(src, &surface.client);
|
||||
ipc::offer_source_to::<ClipboardIpc>(src, &surface.client);
|
||||
src.for_each_data_offer(|offer| {
|
||||
offer.device.send_enter(surface.id, x, y, offer.id, serial);
|
||||
offer.send_source_actions();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use {
|
|||
fixed::Fixed,
|
||||
ifs::{
|
||||
ipc,
|
||||
ipc::{wl_data_device::WlDataDevice, wl_data_source::WlDataSource},
|
||||
ipc::{wl_data_device::ClipboardIpc, wl_data_source::WlDataSource},
|
||||
wl_seat::{wl_pointer::PendingScroll, Dnd, DroppedDnd, WlSeatError, WlSeatGlobal},
|
||||
wl_surface::WlSurface,
|
||||
},
|
||||
|
|
@ -341,7 +341,7 @@ impl PointerOwner for GrabPointerOwner {
|
|||
icon.dnd_icons.insert(seat.id(), seat.clone());
|
||||
}
|
||||
if let Some(new) = &src {
|
||||
ipc::attach_seat::<WlDataDevice>(new, seat, ipc::Role::Dnd)?;
|
||||
ipc::attach_seat::<ClipboardIpc>(new, seat, ipc::Role::Dnd)?;
|
||||
}
|
||||
*seat.dropped_dnd.borrow_mut() = None;
|
||||
let pointer_owner = Rc::new(DndPointerOwner {
|
||||
|
|
@ -418,7 +418,7 @@ impl PointerOwner for DndPointerOwner {
|
|||
target.node_seat_state().remove_dnd_target(seat);
|
||||
if !should_drop {
|
||||
if let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat::<WlDataDevice>(src);
|
||||
ipc::detach_seat::<ClipboardIpc>(src);
|
||||
}
|
||||
}
|
||||
if let Some(icon) = self.icon.get() {
|
||||
|
|
@ -492,7 +492,7 @@ impl PointerOwner for DndPointerOwner {
|
|||
target.node_on_dnd_leave(&self.dnd);
|
||||
target.node_seat_state().remove_dnd_target(seat);
|
||||
if let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat::<WlDataDevice>(src);
|
||||
ipc::detach_seat::<ClipboardIpc>(src);
|
||||
}
|
||||
if let Some(icon) = self.icon.get() {
|
||||
icon.dnd_icons.remove(&seat.id());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue