https://bugs.freedesktop.org/show_bug.cgi?id=101139

Greg Reichow <gdr3...@me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr3...@me.com

--- Comment #1 from Greg Reichow <gdr3...@me.com> ---
Peter-
First off thanks for all your work with libinput.  Really appreciate your
contribution to the community.  

I also had a pretty bad experience with libinput on a Macbook Pro 8,2 using
1.8.4 and also in 1.9.  Pointer acceleration felt really different from what I
was used to on the machine under MacOS.  Slow movements were two "jerky",
medium were not fast enough, etc.  (I had previously been using mtrack under
xorg with mediocre results)

I spent some time and created a mac app to profile the touchpad acceleration
profiles used in MacOS. It was a course view, but provided some insight into
what felt right for this machine.  I then took a crack at modifying the
acceleration code in libinput to best match this profile curve.  After some
tuning, it seems to be working really great for me on this machine.  The basic
acceleration is a power function.  Copied below is the new
touchpad_accel_profile function I am using.  It is pretty sensitive (my desired
speed setting is right in the middle), yet gives me a lot of room to adjust
from slow to really fast using the normal speed slider.

My apologies if this is not the right way to help share this information. This
below plus a couple other small improvements has made libinput (and therefore
Wayland) very enjoyable for me with an old macbook pro touchpad. The pointer
acceleration has a really nice balance of slow speed accuracy and high speed
capability.  FWIW.

Code below
----------

double
touchpad_apple_accel_profile(struct motion_filter *filter,
                              void *data,
                              double speed_in, /* in device units/µs */
                              uint64_t time)
{
        struct pointer_accelerator *accel_filter =
                (struct pointer_accelerator *)filter;
        const double max_accel = accel_filter->accel; /* unitless factor */
        double factor; /* unitless */

        /* Convert to mm/s because that's something one can understand */

        speed_in = v_us2s(speed_in) * 25.4/accel_filter->dpi;

        // Convert into speed that my formula used which assumed 1 = distance
of trackpad in X (103mm for my pad); should fix the formulas below to make this
a function of the trackpad distance in mm instead.

        double norm_in = speed_in / 103.0;

        // X adjustment; range on Apple was .07 to .7 (fastest)

        double x_factor = 0.385 + 0.315 * filter->speed_adjustment;

        // Power adjustment; range on Apple was 1.1 to 1.5 (fastest)

        double power = 1.3 + 0.2 * filter->speed_adjustment;

        // first number is a magic number to get into the scale that is
appropriate

        factor = 3.5 * pow(norm_in * x_factor, power);

        // Minimum factor for slow speeds

        if (factor < 0.20) {
                factor = 0.20;
        }

        /* Cap at the maximum acceleration factor */
        factor = min(max_accel, factor);

        return factor;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
wayland-bugs mailing list
wayland-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-bugs

Reply via email to