From bef07ea62c6b1367c2588bb2f3c4a0e31951fd39 Mon Sep 17 00:00:00 2001 From: Sludge <96552222+SludgePhD@users.noreply.github.com> Date: Tue, 23 Aug 2022 23:38:43 +0200 Subject: [PATCH] Set `DataOffer`'s serial on enter events --- src/data_device/device.rs | 3 +++ src/data_device/offer.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/data_device/device.rs b/src/data_device/device.rs index 00ca8aec1..f1f7a2316 100644 --- a/src/data_device/device.rs +++ b/src/data_device/device.rs @@ -116,6 +116,9 @@ fn data_device_implem( Event::DataOffer { id } => inner.new_offer(id), Event::Enter { serial, surface, x, y, id } => { inner.set_dnd(id); + if let Some(offer) = &mut inner.current_dnd { + offer.set_serial(serial); + } implem( DndEvent::Enter { serial, surface, x, y, offer: inner.current_dnd.as_ref() }, ddata, diff --git a/src/data_device/offer.rs b/src/data_device/offer.rs index 09f859ced..52daef1fe 100644 --- a/src/data_device/offer.rs +++ b/src/data_device/offer.rs @@ -53,6 +53,10 @@ impl DataOffer { DataOffer { offer: offer.detach(), inner } } + pub(crate) fn set_serial(&mut self, serial: u32) { + self.inner.lock().unwrap().serial = serial; + } + /// Access the list of mime types proposed by this offer pub fn with_mime_types(&self, f: F) -> T where