aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-01-16 20:22:01 +0300
committerGitHub <noreply@github.com>2023-01-16 20:22:01 +0300
commited67aa3c081950a55a8dc7fa1bd9c626f6e7a187 (patch)
treef4b887e3112a7f04698572c30856446d29e3ec4a /alacritty/src/event.rs
parent5a3280e8e0184c94e7a3f0a89676090d0694408d (diff)
downloadr-alacritty-ed67aa3c081950a55a8dc7fa1bd9c626f6e7a187.tar.gz
r-alacritty-ed67aa3c081950a55a8dc7fa1bd9c626f6e7a187.tar.bz2
r-alacritty-ed67aa3c081950a55a8dc7fa1bd9c626f6e7a187.zip
Add support for horizontal scrolling
This adds support for horizontal mouse scrolling in mouse mode and alternative scrolling modes. Fixes #2185.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 2fb60b2a..9388b8a9 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -1033,7 +1033,7 @@ pub struct Mouse {
pub last_click_timestamp: Instant,
pub last_click_button: MouseButton,
pub click_state: ClickState,
- pub scroll_px: f64,
+ pub accumulated_scroll: AccumulatedScroll,
pub cell_side: Side,
pub lines_scrolled: f32,
pub block_hint_launcher: bool,
@@ -1057,7 +1057,7 @@ impl Default for Mouse {
block_hint_launcher: Default::default(),
inside_text_area: Default::default(),
lines_scrolled: Default::default(),
- scroll_px: Default::default(),
+ accumulated_scroll: Default::default(),
x: Default::default(),
y: Default::default(),
}
@@ -1081,6 +1081,16 @@ impl Mouse {
}
}
+/// The amount of scroll accumulated from the pointer events.
+#[derive(Default, Debug)]
+pub struct AccumulatedScroll {
+ /// Scroll we should perform along `x` axis.
+ pub x: f64,
+
+ /// Scroll we should perform along `y` axis.
+ pub y: f64,
+}
+
impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
/// Handle events from winit.
pub fn handle_event(&mut self, event: WinitEvent<'_, Event>) {