Skip to content

Commit

Permalink
Add support for scrolling left and right.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gronis committed Jun 3, 2023
1 parent dfc67e5 commit 8dde022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ pub enum MouseEventKind {
ScrollDown,
/// Scrolled mouse wheel upwards (away from the user).
ScrollUp,
/// Scrolled mouse wheel left (mostly on a laptop touchpad).
ScrollLeft,
/// Scrolled mouse wheel right (mostly on a laptop touchpad).
ScrollRight,
}

/// Represents a mouse button.
Expand Down
2 changes: 2 additions & 0 deletions src/event/sys/unix/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ fn parse_cb(cb: u8) -> io::Result<(MouseEventKind, KeyModifiers)> {
(3, true) | (4, true) | (5, true) => MouseEventKind::Moved,
(4, false) => MouseEventKind::ScrollUp,
(5, false) => MouseEventKind::ScrollDown,
(6, false) => MouseEventKind::ScrollLeft,
(7, false) => MouseEventKind::ScrollRight,
// We do not support other buttons.
_ => return Err(could_not_parse_event_error()),
};
Expand Down

0 comments on commit 8dde022

Please sign in to comment.