diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 9542d874..d9c469a4 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -525,20 +525,19 @@ tp_init_softbuttons(struct tp_dispatch *tp, absinfo_y = device->abs.absinfo_y; xoffset = absinfo_x->minimum, - yoffset = absinfo_y->minimum; + yoffset = absinfo_y->minimum, yres = absinfo_y->resolution; width = device->abs.dimensions.x; height = device->abs.dimensions.y; - /* button height: 10mm or 15% of the touchpad height, + /* button height: 10mm or 15% orf the touchpad height, whichever is smaller */ - if (!device->abs.fake_resolution && (height * 0.15/yres) > 10) { + if ((height * 0.15)/yres > 10) { tp->buttons.bottom_area.top_edge = - absinfo_y->maximum - 10 * yres; + 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; } @@ -547,7 +546,7 @@ tp_init_top_softbuttons(struct tp_dispatch *tp, struct evdev_device *device, double topbutton_size_mult) { - int width, height; + int width; const struct input_absinfo *absinfo_x, *absinfo_y; int xoffset, yoffset; int yres; @@ -559,7 +558,6 @@ tp_init_top_softbuttons(struct tp_dispatch *tp, yoffset = absinfo_y->minimum; yres = absinfo_y->resolution; width = device->abs.dimensions.x; - height = device->abs.dimensions.y; if (tp->buttons.has_topbuttons) { /* T440s has the top button line 5mm from the top, event @@ -567,14 +565,8 @@ tp_init_top_softbuttons(struct tp_dispatch *tp, top - which maps to 15%. We allow the caller to enlarge the area using a multiplier for the touchpad disabled case. */ double topsize_mm = 10 * topbutton_size_mult; - double topsize_pct = .15 * topbutton_size_mult; - if (!device->abs.fake_resolution) { - tp->buttons.top_area.bottom_edge = - yoffset + topsize_mm * yres; - } else { - tp->buttons.top_area.bottom_edge = height * topsize_pct + yoffset; - } + tp->buttons.top_area.bottom_edge = yoffset + topsize_mm * yres; tp->buttons.top_area.rightbutton_left_edge = width * .58 + xoffset; tp->buttons.top_area.leftbutton_right_edge = width * .42 + xoffset; } else { @@ -713,8 +705,6 @@ tp_init_buttons(struct tp_dispatch *tp, { struct libinput *libinput = tp_libinput_context(tp); struct tp_touch *t; - int width, height; - double diagonal; const struct input_absinfo *absinfo_x, *absinfo_y; tp->buttons.is_clickpad = libevdev_has_property(device->evdev, @@ -738,19 +728,9 @@ tp_init_buttons(struct tp_dispatch *tp, absinfo_x = device->abs.absinfo_x; absinfo_y = device->abs.absinfo_y; - /* pinned-finger motion threshold, see tp_unpin_finger. - The MAGIC for resolution-less touchpads ends up as 2% of the diagonal */ - if (device->abs.fake_resolution) { - const double BUTTON_MOTION_MAGIC = 0.007; - width = device->abs.dimensions.x; - height = device->abs.dimensions.y; - diagonal = sqrt(width*width + height*height); - tp->buttons.motion_dist.x_scale_coeff = diagonal * BUTTON_MOTION_MAGIC; - tp->buttons.motion_dist.y_scale_coeff = diagonal * BUTTON_MOTION_MAGIC; - } else { - tp->buttons.motion_dist.x_scale_coeff = 1.0/absinfo_x->resolution; - tp->buttons.motion_dist.y_scale_coeff = 1.0/absinfo_y->resolution; - } + /* pinned-finger motion threshold, see tp_unpin_finger. */ + tp->buttons.motion_dist.x_scale_coeff = 1.0/absinfo_x->resolution; + tp->buttons.motion_dist.y_scale_coeff = 1.0/absinfo_y->resolution; tp->buttons.config_method.get_methods = tp_button_config_click_get_methods; tp->buttons.config_method.set_method = tp_button_config_click_set_method; @@ -838,17 +818,6 @@ tp_check_clickfinger_distance(struct tp_dispatch *tp, x = abs(t1->point.x - t2->point.x); y = abs(t1->point.y - t2->point.y); - /* no resolution, so let's assume they're close enough together if - they're within 30% of the touchpad width or height */ - if (tp->device->abs.fake_resolution) { - int w, h; - w = tp->device->abs.dimensions.x; - h = tp->device->abs.dimensions.y; - - within_distance = (x < w * 0.3 && y < h * 0.3) ? 1 : 0; - goto out; - } - xres = tp->device->abs.absinfo_x->resolution; yres = tp->device->abs.absinfo_y->resolution; x /= xres; diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 11fc03b8..bbba6657 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -1351,17 +1351,8 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal) * and y resolution, so that a circle on the * touchpad does not turn into an elipse on the screen. */ - if (!tp->device->abs.fake_resolution) { - tp->accel.x_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_x; - tp->accel.y_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_y; - } else { - /* - * For touchpads where the driver does not provide resolution, fall - * back to scaling motion events based on the diagonal size in units. - */ - tp->accel.x_scale_coeff = DEFAULT_ACCEL_NUMERATOR / diagonal; - tp->accel.y_scale_coeff = DEFAULT_ACCEL_NUMERATOR / diagonal; - } + tp->accel.x_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_x; + tp->accel.y_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_y; switch (tp->device->model) { case EVDEV_MODEL_LENOVO_X230: @@ -1601,6 +1592,7 @@ tp_init(struct tp_dispatch *tp, { int width, height; double diagonal; + int res_x, res_y; tp->base.interface = &tp_interface; tp->device = device; @@ -1614,6 +1606,8 @@ tp_init(struct tp_dispatch *tp, if (tp_init_slots(tp, device) != 0) return -1; + res_x = tp->device->abs.absinfo_x->resolution; + res_y = tp->device->abs.absinfo_y->resolution; width = device->abs.dimensions.x; height = device->abs.dimensions.y; diagonal = sqrt(width*width + height*height); @@ -1622,18 +1616,8 @@ tp_init(struct tp_dispatch *tp, EV_ABS, ABS_MT_DISTANCE); - if (device->abs.fake_resolution) { - tp->hysteresis_margin.x = - diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR; - tp->hysteresis_margin.y = - diagonal / DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR; - } else { - int res_x = tp->device->abs.absinfo_x->resolution, - res_y = tp->device->abs.absinfo_y->resolution; - - tp->hysteresis_margin.x = res_x/2; - tp->hysteresis_margin.y = res_y/2; - } + tp->hysteresis_margin.x = res_x/2; + tp->hysteresis_margin.y = res_y/2; if (tp_init_accel(tp, diagonal) != 0) return -1;