mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
input: implement support for mouse wheel left/right
We now emit button 6/7 events (when the client application grabs the mouse). This buttons map to mouse wheel horizontal scroll events. Or, left/right tilting, if you like. Wayland report these as ‘axis’ events (just like regular scroll wheel events), and thus we need to translate those scroll events to button events. libinput does not define any mouse buttons for wheel tilts, so we add our own defitions. These are added last in the BTN_* range, just before the BTN_JOYSTICK events.
This commit is contained in:
parent
7a372a8c23
commit
c2cc964116
5 changed files with 55 additions and 29 deletions
17
input.h
17
input.h
|
|
@ -5,6 +5,23 @@
|
|||
|
||||
#include "wayland.h"
|
||||
|
||||
/*
|
||||
* Custom defines for mouse wheel left/right buttons.
|
||||
*
|
||||
* Libinput does not define these. On Wayland, all scroll events (both
|
||||
* vertical and horizontal) are reported not as buttons, as ‘axis’
|
||||
* events.
|
||||
*
|
||||
* Libinput _does_ define BTN_BACK and BTN_FORWARD, which is
|
||||
* what we use for vertical scroll events. But for horizontal scroll
|
||||
* events, there aren’t any pre-defined mouse buttons.
|
||||
*
|
||||
* Mouse buttons are in the range 0x110 - 0x11f, with joystick defines
|
||||
* starting at 0x120.
|
||||
*/
|
||||
#define BTN_WHEEL_LEFT 0x11e
|
||||
#define BTN_WHEEL_RIGHT 0x11f
|
||||
|
||||
extern const struct wl_keyboard_listener keyboard_listener;
|
||||
extern const struct wl_pointer_listener pointer_listener;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue