diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index b84198ce..9848a32a 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -605,11 +605,28 @@ tp_init_buttons(struct tp_dispatch *tp, if (tp->buttons.is_clickpad && !tp->buttons.use_clickfinger) { int xoffset = absinfo_x->minimum, yoffset = absinfo_y->minimum; - tp->buttons.bottom_area.top_edge = height * .8 + yoffset; + int yres = absinfo_y->resolution; + + /* 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; + } + tp->buttons.bottom_area.rightbutton_left_edge = width/2 + xoffset; if (tp->buttons.has_topbuttons) { - tp->buttons.top_area.bottom_edge = height * .08 + yoffset; + /* T440s has the top button line 5mm from the top, + make the buttons 6mm high */ + if (yres > 1) { + tp->buttons.top_area.bottom_edge = + yoffset + 6 * yres; + } else { + tp->buttons.top_area.bottom_edge = height * .08 + yoffset; + } tp->buttons.top_area.rightbutton_left_edge = width * .58 + xoffset; tp->buttons.top_area.leftbutton_right_edge = width * .42 + xoffset; } else {