Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seat/touch: Track latest touch_down event serial #447

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/seat/pointer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub(crate) struct PointerDataInner {
/// The serial of the latest enter event for the pointer
pub(crate) latest_enter: Option<u32>,

/// 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<u32>,
}

Expand Down
11 changes: 10 additions & 1 deletion src/seat/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32> {
self.inner.lock().unwrap().latest_down
}
}

#[derive(Debug, Default)]
pub(crate) struct TouchDataInner {
events: Vec<TouchEvent>,
active_touch_points: Vec<i32>,

/// The serial of the latest touch down event
latest_down: Option<u32>,
}

#[macro_export]
Expand Down Expand Up @@ -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);
Expand Down
Loading