From f6c37877fae76d7840367a0a766d92fbef9fdb5d Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Wed, 6 Nov 2024 08:37:12 +1300 Subject: Add support for 'back' and 'forward' mouse buttons MouseButton events will now also trigger when the 'back' and 'forward' mouse buttons are pressed. These buttons aren't present on all mice. --- src/events.rs | 2 ++ src/phosphor.rs | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/events.rs b/src/events.rs index 7729a63..22cada5 100644 --- a/src/events.rs +++ b/src/events.rs @@ -77,6 +77,8 @@ pub enum MouseButton { Left, Middle, Right, + Back, + Forward, } diff --git a/src/phosphor.rs b/src/phosphor.rs index 1e50735..ab13cb0 100644 --- a/src/phosphor.rs +++ b/src/phosphor.rs @@ -152,9 +152,11 @@ impl PhosphorApplication { WindowEvent::MouseInput { state, button, .. } => { let action = state.into(); match button { - WinitMouseButton::Left => handle!(Event::MouseButton { button: MouseButton::Left, action }), - WinitMouseButton::Middle => handle!(Event::MouseButton { button: MouseButton::Middle, action }), - WinitMouseButton::Right => handle!(Event::MouseButton { button: MouseButton::Right, action }), + WinitMouseButton::Left => handle!(Event::MouseButton { button: MouseButton::Left, action }), + WinitMouseButton::Middle => handle!(Event::MouseButton { button: MouseButton::Middle, action }), + WinitMouseButton::Right => handle!(Event::MouseButton { button: MouseButton::Right, action }), + WinitMouseButton::Back => handle!(Event::MouseButton { button: MouseButton::Back, action }), + WinitMouseButton::Forward => handle!(Event::MouseButton { button: MouseButton::Forward, action }), _ => (), } } -- cgit v1.2.3-70-g09d2