1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Fix #721: touchpad scrolling (#726)

This commit is contained in:
Linus Heckemann 2017-09-02 20:29:03 +01:00 committed by Joe Wilm
parent 27bf9885ec
commit 22fa4260fc
2 changed files with 8 additions and 3 deletions

View file

@ -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,
}
}
}

View file

@ -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 {