mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
input: generate BTN_BACK/BTN_FORWARD mouse down events when scrolling
This commit is contained in:
parent
94fdde3da7
commit
7594edb89b
1 changed files with 14 additions and 2 deletions
16
input.c
16
input.c
|
|
@ -7,6 +7,8 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#include <linux/input-event-codes.h>
|
||||||
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
|
|
@ -350,10 +352,20 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int amount = wl_fixed_to_int(value);
|
int amount = wl_fixed_to_int(value);
|
||||||
if (amount < 0)
|
|
||||||
|
if (amount < 0) {
|
||||||
|
for (int i = 0; i < -amount; i++) {
|
||||||
|
term_mouse_down(term, BTN_BACK, term->mouse.row, term->mouse.col,
|
||||||
|
term->kbd.shift, term->kbd.alt, term->kbd.ctrl);
|
||||||
|
}
|
||||||
cmd_scrollback_up(term, -amount);
|
cmd_scrollback_up(term, -amount);
|
||||||
else
|
} else {
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
term_mouse_down(term, BTN_FORWARD, term->mouse.row, term->mouse.col,
|
||||||
|
term->kbd.shift, term->kbd.alt, term->kbd.ctrl);
|
||||||
|
}
|
||||||
cmd_scrollback_down(term, amount);
|
cmd_scrollback_down(term, amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue