Introduce FingerId (#3783)

This commit is contained in:
daxpedda 2024-08-08 00:36:36 +02:00 committed by GitHub
parent f07153b8e0
commit 9dff801f93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 329 additions and 113 deletions

View file

@ -0,0 +1,32 @@
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DeviceId(i32);
impl DeviceId {
pub fn new(pointer_id: i32) -> Self {
Self(pointer_id)
}
pub const fn dummy() -> Self {
Self(-1)
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FingerId {
pointer_id: i32,
primary: bool,
}
impl FingerId {
pub fn new(pointer_id: i32, primary: bool) -> Self {
Self { pointer_id, primary }
}
pub const fn dummy() -> Self {
Self { pointer_id: -1, primary: false }
}
pub fn is_primary(self) -> bool {
self.primary
}
}