aboutsummaryrefslogtreecommitdiffstats
path: root/src/events.rs
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-06-16 08:52:25 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-06-16 08:52:25 +0200
commit5e8271dad0a56697f0729c094dfe29cab302460b (patch)
tree07901f0a48dc1426d034bbb39dfed100cc3e7a40 /src/events.rs
parenta0e29d9410181368eee1e0b6db1bbbf11abf45f8 (diff)
parentb2c2f300dce0b874efee4c328629ff9c2316c056 (diff)
downloadglutin-5e8271dad0a56697f0729c094dfe29cab302460b.tar.gz
glutin-5e8271dad0a56697f0729c094dfe29cab302460b.zip
Merge pull request #483 from robertknight/rob-precise_scroll_deltas
Specify scroll deltas as either line or pixel-based
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/events.rs b/src/events.rs
index 7962706..c175810 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -25,11 +25,8 @@ pub enum Event {
/// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window.
MouseMoved((i32, i32)),
- /// Returns the horizontal and vertical mouse scrolling.
- ///
- /// A positive value indicates that the wheel was rotated forward, away from the user;
- /// a negative value indicates that the wheel was rotated backward, toward the user.
- MouseWheel(f64, f64),
+ /// A mouse wheel movement or touchpad scroll occurred.
+ MouseWheel(MouseScrollDelta),
/// An event from the mouse has been received.
MouseInput(ElementState, MouseButton),
@@ -57,6 +54,23 @@ pub enum MouseButton {
Other(u8),
}
+#[derive(Debug, Clone, Copy)]
+pub enum MouseScrollDelta {
+ /// Amount in lines or rows to scroll in the horizontal
+ /// and vertical directions.
+ ///
+ /// Positive values indicate movement forward
+ /// (away from the user) or rightwards.
+ LineDelta(f32, f32),
+ /// Amount in pixels to scroll in the horizontal and
+ /// vertical direction.
+ ///
+ /// Scroll events are expressed as a PixelDelta if
+ /// supported by the device (eg. a touchpad) and
+ /// platform.
+ PixelDelta(f32, f32)
+}
+
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum VirtualKeyCode {
/// The '1' key over the letters.