[PATCH] evdev: Update axis notifications to follow protocol

Scott Moreau oreaus at gmail.com
Tue Oct 16 03:43:15 PDT 2012


On Wed, Oct 3, 2012 at 2:56 PM, Jonas Ådahl <jadahl at gmail.com> wrote:

> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  src/evdev.c |   38 +++++++++++++++++++++++++++++---------
>  1 file changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/src/evdev.c b/src/evdev.c
> index 8848736..c8513c8 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -30,6 +30,8 @@
>  #include "compositor.h"
>  #include "evdev.h"
>
> +#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
> +
>  void
>  evdev_led_update(struct evdev_device *device, enum weston_led leds)
>  {
> @@ -161,17 +163,35 @@ evdev_process_relative(struct evdev_device *device,
>                 device->pending_events |= EVDEV_RELATIVE_MOTION;
>                 break;
>         case REL_WHEEL:
> -               notify_axis(device->seat,
> -                             time,
> -                             WL_POINTER_AXIS_VERTICAL_SCROLL,
> -                             wl_fixed_from_int(e->value));
> +               switch (e->value) {
> +               case -1:
> +                       /* Scroll down */
> +               case 1:
> +                       /* Scroll up */
> +                       notify_axis(device->seat,
> +                                   time,
> +                                   WL_POINTER_AXIS_VERTICAL_SCROLL,
> +                                   -1 * e->value *
> DEFAULT_AXIS_STEP_DISTANCE);
> +                       break;
> +               default:
> +                       break;
> +               }
>                 break;
>         case REL_HWHEEL:
> -               notify_axis(device->seat,
> -                             time,
> -                             WL_POINTER_AXIS_HORIZONTAL_SCROLL,
> -                             wl_fixed_from_int(e->value));
> -               break;
> +               switch (e->value) {
> +               case -1:
> +                       /* Scroll left */
> +               case 1:
> +                       /* Scroll right */
> +                       notify_axis(device->seat,
> +                                   time,
> +                                   WL_POINTER_AXIS_HORIZONTAL_SCROLL,
> +                                   e->value * DEFAULT_AXIS_STEP_DISTANCE);
> +                       break;
> +               default:
> +                       break;
> +
> +               }
>         }
>  }
>
> --
> 1.7.9.5
>
>
Axis events are broken in drm since
b0b87baf7c2b4bc9ab8e59b47d8d4129a1418eec. I have tested and this does fix
the problem.


Thanks,

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20121016/4e578885/attachment.html>


More information about the wayland-devel mailing list