[RFC] Common input device library
peter.hutterer at who-t.net
Tue Nov 12 22:22:39 PST 2013
On Tue, Nov 12, 2013 at 10:50:56PM +0100, Jonas Ådahl wrote:
> Wayland compositors are expected to deal with input device processing
> themselves providing input events according to the Wayland protocol to
> the clients. So far only weston has had more than basic support for
> processing raw input events from evdev.
> In order to avoid reimplementing support for various types of input
> devices over and over again for every compositor, I extracted the input
> device code from weston and put it in a new library called libinput.
funny timing, I just started on something similar recently :)
In my case it was more inspired by the xorg synaptics driver where I keep
running into issues that can't be fixed without a rewrite. so I started
with a library that should handle touchpads and can be used by X and
I just committed the current state, polished it a bit and pushed it to
The eventual goal was that Weston can use that for touchpads, but so far I
only have a shell X driver for it. Please have a look at that and let me
know what you think. There's something of an API, the basic design is
inspired by Weston.
fwiw, one reason I didn't just take evdev-touchpad.c is that I believe that
it's not possible to write a good touchpad driver without the driver
tracking and handling each touchpoint separately. weston currently doesn't
also, I don't yet know if this will or can turn into a generic input
library. I wanted to get the touchpad case sorted first since it's the most
complicated. having said that, libtouchpad could be sitting underneath
a more generic libinput (in design, not as separate library), similar to how
evdev-touchpad is underneath evdev.c
> The API is very inspired by the internal weston API, but with some
> simplifications and generalizations. The idea is to make it possible for
> other compositors to be able to plug it in and receive post-processed
> events such as pointer motion events, key events, touch events.
> This does not, however, mean that compositors shouldn't be able to
> receive raw input events; it's just not there yet as there is no user of
> such API.
> While making these changes, I removed some functionality, namely
> configuring evdev-touchpad via weston.ini. While it should obviously be
> possible to configure devices, I have yet to made API for doing so. Device
> detection logging is more limited as well.
fwiw, I don't do any device detection, the current entry point is
touchpad_open_from_path(), with a open_from_fd() being trivial to add.
configuration parsing is outside the library, but I have a few small hooks
to change tapping/scrolling parameters (not happy with the API here yet
> The repository of libinput can currently be found here . It is a
> history rewrite of the weston repository, so the history of related files
> are still intact.
> I have created patches for weston (that I will submit by replying to this
> E-mail) for consideration. I have tested this with a regular pointer
> device, keyboard, touchpad, but not with a touch device.
> This is more or less a RFC about this approach, and any input would be
IMO a separate library for the input handling is needed, thanks for
starting that effort. If we can sync up how to progress from here and if we
can find a common goal, that'd be great.
More information about the wayland-devel