diff options
author | Linus Heckemann <git@sphalerite.org> | 2017-09-02 20:29:03 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-09-02 12:29:03 -0700 |
commit | 22fa4260fc9210fbb5288090df79c92e7b3788e4 (patch) | |
tree | e72c9913ccb328b4809f431deb31b3202e57bb0c | |
parent | 27bf9885ec187b9c40ca661bc1fd9f3c92882d7a (diff) | |
download | alacritty-22fa4260fc9210fbb5288090df79c92e7b3788e4.tar.gz alacritty-22fa4260fc9210fbb5288090df79c92e7b3788e4.zip |
Fix #721: touchpad scrolling (#726)
-rw-r--r-- | src/event.rs | 4 | ||||
-rw-r--r-- | src/input.rs | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/event.rs b/src/event.rs index 4cfd0d57..95685001 100644 --- a/src/event.rs +++ b/src/event.rs @@ -145,7 +145,8 @@ pub struct Mouse { pub scroll_px: i32, pub line: Line, pub column: Column, - pub cell_side: Side + pub cell_side: Side, + pub lines_scrolled: f32, } impl Default for Mouse { @@ -160,6 +161,7 @@ impl Default for Mouse { line: Line(0), column: Column(0), cell_side: Side::Left, + lines_scrolled: 0.0, } } } diff --git a/src/input.rs b/src/input.rs index 6e3d6d0d..f11aec34 100644 --- a/src/input.rs +++ b/src/input.rs @@ -352,15 +352,18 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { match delta { MouseScrollDelta::LineDelta(_columns, lines) => { - let code = if lines > 0.0 { + let to_scroll = self.ctx.mouse_mut().lines_scrolled + lines; + + let code = if to_scroll > 0.0 { 64 } else { 65 }; - for _ in 0..(lines.abs() as usize) { + for _ in 0..(to_scroll.abs() as usize) { self.normal_mouse_report(code); } + self.ctx.mouse_mut().lines_scrolled = to_scroll % 1.0; }, MouseScrollDelta::PixelDelta(_x, y) => { match phase { |