diff --git a/src/seat/pointer/mod.rs b/src/seat/pointer/mod.rs index da920afef..a29a23748 100644 --- a/src/seat/pointer/mod.rs +++ b/src/seat/pointer/mod.rs @@ -215,7 +215,7 @@ pub(crate) struct PointerDataInner { /// The serial of the latest enter event for the pointer pub(crate) latest_enter: Option, - /// The serial of the latest enter event for the pointer + /// The serial of the latest button event for the pointer pub(crate) latest_btn: Option, } diff --git a/src/seat/touch.rs b/src/seat/touch.rs index 725314ed6..c7abbea50 100644 --- a/src/seat/touch.rs +++ b/src/seat/touch.rs @@ -25,12 +25,20 @@ impl TouchData { pub fn seat(&self) -> &WlSeat { &self.seat } + + /// Serial from the latest touch down event. + pub fn latest_down_serial(&self) -> Option { + self.inner.lock().unwrap().latest_down + } } #[derive(Debug, Default)] pub(crate) struct TouchDataInner { events: Vec, active_touch_points: Vec, + + /// The serial of the latest touch down event + latest_down: Option, } #[macro_export] @@ -171,7 +179,8 @@ where match &event { // Buffer events until frame is received. - TouchEvent::Down { id, .. } => { + TouchEvent::Down { serial, id, .. } => { + guard.latest_down = Some(*serial); save_event = true; if let Err(insert_pos) = guard.active_touch_points.binary_search(id) { guard.active_touch_points.insert(insert_pos, *id);