mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Handle multi-touch events from glutin
This commit is contained in:
parent
5c11c88e92
commit
ef93650db9
7 changed files with 227 additions and 102 deletions
|
@ -158,6 +158,25 @@ pub enum MouseButton {
|
|||
Right,
|
||||
}
|
||||
|
||||
/// The type of input represented by a multi-touch event.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum TouchEventType {
|
||||
/// A new touch point came in contact with the screen.
|
||||
Down,
|
||||
/// An existing touch point changed location.
|
||||
Move,
|
||||
/// A touch point was removed from the screen.
|
||||
Up,
|
||||
/// The system stopped tracking a touch point.
|
||||
Cancel,
|
||||
}
|
||||
|
||||
/// An opaque identifier for a touch point.
|
||||
///
|
||||
/// http://w3c.github.io/touch-events/#widl-Touch-identifier
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct TouchId(pub i32);
|
||||
|
||||
/// Events from the compositor that the script task needs to know about
|
||||
pub enum CompositorEvent {
|
||||
/// The window was resized.
|
||||
|
@ -170,12 +189,8 @@ pub enum CompositorEvent {
|
|||
MouseUpEvent(MouseButton, Point2D<f32>),
|
||||
/// The mouse was moved over a point.
|
||||
MouseMoveEvent(Point2D<f32>),
|
||||
/// A touch began at a point.
|
||||
TouchDownEvent(i32, Point2D<f32>),
|
||||
/// A touch was moved over a point.
|
||||
TouchMoveEvent(i32, Point2D<f32>),
|
||||
/// A touch ended at a point.
|
||||
TouchUpEvent(i32, Point2D<f32>),
|
||||
/// A touch event was generated with a touch ID and location.
|
||||
TouchEvent(TouchEventType, TouchId, Point2D<f32>),
|
||||
/// A key was pressed.
|
||||
KeyEvent(Key, KeyState, KeyModifiers),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue