chore: remove platform FingerId

The same as for `WindowId`.
This commit is contained in:
Kirill Chibisov 2024-10-15 17:26:43 +03:00
parent c8c1eca3c7
commit edfb4b03f4
20 changed files with 71 additions and 172 deletions

View file

@ -634,12 +634,23 @@ impl DeviceId {
/// Whenever a touch event is received it contains a `FingerId` which uniquely identifies the finger
/// used for the current interaction.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FingerId(pub(crate) platform_impl::FingerId);
pub struct FingerId(pub(crate) usize);
impl FingerId {
#[cfg(test)]
pub(crate) const fn dummy() -> Self {
FingerId(platform_impl::FingerId::dummy())
/// Convert the [`FingerId`] into the underlying integer.
///
/// This is useful if you need to pass the ID across an FFI boundary, or store it in an atomic.
#[allow(dead_code)]
pub(crate) const fn into_raw(self) -> usize {
self.0
}
/// Construct a [`FingerId`] from the underlying integer.
///
/// This should only be called with integers returned from [`FingerId::into_raw`].
#[allow(dead_code)]
pub(crate) const fn from_raw(id: usize) -> Self {
Self(id)
}
}
@ -1154,7 +1165,7 @@ mod tests {
($closure:expr) => {{
#[allow(unused_mut)]
let mut x = $closure;
let fid = event::FingerId::dummy();
let fid = event::FingerId::from_raw(0);
#[allow(deprecated)]
{
@ -1291,7 +1302,7 @@ mod tests {
});
let _ = event::StartCause::Init.clone();
let fid = crate::event::FingerId::dummy().clone();
let fid = crate::event::FingerId::from_raw(0).clone();
HashSet::new().insert(fid);
let mut set = [fid, fid, fid];
set.sort_unstable();