tools: use doubles to back the scroll bars

Slow scrolling otherwise won't move them because we keep truncating the
subpixels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2015-04-22 15:31:21 +10:00
parent d4d2abe971
commit f877ff2f96

View file

@ -62,8 +62,8 @@ struct window {
int absx, absy;
/* scroll bar positions */
int vx, vy;
int hx, hy;
double vx, vy;
double hx, hy;
/* touch positions */
struct touch touches[32];
@ -363,7 +363,7 @@ handle_event_axis(struct libinput_event *ev, struct window *w)
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
value = libinput_event_pointer_get_axis_value(p,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
w->vy += (int)value;
w->vy += value;
w->vy = clip(w->vy, 0, w->height);
}
@ -371,7 +371,7 @@ handle_event_axis(struct libinput_event *ev, struct window *w)
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
value = libinput_event_pointer_get_axis_value(p,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
w->hx += (int)value;
w->hx += value;
w->hx = clip(w->hx, 0, w->width);
}
}