[PATCH libinput 1/2] Change the scroll step distance to 15 and document it as degrees
Peter Hutterer
peter.hutterer at who-t.net
Sun Jan 11 17:54:04 PST 2015
On Mon, Jan 12, 2015 at 09:37:05AM +0800, Jonas Ådahl wrote:
> On Mon, Jan 12, 2015 at 09:12:35AM +1000, Peter Hutterer wrote:
> > Similar to the mouse resolution, let's make the scroll distance a sensible
> > predictable value. Most mice use a 15 degree angle per scroll click, so let's
> > change to that. This will alter behaviour in clients that expect 10 but it
> > shouldn't be too bad. We return doubles anyway for the axis value, so that
> > leaves the option of really fine-grained step sizes.
>
> This is not entirely true, as a few clients use the '10' value to
> convert to steps. In other words this change may cause them to
> potentially emit double scroll events. We need to make weston (and other
> users) not break compatibility with Wayland clients by, as discussed, for
> now ignoring the degrees and continue sending the distance based value
> for wheel events.
>
> Other than this, one nit below, and with that fixed,
>
> Reviewed-by: Jonas Ådahl <jadahl at gmail.com>
>
>
> Jonas
>
> >
> > We currently assume all mice have 15 degree angles. Like the DPI settings, it
> > will require a udev property to be set. Patch for that to follow.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > src/evdev.c | 2 +-
> > src/libinput.h | 8 ++++----
> > test/pointer.c | 4 ++--
> > 3 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/evdev.c b/src/evdev.c
> > index 1718491..4fb37d6 100644
> > --- a/src/evdev.c
> > +++ b/src/evdev.c
> > @@ -40,7 +40,7 @@
> > #include "filter.h"
> > #include "libinput-private.h"
> >
> > -#define DEFAULT_AXIS_STEP_DISTANCE 10
> > +#define DEFAULT_AXIS_STEP_DISTANCE 15
>
> This is no longer a distance, as the value is changed from distance to
> angle.
renamed to DEFAULT_WHEEL_CLICK_ANGLE and a slight edit to the commit
message, thanks.
Cheers,
Peter
>
> > #define DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT 200
> >
> > enum evdev_key_type {
> > diff --git a/src/libinput.h b/src/libinput.h
> > index 27c5868..95a5c1d 100644
> > --- a/src/libinput.h
> > +++ b/src/libinput.h
> > @@ -704,10 +704,10 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
> > *
> > * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, no terminating
> > * event is guaranteed (though it may happen).
> > - * Scrolling is in discrete steps, a value of 10 representing one click
> > - * of a typical mouse wheel. Some mice may have differently grained wheels,
> > - * libinput will adjust the value accordingly. It is up to the caller how to
> > - * interpret such different step sizes.
> > + * Scrolling is in discrete steps, the value is the angle the wheel moved
> > + * in degrees. The default is 15 degrees per wheel click, but some mice may
> > + * have differently grained wheels. It is up to the caller how to interpret
> > + * such different step sizes.
> > *
> > * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, no
> > * terminating event is guaranteed (though it may happen).
> > diff --git a/test/pointer.c b/test/pointer.c
> > index b9bd3cc..d12c9f6 100644
> > --- a/test/pointer.c
> > +++ b/test/pointer.c
> > @@ -350,8 +350,8 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
> > struct libinput_event_pointer *ptrev;
> >
> > /* the current evdev implementation scales the scroll wheel events
> > - up by a factor 10 */
>
>
>
> > - const int scroll_step = 10;
> > + up by a factor 15 */
> > + const int scroll_step = 15;
> > int expected = amount * scroll_step;
> >
> > if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device))
> > --
> > 2.1.0
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list