Add MouseButton::{Back, Forward} to MouseInput

Add named variants for physical back and forward keys which could
be found on some mice. The macOS bits may not work on all the
hardware given that apple doesn't directly support such a thing.

Co-authored-by: daxpedda <daxpedda@gmail.com>
This commit is contained in:
bbb651 2023-06-16 11:51:09 +03:00 committed by GitHub
parent 6300cf915e
commit 4748890935
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 9 deletions

View file

@ -579,7 +579,7 @@ impl<T: 'static> EventProcessor<T> {
use crate::event::{
ElementState::{Pressed, Released},
MouseButton::{Left, Middle, Other, Right},
MouseButton::{Back, Forward, Left, Middle, Other, Right},
MouseScrollDelta::LineDelta,
Touch,
WindowEvent::{
@ -651,6 +651,23 @@ impl<T: 'static> EventProcessor<T> {
}
}
8 => callback(Event::WindowEvent {
window_id,
event: MouseInput {
device_id,
state,
button: Back,
},
}),
9 => callback(Event::WindowEvent {
window_id,
event: MouseInput {
device_id,
state,
button: Forward,
},
}),
x => callback(Event::WindowEvent {
window_id,
event: MouseInput {