On Wayland, don't drop extra mouse buttons
This commit forwards "unknown" Wayland mouse buttons downstream via 'MouseButton::Other'. Possible values for those could be found in <linux/input-event-codes.h>. Also, since Wayland just forwards buttons from the kernel, which are 'u16', we must adjust 'MouseButton::Other' to take 'u16' instead of 'u8'.
This commit is contained in:
parent
8fb7aa5cef
commit
c5620efc9c
6 changed files with 16 additions and 10 deletions
|
|
@ -17,6 +17,11 @@ use crate::platform_impl::wayland::{self, DeviceId};
|
|||
|
||||
use super::{PointerData, WinitPointer};
|
||||
|
||||
// These values are comming from <linux/input-event-codes.h>.
|
||||
const BTN_LEFT: u32 = 0x110;
|
||||
const BTN_RIGHT: u32 = 0x111;
|
||||
const BTN_MIDDLE: u32 = 0x112;
|
||||
|
||||
#[inline]
|
||||
pub(super) fn handle_pointer(
|
||||
pointer: ThemedPointer,
|
||||
|
|
@ -153,11 +158,10 @@ pub(super) fn handle_pointer(
|
|||
};
|
||||
|
||||
let button = match button {
|
||||
0x110 => MouseButton::Left,
|
||||
0x111 => MouseButton::Right,
|
||||
0x112 => MouseButton::Middle,
|
||||
// TODO - figure out the translation.
|
||||
_ => return,
|
||||
BTN_LEFT => MouseButton::Left,
|
||||
BTN_RIGHT => MouseButton::Right,
|
||||
BTN_MIDDLE => MouseButton::Middle,
|
||||
button => MouseButton::Other(button as u16),
|
||||
};
|
||||
|
||||
event_sink.push_window_event(
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ impl<T: 'static> EventProcessor<T> {
|
|||
event: MouseInput {
|
||||
device_id,
|
||||
state,
|
||||
button: Other(x as u8),
|
||||
button: Other(x as u16),
|
||||
modifiers,
|
||||
},
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue