diff options
author | Paul Rouget <me@paulrouget.com> | 2016-03-18 08:57:20 +0100 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2016-04-05 18:42:28 +0800 |
commit | df6e7394d42595f34fa64dea01bb485c64589c73 (patch) | |
tree | 4e8b1e9845ecce90b33c37b976bceaad234cff7a /components/script_traits/lib.rs | |
parent | 05a4dcdc3b38c0222ac417f826e06ce9d47068b2 (diff) | |
download | servo-df6e7394d42595f34fa64dea01bb485c64589c73.tar.gz servo-df6e7394d42595f34fa64dea01bb485c64589c73.zip |
forcetouch events support
This enables Apple forcetouch DOM events. It requires the preference dom.forcetouch.enabled.
The DOM events are described here:
- https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html
The Cocoa mechanism is documented here:
- https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/#//apple_ref/doc/uid/20000016-SW274
Diffstat (limited to 'components/script_traits/lib.rs')
-rw-r--r-- | components/script_traits/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index e61c83b4e6b..28622e9d2bf 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -227,10 +227,23 @@ pub enum CompositorEvent { MouseMoveEvent(Option<Point2D<f32>>), /// A touch event was generated with a touch ID and location. TouchEvent(TouchEventType, TouchId, Point2D<f32>), + /// Touchpad pressure event + TouchpadPressureEvent(Point2D<f32>, f32, TouchpadPressurePhase), /// A key was pressed. KeyEvent(Key, KeyState, KeyModifiers), } +/// Touchpad pressure phase for TouchpadPressureEvent. +#[derive(Copy, Clone, HeapSizeOf, PartialEq, Deserialize, Serialize)] +pub enum TouchpadPressurePhase { + /// Pressure before a regular click. + BeforeClick, + /// Pressure after a regular click. + AfterFirstClick, + /// Pressure after a "forceTouch" click + AfterSecondClick, +} + /// An opaque wrapper around script<->layout channels to avoid leaking message types into /// crates that don't need to know about them. pub struct OpaqueScriptLayoutChannel(pub (Box<Any + Send>, Box<Any + Send>)); |