Introduce FingerId (#3783)
This commit is contained in:
parent
f07153b8e0
commit
9dff801f93
24 changed files with 329 additions and 113 deletions
|
|
@ -71,6 +71,15 @@ impl DeviceId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct FingerId(i32);
|
||||
|
||||
impl FingerId {
|
||||
pub const fn dummy() -> Self {
|
||||
FingerId(0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the WindowId out of the surface.
|
||||
#[inline]
|
||||
fn make_wid(surface: &WlSurface) -> WindowId {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use tracing::warn;
|
|||
use crate::dpi::LogicalPosition;
|
||||
use crate::event::{Touch, TouchPhase, WindowEvent};
|
||||
use crate::platform_impl::wayland::state::WinitState;
|
||||
use crate::platform_impl::wayland::{self, DeviceId};
|
||||
use crate::platform_impl::wayland::{self, DeviceId, FingerId};
|
||||
|
||||
impl TouchHandler for WinitState {
|
||||
fn down(
|
||||
|
|
@ -50,7 +50,9 @@ impl TouchHandler for WinitState {
|
|||
phase: TouchPhase::Started,
|
||||
location: location.to_physical(scale_factor),
|
||||
force: None,
|
||||
id: id as u64,
|
||||
finger_id: crate::event::FingerId(crate::platform_impl::FingerId::Wayland(
|
||||
FingerId(id),
|
||||
)),
|
||||
}),
|
||||
window_id,
|
||||
);
|
||||
|
|
@ -93,7 +95,9 @@ impl TouchHandler for WinitState {
|
|||
phase: TouchPhase::Ended,
|
||||
location: touch_point.location.to_physical(scale_factor),
|
||||
force: None,
|
||||
id: id as u64,
|
||||
finger_id: crate::event::FingerId(crate::platform_impl::FingerId::Wayland(
|
||||
FingerId(id),
|
||||
)),
|
||||
}),
|
||||
window_id,
|
||||
);
|
||||
|
|
@ -138,7 +142,9 @@ impl TouchHandler for WinitState {
|
|||
phase: TouchPhase::Moved,
|
||||
location: touch_point.location.to_physical(scale_factor),
|
||||
force: None,
|
||||
id: id as u64,
|
||||
finger_id: crate::event::FingerId(crate::platform_impl::FingerId::Wayland(
|
||||
FingerId(id),
|
||||
)),
|
||||
}),
|
||||
window_id,
|
||||
);
|
||||
|
|
@ -170,7 +176,9 @@ impl TouchHandler for WinitState {
|
|||
phase: TouchPhase::Cancelled,
|
||||
location,
|
||||
force: None,
|
||||
id: id as u64,
|
||||
finger_id: crate::event::FingerId(crate::platform_impl::FingerId::Wayland(
|
||||
FingerId(id),
|
||||
)),
|
||||
}),
|
||||
window_id,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue