[PATCH libinput 02/23] evdev: Add basic support for tablet devices

Peter Hutterer peter.hutterer at who-t.net
Sun Jun 15 20:24:37 PDT 2014


On Thu, Jun 12, 2014 at 11:28:23PM -0400, Stephen Chandler Paul wrote:
> These devices set the LIBINPUT_DEVICE_CAP_STYLUS flag, and emit a lot more axis

s/STYLUS/TABLET/

> information then mice and touchpads. As such, tablet events are in a whole new
> group of events that is separate from everything else.
> 
> In this commit, only X and Y axes are reported in libinput.
> 
> Based off the patch originally written by Carlos Garnacho
> 
> Signed-off-by: Stephen Chandler Paul <thatslyude at gmail.com>
> ---
>  src/Makefile.am        |   2 +
>  src/evdev-tablet.c     | 170 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/evdev-tablet.h     |  64 +++++++++++++++++++
>  src/evdev.c            |   8 +++
>  src/evdev.h            |   3 +
>  src/libinput-private.h |   6 ++
>  src/libinput-util.h    |   2 +
>  src/libinput.c         | 108 +++++++++++++++++++++++++++++++
>  src/libinput.h         | 121 ++++++++++++++++++++++++++++++++++-
>  9 files changed, 483 insertions(+), 1 deletion(-)
>  create mode 100644 src/evdev-tablet.c
>  create mode 100644 src/evdev-tablet.h
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index bf56184..b880a69 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -11,6 +11,8 @@ libinput_la_SOURCES =			\
>  	libinput-util.h			\
>  	evdev.c				\
>  	evdev.h				\
> +	evdev-tablet.c			\
> +	evdev-tablet.h			\
>  	evdev-mt-touchpad.c		\
>  	evdev-mt-touchpad.h		\
>  	evdev-mt-touchpad-tap.c		\
> diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> new file mode 100644
> index 0000000..5c73bcb
> --- /dev/null
> +++ b/src/evdev-tablet.c
> @@ -0,0 +1,170 @@
> +/*
> + * Copyright © 2014 Red Hat, Inc.
> + * Copyright © 2014 Stephen Chandler "Lyude" Paul
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and
> + * its documentation for any purpose is hereby granted without fee, provided
> + * that the above copyright notice appear in all copies and that both that
> + * copyright notice and this permission notice appear in supporting
> + * documentation, and that the name of the copyright holders not be used in
> + * advertising or publicity pertaining to distribution of the software
> + * without specific, written prior permission.  The copyright holders make
> + * no representations about the suitability of this software for any
> + * purpose.  It is provided "as is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
> + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
> + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
> + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +#include "config.h"
> +#include "evdev-tablet.h"
> +
> +#include <assert.h>
> +#include <math.h>

I think this one is a leftover from a previous version, you can probably
remove it (and re-introduce it in the patch that needs it).

> +#include <stdbool.h>
> +#include <string.h>
> +
> +#define tablet_set_status(tablet_,s_) (tablet_->status |= (s_))
> +#define tablet_unset_status(tablet_,s_) (tablet_->status &= ~(s_))
> +#define tablet_has_status(tablet_,s_) (!!(tablet_->status & s_))

the last macro needs (s_), all three need to wrap tablet_

[...]

> @@ -756,6 +793,88 @@ struct libinput_event *
>  libinput_event_touch_get_base_event(struct libinput_event_touch *event);
>  
>  /**
> + * @defgroup event_tablet Tablet events
> + *
> + * Events that come from tablet devices.
> + */
> +
> +/**
> + * @ingroup event_tablet
> + *
> + * Checks if an axis was updated in this event or return 0 otherwise.
> + * For tablet events that are not of type LIBINPUT_EVENT_TABLET_AXIS,

needs a @ref

> + * this function returns 0.
> + *
> + * @note It is an application bug to call this function for events other than
> + * LIBINPUT_EVENT_TABLET_AXIS.

needs a @ref

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
   Peter



More information about the wayland-devel mailing list