diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2013-05-22 12:25:13 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-05-22 12:25:13 -0400 |
commit | 057bf63260d573787e9f14f39ac32e29b0aff830 (patch) | |
tree | e7e5cbf736b4425cd668f8bd5043dc2b9605fdfe | |
parent | dbe11cc878f875a7d353fd20f7483b4ee28f0965 (diff) |
xwayland: Clear scrolling fractional values after 2 secondsxwayland-1.12
Left over fractional values from previous scrolling could cause a tiny
new scroll axis amount to trigger a scroll button event. We handle this
by tracking the time of the previous scroll event, and if the incoming
event is more than 2s later, we clear the fractional values.
-rw-r--r-- | hw/xfree86/xwayland/xwayland-input.c | 6 | ||||
-rw-r--r-- | hw/xfree86/xwayland/xwayland-private.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c index d986deb54..c550d7743 100644 --- a/hw/xfree86/xwayland/xwayland-input.c +++ b/hw/xfree86/xwayland/xwayland-input.c @@ -377,6 +377,12 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer, int i, val; const int divisor = 10; + if (time - xwl_seat->scroll_time > 2000) { + xwl_seat->vertical_scroll = 0; + xwl_seat->horizontal_scroll = 0; + } + xwl_seat->scroll_time = time; + /* FIXME: Need to do proper smooth scrolling here! */ switch (axis) { case WL_POINTER_AXIS_VERTICAL_SCROLL: diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h index d595bc5d7..e4273166d 100644 --- a/hw/xfree86/xwayland/xwayland-private.h +++ b/hw/xfree86/xwayland/xwayland-private.h @@ -102,6 +102,7 @@ struct xwl_seat { wl_fixed_t horizontal_scroll; wl_fixed_t vertical_scroll; + uint32_t scroll_time; size_t keymap_size; char *keymap; |