- clock_gettime(CLOCK_MONOTONIC, &ts);
- now = ts.tv_sec * 1000ULL + ts.tv_nsec / 1000000;
+void
+tp_init_softbuttons(struct tp_dispatch *tp,
+ struct evdev_device *device,
+ double topbutton_size_mult)
+{
+ int width, height;
+ const struct input_absinfo *absinfo_x, *absinfo_y;
+ int xoffset, yoffset;
+ int yres;
+
+ absinfo_x = device->abs.absinfo_x;
+ absinfo_y = device->abs.absinfo_y;
+
+ xoffset = absinfo_x->minimum,
+ yoffset = absinfo_y->minimum;
+ yres = absinfo_y->resolution;
+ width = abs(absinfo_x->maximum - absinfo_x->minimum);
+ height = abs(absinfo_y->maximum - absinfo_y->minimum);
+
+ /* button height: 10mm or 15% of the touchpad height,
+ whichever is smaller */
+ if (yres > 1 && (height * 0.15/yres) > 10) {
+ tp->buttons.bottom_area.top_edge =
+ absinfo_y->maximum - 10 * yres;
+ } else {
+ tp->buttons.bottom_area.top_edge = height * .85 + yoffset;
+ }