mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-11 05:33:55 -04: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
21
terminal.c
21
terminal.c
|
|
@ -28,6 +28,7 @@
|
|||
#include "extract.h"
|
||||
#include "grid.h"
|
||||
#include "ime.h"
|
||||
#include "input.h"
|
||||
#include "notify.h"
|
||||
#include "quirks.h"
|
||||
#include "reaper.h"
|
||||
|
|
@ -2743,14 +2744,16 @@ static int
|
|||
linux_mouse_button_to_x(int button)
|
||||
{
|
||||
switch (button) {
|
||||
case BTN_LEFT: return 1;
|
||||
case BTN_MIDDLE: return 2;
|
||||
case BTN_RIGHT: return 3;
|
||||
case BTN_BACK: return 4;
|
||||
case BTN_FORWARD: return 5;
|
||||
case BTN_SIDE: return 8;
|
||||
case BTN_EXTRA: return 9;
|
||||
case BTN_TASK: return -1; /* TODO: ??? */
|
||||
case BTN_LEFT: return 1;
|
||||
case BTN_MIDDLE: return 2;
|
||||
case BTN_RIGHT: return 3;
|
||||
case BTN_BACK: return 4;
|
||||
case BTN_FORWARD: return 5;
|
||||
case BTN_WHEEL_LEFT: return 6; /* Foot custom define */
|
||||
case BTN_WHEEL_RIGHT: return 7; /* Foot custom define */
|
||||
case BTN_SIDE: return 8;
|
||||
case BTN_EXTRA: return 9;
|
||||
case BTN_TASK: return -1; /* TODO: ??? */
|
||||
|
||||
default:
|
||||
LOG_WARN("unrecognized mouse button: %d (0x%x)", button, button);
|
||||
|
|
@ -2881,7 +2884,7 @@ term_mouse_up(struct terminal *term, int button, int row, int col,
|
|||
return;
|
||||
|
||||
if (xbutton == 4 || xbutton == 5) {
|
||||
/* No release events for scroll buttons */
|
||||
/* No release events for vertical scroll wheel buttons */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue