scrollback: initial support for mouse scrolling

This commit is contained in:
Daniel Eklöf 2019-07-10 09:15:37 +02:00
parent bcd111d203
commit b058e6384a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 41 additions and 13 deletions

16
input.c
View file

@ -143,12 +143,12 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
if (effective_mods == shift) {
if (sym == XKB_KEY_Page_Up) {
cmd_scrollback_up(term);
cmd_scrollback_up(term, term->rows);
found_map = true;
}
else if (sym == XKB_KEY_Page_Down) {
cmd_scrollback_down(term);
cmd_scrollback_down(term, term->rows);
found_map = true;
}
}
@ -342,6 +342,18 @@ static void
wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
uint32_t time, uint32_t axis, wl_fixed_t value)
{
struct terminal *term = data;
/* TODO: generate button event for BTN_FORWARD/BTN_BACK? */
if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL)
return;
int amount = wl_fixed_to_int(value);
if (amount < 0)
cmd_scrollback_up(term, -amount);
else
cmd_scrollback_down(term, amount);
}
static void