mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-15 05:33:58 -04:00
input: don't map wheel events to BTN_{BACK,FORWARD}
BTN_BACK and BTN_FORWARD are separate buttons. The scroll wheel don't
have any button mappings in libinput/wayland, so make up our own
defines.
This allows us to map them in mouse bindings.
Also expose BTN_WHEEL_{LEFT,RIGHT}. These were already defined, and
used, internally, to handle wheel tilt events. With this, they can
also be used in mouse bindings.
Finally, fix encoding used for BTN_{BACK,FORWARD} when sending mouse
button events to the client application. Before this, they were mapped
to buttons 4/5. But, button 4/5 are for the scroll wheel, and as
mentioned above, BTN_{BACK,FORWARD} are not the same as scroll wheel
"buttons".
Closes #1763
This commit is contained in:
parent
15c0078c2d
commit
1136108c97
7 changed files with 59 additions and 27 deletions
26
terminal.c
26
terminal.c
|
|
@ -3192,17 +3192,23 @@ term_kbd_focus_out(struct terminal *term)
|
|||
static int
|
||||
linux_mouse_button_to_x(int button)
|
||||
{
|
||||
/* Note: on X11, scroll events where reported as buttons. Not so
|
||||
* on Wayland. We manually map scroll events to custom "button"
|
||||
* defines (BTN_WHEEL_*).
|
||||
*/
|
||||
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_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: ??? */
|
||||
case BTN_LEFT: return 1;
|
||||
case BTN_MIDDLE: return 2;
|
||||
case BTN_RIGHT: return 3;
|
||||
case BTN_WHEEL_BACK: return 4; /* Foot custom define */
|
||||
case BTN_WHEEL_FORWARD: return 5; /* Foot custom define */
|
||||
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_FORWARD: return 10;
|
||||
case BTN_BACK: return 11;
|
||||
case BTN_TASK: return 12; /* Guessing... */
|
||||
|
||||
default:
|
||||
LOG_WARN("unrecognized mouse button: %d (0x%x)", button, button);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue