/* Number of high-resolution events for each low-resolution detent. */
#define SCROLL_HR_STEPS 10
#define SCROLL_HR_MULT (120 / SCROLL_HR_STEPS)
+#define SCROLL_HR_THRESHOLD 90 /* units */
#define SCROLL_ACCEL_DEFAULT 7
/* Touch surface information. Dimension is in hundredths of a mm, min and max
short scroll_x_hr;
short scroll_y_hr;
u8 size;
+ bool scroll_x_active;
+ bool scroll_y_active;
} touches[16];
int tracking_ids[16];
msc->touches[id].scroll_y = y;
msc->touches[id].scroll_x_hr = x;
msc->touches[id].scroll_y_hr = y;
+ msc->touches[id].scroll_x_active = false;
+ msc->touches[id].scroll_y_active = false;
/* Reset acceleration after half a second. */
if (scroll_acceleration && time_before(now,
input_report_rel(input, REL_WHEEL, step_y);
}
+ if (!msc->touches[id].scroll_x_active &&
+ abs(step_x_hr) > SCROLL_HR_THRESHOLD) {
+ msc->touches[id].scroll_x_active = true;
+ msc->touches[id].scroll_x_hr = x;
+ step_x_hr = 0;
+ }
+
step_x_hr /= step_hr;
- if (step_x_hr != 0) {
+ if (step_x_hr != 0 &&
+ msc->touches[id].scroll_x_active) {
msc->touches[id].scroll_x_hr -= step_x_hr *
step_hr;
input_report_rel(input,
-step_x_hr * SCROLL_HR_MULT);
}
+ if (!msc->touches[id].scroll_y_active &&
+ abs(step_y_hr) > SCROLL_HR_THRESHOLD) {
+ msc->touches[id].scroll_y_active = true;
+ msc->touches[id].scroll_y_hr = y;
+ step_y_hr = 0;
+ }
+
step_y_hr /= step_hr;
- if (step_y_hr != 0) {
+ if (step_y_hr != 0 &&
+ msc->touches[id].scroll_y_active) {
msc->touches[id].scroll_y_hr -= step_y_hr *
step_hr;
input_report_rel(input,