diff --git a/src/ifs/wl_seat/handling.rs b/src/ifs/wl_seat/handling.rs index 88ae1252..64e105ff 100644 --- a/src/ifs/wl_seat/handling.rs +++ b/src/ifs/wl_seat/handling.rs @@ -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(&self, ver: u32, surface: &WlSurface, mut f: F) + where + F: FnMut(&Rc) -> 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, x: Fixed, y: Fixed) { self.pos.set((x, y)); self.handle_new_position(true); diff --git a/src/ifs/zwp_linux_buffer_params_v1/mod.rs b/src/ifs/zwp_linux_buffer_params_v1/mod.rs index 8b772220..00e5ee9a 100644 --- a/src/ifs/zwp_linux_buffer_params_v1/mod.rs +++ b/src/ifs/zwp_linux_buffer_params_v1/mod.rs @@ -137,7 +137,7 @@ impl ZwpLinuxBufferParamsV1 { Ok(buffer_id) } - fn create(self: &Rc, parser: MsgParser<'_, '_>) -> Result<(), CreateError> { + fn create(self: &Rc, 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, parser: MsgParser<'_, '_>) -> Result<(), CreateImmedError> { + fn create_immed(self: &Rc, parser: MsgParser) -> Result<(), CreateImmedError> { let req: CreateImmed = self.parent.client.parse(&**self, parser)?; if self.used.replace(true) { return Err(CreateImmedError::AlreadyUsed);