Skip to content

Commit

Permalink
Improve Back and Forward mouse button docs and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bbb651 committed Jun 2, 2023
1 parent ace7197 commit 4fd99d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,10 +1202,8 @@ pub enum ElementState {
///
/// ## Platform-specific
///
/// **macOS:** does not offically define `Back` and `Forward`, but supports 29 generic mouse buttons from 3..=31.
/// `3` and `4` is commonly used for `Back` and `Forward` respectivly by driver vendor and applications such as browsers,
/// this follows this convention. Not guaranteed to work with all hardware and configurations.
/// **orbital:** `Back` and `Forward` are unsupported due to orbital not supporting them.
/// **macOS:** `Back` and `Forward` might not work with all hardware.
/// **Orbital:** `Back` and `Forward` are unsupported due to orbital not supporting them.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum MouseButton {
Expand Down
2 changes: 2 additions & 0 deletions src/platform_impl/macos/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,8 @@ fn mouse_button(event: &NSEvent) -> MouseButton {
// The buttonNumber property only makes sense for the mouse events:
// NSLeftMouse.../NSRightMouse.../NSOtherMouse...
// For the other events, it's always set to 0.
// MacOS only defines the left, right and middle buttons, 3..=31 are left as generic buttons,
// but 3 and 4 are very commonly used as Back and Forward by hardware vendors and applications.
match event.buttonNumber() {
0 => MouseButton::Left,
1 => MouseButton::Right,
Expand Down

0 comments on commit 4fd99d6

Please sign in to comment.