autocommit 2022-02-05 18:51:17 CET
This commit is contained in:
parent
5eb9186c54
commit
59ce74681a
2 changed files with 24 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ use crate::utils::smallmap::SmallMap;
|
|||
use crate::xkbcommon::{ModifierState, XKB_KEY_DOWN, XKB_KEY_UP};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::rc::Rc;
|
||||
use crate::ifs::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1Id;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct NodeSeatState {
|
||||
|
|
@ -253,6 +254,16 @@ impl WlSeatGlobal {
|
|||
sel.create_offer(&surface.client);
|
||||
}
|
||||
}
|
||||
match self.primary_selection.get() {
|
||||
None => {
|
||||
self.surface_primary_selection_device_event(0, &surface, |dd| {
|
||||
dd.selection(ZwpPrimarySelectionOfferV1Id::NONE)
|
||||
});
|
||||
}
|
||||
Some(sel) => {
|
||||
sel.create_offer(&surface.client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -359,6 +370,17 @@ impl WlSeatGlobal {
|
|||
client.flush();
|
||||
}
|
||||
|
||||
fn surface_primary_selection_device_event<F>(&self, ver: u32, surface: &WlSurface, mut f: F)
|
||||
where
|
||||
F: FnMut(&Rc<ZwpPrimarySelectionDeviceV1>) -> DynEventFormatter,
|
||||
{
|
||||
let client = &surface.client;
|
||||
self.for_each_primary_selection_device(ver, client.id, |p| {
|
||||
client.event(f(p));
|
||||
});
|
||||
client.flush();
|
||||
}
|
||||
|
||||
fn set_new_position(self: &Rc<Self>, x: Fixed, y: Fixed) {
|
||||
self.pos.set((x, y));
|
||||
self.handle_new_position(true);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
Ok(buffer_id)
|
||||
}
|
||||
|
||||
fn create(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CreateError> {
|
||||
fn create(self: &Rc<Self>, parser: MsgParser) -> Result<(), CreateError> {
|
||||
let req: Create = self.parent.client.parse(&**self, parser)?;
|
||||
if self.used.replace(true) {
|
||||
return Err(CreateError::AlreadyUsed);
|
||||
|
|
@ -154,7 +154,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn create_immed(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CreateImmedError> {
|
||||
fn create_immed(self: &Rc<Self>, parser: MsgParser) -> Result<(), CreateImmedError> {
|
||||
let req: CreateImmed = self.parent.client.parse(&**self, parser)?;
|
||||
if self.used.replace(true) {
|
||||
return Err(CreateImmedError::AlreadyUsed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue