[PATCH 2/2] libinput: Check if axis value is available in debugging GUI
Peter Hutterer
peter.hutterer at who-t.net
Mon Jan 26 19:37:29 PST 2015
On Fri, Jan 23, 2015 at 10:31:05PM +0100, code at schoeller.se wrote:
> From: Friedrich Schöller <code at schoeller.se>
>
> libinput complained with lots of "client bug" messages because the GUI tool did not check which axis values were available.
>
> Signed-off-by: Friedrich Schöller <code at schoeller.se>
both pushed, thanks. with minor amendments though:
- { goes on the same line as the condition
- long line wrapped in commit message
- dropped "libinput" from subject line, replaced with "tools:". For next
time please remember to put the component inside [PATCH ...], that way it
get's stripped out automatically.
I also added a reference to the 1/2 patch with a commit sha when the bug was
introduced.
Cheers,
Peter
> ---
> tools/event-gui.c | 26 +++++++++++++++-----------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/tools/event-gui.c b/tools/event-gui.c
> index e574bf7..9585f4f 100644
> --- a/tools/event-gui.c
> +++ b/tools/event-gui.c
> @@ -358,19 +358,23 @@ static void
> handle_event_axis(struct libinput_event *ev, struct window *w)
> {
> struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
> - double v, h;
> -
> - v = libinput_event_pointer_get_axis_value(p,
> - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
> - h = libinput_event_pointer_get_axis_value(p,
> - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
> -
> - if (v != 0.0) {
> - w->vy += (int)v;
> + double value;
> +
> + if (libinput_event_pointer_has_axis(p,
> + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL))
> + {
> + value = libinput_event_pointer_get_axis_value(p,
> + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
> + w->vy += (int)value;
> w->vy = clip(w->vy, 0, w->height);
> }
> - if (h != 0.0) {
> - w->hx += (int)h;
> +
> + if (libinput_event_pointer_has_axis(p,
> + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))
> + {
> + value = libinput_event_pointer_get_axis_value(p,
> + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
> + w->hx += (int)value;
> w->hx = clip(w->hx, 0, w->width);
> }
> }
> --
> 2.2.2
>
> _______________________________________________
> 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