[PATCH weston 4/8] shell: Update bindings to conform to pointer axis protocol

Jonas Ådahl jadahl at gmail.com
Fri Sep 28 04:46:05 PDT 2012


On Fri, Sep 28, 2012 at 12:46 PM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Fri, 28 Sep 2012 04:38:52 -0600
> Scott Moreau <oreaus at gmail.com> wrote:
>
>> On Thu, Sep 27, 2012 at 11:04 AM, Jonas Ådahl <jadahl at gmail.com> wrote:
>>
>> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
>> > ---
>> >  src/shell.c |    7 ++++---
>> >  1 file changed, 4 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/src/shell.c b/src/shell.c
>> > index e2715d6..6193bd2 100644
>> > --- a/src/shell.c
>> > +++ b/src/shell.c
>> > @@ -2361,7 +2361,7 @@ static void
>> >  surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t
>> > axis,
>> >                         wl_fixed_t value, void *data)
>> >  {
>> > -       float step = 0.05;
>> > +       float step = 0.005;
>> >         struct shell_surface *shsurf;
>> >         struct weston_surface *surface =
>> >                 (struct weston_surface *) seat->pointer->focus;
>> > @@ -2373,7 +2373,7 @@ surface_opacity_binding(struct wl_seat *seat,
>> > uint32_t time, uint32_t axis,
>> >         if (!shsurf)
>> >                 return;
>> >
>> > -       surface->alpha += wl_fixed_to_double(value) * step;
>> > +       surface->alpha -= wl_fixed_to_double(value) * step;
>> >
>> >         if (surface->alpha > 1.0)
>> >                 surface->alpha = 1.0;
>> > @@ -2403,8 +2403,9 @@ do_zoom(struct wl_seat *seat, uint32_t time,
>> > uint32_t key, uint32_t axis,
>> >                         else if (key == KEY_PAGEDOWN)
>> >                                 increment = -output->zoom.increment;
>> >                         else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
>> > +                               /* For every pixel zoom 20th of a step */
>> >                                 increment = output->zoom.increment *
>> > -                                           wl_fixed_to_double(value);
>> > +                                           -wl_fixed_to_double(value) /
>> > 20.0;
>> >                         else
>> >                                 increment = 0;
>> >
>> > --
>> > 1.7.9.5
>> >
>> >
>> I see now you changed the x11 backend in an earlier patch and account for
>> it here. Unless I'm missing something, that leaves backends using evdev for
>> input, broken.
>
> ..for mouse wheels. Maybe it's ok for touchpads, though?

Touchpad just got the axis feature in one of the commits in this series.

Regarding regular mouse wheels, reading the documentation[0] I'm not
sure about the expected behavior and cannot test it my self yet due to
lack of hardware. Considering that REL_WHEEL/REL_HWEEL events are
grouped together with other REL_* events one can think that they
should have the same measurement, or if not it should be documented
what they do. This might not be the case though. If the wheel events
behave as the wayland axis ones does it should work out of the box and
would have been broken before, otherwise they need to be addressed as
well. I'll get myself a mouse and test it sooner or later to see
what's actually going on.

There are also different kinds of scroll wheels out there, both the
discrete stepped one, and the "smooth" ones. Would be interesting to
see how these behave differently from an evdev point of view.

Jonas

[0] http://www.kernel.org/doc/Documentation/input/event-codes.txt


More information about the wayland-devel mailing list