Jonas Ådahl [Wed, 26 Feb 2014 18:54:51 +0000 (19:54 +0100)]
configure.ac: Bump to 0.1.0
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 26 Feb 2014 18:54:27 +0000 (19:54 +0100)]
configure.ac: Update URLs
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 26 Feb 2014 18:36:38 +0000 (19:36 +0100)]
Update README
Added links and updated the description.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Fri, 21 Feb 2014 21:18:37 +0000 (22:18 +0100)]
Makefile.am: Add private header to sources list
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Fri, 21 Feb 2014 21:17:17 +0000 (22:17 +0100)]
path: Silence -Wmaybe-uninitialized compiler warning
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 19 Feb 2014 20:39:26 +0000 (21:39 +0100)]
Split up the touch event into the different touch types
Instead of having one touch events representing different types of touch
events by providing a touch type, have one separate event type per touch
type. This means the LIBINPUT_EVENT_TYPE_TOUCH is replaced with
LIBINPUT_EVENT_TYPE_TOUCH_DOWN, LIBINPUT_EVENT_TYPE_TOUCH_MOTION,
LIBINPUT_EVENT_TYPE_TOUCH_UP and LIBINPUT_EVENT_TYPE_TOUCH_CANCEL.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Thu, 30 Jan 2014 21:44:49 +0000 (22:44 +0100)]
Add seat wide slot to touch events
Since a Wayland compositor have to represent all touch devices of a seat
as one virtual device, lets make that easier by also providing seat wide
slots with touch events.
Seat wide slots may be accessed using
libinput_event_touch_get_seat_slot().
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Tue, 25 Feb 2014 04:31:35 +0000 (14:31 +1000)]
Merge branch 'libevdev'
Peter Hutterer [Tue, 18 Feb 2014 22:45:57 +0000 (08:45 +1000)]
evdev: set CLOCK_MONOTONIC as the time source
Avoids erroneous timestamps when the system time is reset. This used to a be a
problem with the X.Org synaptics driver where taps, scrolling and a couple of
other things would potentially lock up.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 03:09:18 +0000 (13:09 +1000)]
Hook up event processing to libevdev
This gives us the ability to handle SYN_DROPPED transparently to the caller.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Fri, 6 Dec 2013 02:01:47 +0000 (12:01 +1000)]
Hook up libevdev as backend
libevdev wraps the various peculiarities of the evdev kernel API into a
type-safe API. It also buffers the device so checking for specific features at
a later time is easier than re-issuing the ioctls. Plus, it gives us almost
free support for SYN_DROPPED events (in the following patch).
This patch switches all the bit checks over to libevdev and leaves the event
processing as-is. Makes it easier to review.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Fri, 21 Feb 2014 06:13:02 +0000 (16:13 +1000)]
evdev: reset the device fd after closing it
A caller may have a reference to the device after closing it, make sure that
ref doesn't have a dangling fd so future attempts of reading from/writing to
the device fail.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Benjamin Tissoires [Mon, 17 Feb 2014 18:42:52 +0000 (13:42 -0500)]
evdev: fix device_transform_ functions
X and Y are li_fixed_t, which is 24.8 fixed point real number.
li_fixed_t max is thus ~8388607.
On a touchscreen with a range of 32767 values (like a 3M sensor), and
mapped on monitor with a resolution of 1920x1080, we currently have:
(x - li_fixed_from_int(device->abs.min_x)) * width ==
62912640
which is 7 times bigger than li_fixed_t max.
Force a cast to uint64_t to keep the precision of the sensor.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Tue, 18 Feb 2014 19:13:58 +0000 (20:13 +0100)]
test: Add scale li_fixed overflow test
Add a test case and test device that checks if the scale transform can
handle high resolution devices and output monitor resolutions.
The test case is created in a way that it will fail if the coordinate
transform expression will overflow if only 32 bit integer data
containers are used.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Tue, 18 Feb 2014 19:13:57 +0000 (20:13 +0100)]
test: Fix touch_down in wacom touch test device
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Wed, 19 Feb 2014 20:43:35 +0000 (21:43 +0100)]
event-debug: Display touch event seats as signed integer
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Wed, 12 Feb 2014 04:20:18 +0000 (14:20 +1000)]
Add a customizable log handler
The previous log handler wasn't actually hooked up to anything. Add a public
API for the log handler with priority filtering, defaulting to priority
'error' and stderr as output stream.
And to keep the diff down and convenience up, provide a few simple wrappers
for logging. The generic is log_msg(), but let's use log_info, log_error, etc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 12 Feb 2014 19:56:06 +0000 (20:56 +0100)]
evdev: Use -1 to represent touch events slots from single touch devices
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 12 Feb 2014 19:52:14 +0000 (20:52 +0100)]
Change touch event slots from being unsigned to signed
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 11 Feb 2014 22:30:28 +0000 (23:30 +0100)]
doc: Rephrase touch event slot description to be more event centric
It is unclear what "current" means as events are asynchronous, and
since a slot is associated with a touch event rather than a device,
change the description to reflect this.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 11 Feb 2014 22:29:34 +0000 (23:29 +0100)]
Fix coding style issues
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Fri, 7 Feb 2014 01:09:08 +0000 (11:09 +1000)]
evdev-touchpad: don't post motion events for 0/0 deltas
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 7 Feb 2014 00:32:03 +0000 (10:32 +1000)]
evdev-touchpad: replace some numbers with a #define
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 6 Feb 2014 05:26:02 +0000 (15:26 +1000)]
util: add min/max macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 10 Feb 2014 01:40:55 +0000 (11:40 +1000)]
Make it possible to have persistent libinput_seat instances
With this patch, a user can keep a reference to a libinput_seat
instance, which will cause the seat to never be unlinked from the
libinput context nor destroyed.
Previously, a when the last device of a seat was removed, the seat was
unlinked and if a new device was discovered with a previously empty seat
a new seat instance would always be created, meaning two potential seat
instances with identical physical and logical seat name pairs.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 10 Feb 2014 05:40:49 +0000 (15:40 +1000)]
evdev: restore EVDEV_UNHANDLED_DEVICE error code
If we don't have capabilities we can deal with, return a different
error so the backends can handle it separately (they already do).
Signe-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 6 Feb 2014 00:05:29 +0000 (10:05 +1000)]
test: Add tests for adding/removing devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 29 Jan 2014 05:35:20 +0000 (15:35 +1000)]
udev: rename create_from_udev to udev_create_for_seat
Maintain proper namespacing rename the backend-specific calls to
libinput_<backend>_<foo>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 29 Jan 2014 05:38:48 +0000 (15:38 +1000)]
path: add libinput_path_create_context instead of libinput_create_from_path
Creates an empty context that is not hooked up to a device. Callers can then
add and remove devices to this context using libinput_path_add_device() and
libinput_path_remove_device().
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 29 Jan 2014 06:37:45 +0000 (16:37 +1000)]
path: add libinput_path_add_device() and libinput_path_remove_device()
This allows multiple devices to share a single libinput context. The new
function returns the newly added device immediately. Unlike the udev seat
where devices may or may not be added - over the lifetime of the seat - a
path-based backend knows immediately if device exists or doesn't exist.
Returning the device is required by callers that have the event processing
separate from adding devices - by the time we have the DEVICE_ADDED event in
the queue we may have other events to process first. And the DEVICE_ADDED
event won't easily link to the path we gave it anyway, so it's hard to figure
out which DEVICE_ADDED event corresponds to the new device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 29 Jan 2014 05:57:53 +0000 (15:57 +1000)]
path: modify backend to allow for more than one device
The previous path backend created a libinput context attached to a single
device. This is insufficient when we need to use cross-device functionality.
One example of this cross-device functionality include disabling a touchpad
while the trackstick is in use (Lenovo T440 and related models).
This patch merely adds the infrastructure to support multiple devices for a
path backend. Follow-up patches add the function calls to add and remove
devices. This is needed by Xorg input drivers that still make use of the
server's device hotplug mechanisms but want to otherwise use libinput.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 10 Feb 2014 01:22:39 +0000 (11:22 +1000)]
Revert "evdev: restore EVDEV_UNHANDLED_DEVICE error code"
This reverts commit
e8c20c7241d29aa3b725e6a03d52656cafacf0e0.
Ooops, bad rebase. This accesses the device after it was already destroyed
which is not the intent of the patch.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 5 Feb 2014 23:33:26 +0000 (09:33 +1000)]
evdev: restore EVDEV_UNHANDLED_DEVICE error code
If we don't have capabilities we can deal with, return a different error so
the backends can handle it separately (they already do).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 5 Feb 2014 23:26:00 +0000 (09:26 +1000)]
evdev: if mtdev failed to open, fail to init the device
We can't handle protocol A devices properly without mtdev, so skip the device
altogether.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 29 Jan 2014 06:08:54 +0000 (16:08 +1000)]
path: add error handling for failing to create a seat
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 30 Jan 2014 04:54:31 +0000 (14:54 +1000)]
Move opening and closing the device fd into evdev.c
evdev_device_remove() already calls close(device->fd). Move the
close_restricted call there to avoid one privileged call in the backend and
one in the device. And move the open_restricted() into the evdev device too to
reduce the duplicated code in the two backends.
Update to one of the tests: since we'd now fail getting the device node from
the invalid /tmp path, the open_func_count is 0.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 3 Feb 2014 04:23:38 +0000 (14:23 +1000)]
test: plug a memory leak, all events need to be destroyed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 3 Feb 2014 22:35:24 +0000 (23:35 +0100)]
evdev: Fix absolute coordinate transform formula
Since the device min/max x/y coordinates are inclusive, to get the
width/height one need to add one to (min x/y - max x/y).
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 28 Jan 2014 21:50:26 +0000 (22:50 +0100)]
Remove mention of delta coordinates having device specific direction
The event represent pointer motions on a screen, so this information is
unnecessary. It could also be confused for meaning the provided
coordinate's direction being device specific.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 25 Jan 2014 10:53:53 +0000 (11:53 +0100)]
Replace output screen size callback with transform helpers
Instead of automatically transforming absolute coordinates of touch and
pointer events to screen coordinates, the user now uses the corresponding
transform helper function. This means the coordinates returned by
libinput_event_pointer_get_absolute_x(),
libinput_event_pointer_get_absolute_y(), libinput_touch_get_x() and
libinput_touch_get_y() has changed from being in output screen coordinate
space to being in device specific coordinate space.
For example, where one before would call libinput_event_touch_get_x(event),
one now calls libinput_event_touch_get_x_transformed(event, output_width).
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Thu, 16 Jan 2014 01:25:26 +0000 (11:25 +1000)]
path: fix inconsistent use of devnode vs input->path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 16 Jan 2014 00:56:01 +0000 (10:56 +1000)]
test: don't leak open/closed counts into the next test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 28 Jan 2014 01:25:40 +0000 (11:25 +1000)]
tools: add a tool for basic event debugging
Simply prints the various events to make it easier to check what's coming out
of libinput. Works for --udev (the default) or for --device /dev/input/event0.
Example output:
event7 DEVICE_ADDED seat0 default
event8 DEVICE_ADDED seat0 default
event4 POINTER_BUTTON +1.35s 272 pressed
event5 POINTER_MOTION +2.31s -3.00/ 2.00
Time is displayed relative to the starting time.
Note: statically linked for easier debugging, but we don't distribute it
(yet) anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Tue, 28 Jan 2014 05:54:34 +0000 (15:54 +1000)]
test: Make sure the sysname of a device is correct
Currently this means start with "event" and don't contain /.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Wed, 29 Jan 2014 01:37:47 +0000 (11:37 +1000)]
path: print error when failing to open a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Tue, 28 Jan 2014 05:46:37 +0000 (15:46 +1000)]
path: store the sysname, not the syspath, in the device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Tue, 28 Jan 2014 21:28:03 +0000 (07:28 +1000)]
Add COPYING file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Mon, 27 Jan 2014 22:33:46 +0000 (23:33 +0100)]
evdev: Don't queue touch events when no touch capability is reported
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Mon, 27 Jan 2014 22:27:16 +0000 (23:27 +0100)]
evdev: Don't report touch devices with buttons as actual touch devices
This was a detail of the original version of the commit "evdev: Remove
EVDEV_TOUCH and with it evdev_device->caps" that got lost during porting.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 25 Jan 2014 10:52:33 +0000 (11:52 +0100)]
Document the LIBINPUT_EVENT_NONE event type
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 25 Jan 2014 10:46:55 +0000 (11:46 +0100)]
Allow initial device configuration after receiving DEVICE_ADDED event
By specifying that a device will not be read until the next time the
user calls libinput_dispatch(), if data is available, it will allow for
setting up initial configuration, such as tap button, output screen
size, acceleration parameters, etc.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 25 Jan 2014 10:33:09 +0000 (11:33 +0100)]
Fix some coding style inconsistencies
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 22 Jan 2014 22:48:39 +0000 (23:48 +0100)]
evdev: Make evdev manage its seat reference
Before the seat reference would be decreased when a device was removed.
This could cause libinput_device_get_seat() to potentially return an
invalid pointer when a device was removed, its seat unreferenced and
destryoed.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 22 Jan 2014 22:59:05 +0000 (23:59 +0100)]
Remove redundant device pointer from device notify event
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 22 Jan 2014 22:45:44 +0000 (23:45 +0100)]
Simplify device reference counting of events
This also makes DEVICE_ADDED/REMOVED events own a reference, which is
necessary to not have libinput_event_get_device() potentially returning
an invalid pointer.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 22 Jan 2014 22:43:45 +0000 (23:43 +0100)]
evdev: Make error handling more consistent
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Wed, 22 Jan 2014 00:34:11 +0000 (10:34 +1000)]
test: add a simple touch test
Currently testing for touch frame events only
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 04:17:01 +0000 (14:17 +1000)]
test: add basic pointer motion and button test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 23:58:43 +0000 (09:58 +1000)]
test: add a wacom touch devices (absolute touchscreen)
This means we do have to provide the get_current_screen_dimensions() call in
litest now, just hardcode it to 1024x768.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 05:18:09 +0000 (15:18 +1000)]
test: Add a basic mouse test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 22 Jan 2014 01:20:50 +0000 (11:20 +1000)]
test: Add a common helper function to drain all current events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 05:48:06 +0000 (15:48 +1000)]
evdev: don't ignore scroll events with a value greater than 1/-1
Higher values than 1 or -1 are legitimate on some devices, though not all mice
send wheel events other than 1/-1.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 02:03:47 +0000 (12:03 +1000)]
path: get ID_SEAT and WL_SEAT from udev for the device node
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 21 Jan 2014 03:56:12 +0000 (13:56 +1000)]
Drop event classes
There are now only two event classes and only two users of the event class.
It's easier to use the event type directly to see which event has references
and which one doesn't.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 20 Dec 2013 00:15:00 +0000 (10:15 +1000)]
Promote touch frames to top-level events
These events are not a state of a single touchpoints but rather a notification
that all touchpoints finished processing. As such, they should have their own
type.
And make sure we actually send them when needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 23:22:32 +0000 (09:22 +1000)]
Provide accessors to retrieve the right event type
Slightly enhances the type-safety. A caller may now do something along the
lines of
struct libinput_event_pointer *ptrev;
ptrev = libinput_event_get_pointer_event(event);
if (!ptrev)
oops, that wasn't a pointer event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 07:50:49 +0000 (17:50 +1000)]
Add documentation for the various events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 22 Jan 2014 01:01:24 +0000 (11:01 +1000)]
zalloc all events to make sure we have defined defaults
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 07:16:19 +0000 (17:16 +1000)]
Reduce touch events to a single event type
No real effect since we're hiding the actual touch events through the touch
type.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 03:15:28 +0000 (13:15 +1000)]
Reduce pointer events to one single type
The event type itself says enough about the actual event type, we don't need
to have separate structs for every type.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 06:40:48 +0000 (16:40 +1000)]
Reduce keyboard events to one single type
Provide one top-level event for keyboard events: libinput_event_keyboard. The
event type specifies which subtype the event is anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 02:04:24 +0000 (12:04 +1000)]
Improve namespacing of event types
Now that the target of an event isn't exposed to the caller anymore, the
namespacing can be associated with a more intuitive one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 15 Jan 2014 07:10:30 +0000 (17:10 +1000)]
Merge the device added/removed events into a single device notify event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 01:42:55 +0000 (11:42 +1000)]
Drop libinput_event_get_target()
Replaced by specific accessor functions for context, seat and device. This
obsoletes the internal target as well, we just direcly ref the element we need
to instead of temporarily storing it in the target.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 17 Jan 2014 07:59:30 +0000 (17:59 +1000)]
Add a generic libinput_event_get_device() function
After dropping seat evens, all events are now are associated with a device, so
provide a generic accessor function and drop the custom ones.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 15 Jan 2014 07:04:00 +0000 (17:04 +1000)]
Split seats into having a physical and a logical name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 15 Jan 2014 06:31:29 +0000 (16:31 +1000)]
Drop seat events
seats are more a compositor concept than a concept of the input library. All
devices in a libinput context are associated with the seat given on creation
of the seat (maps to ID_SEAT in udev for the udev backend).
A logical seat may be assigned to a device (e.g. WL_SEAT) but this does not
necessarily map to the creation of the seat in the compositor.
Drop the seat events but keep seat objects around so that the caller can still
identify which seat a device belongs to.
If the libinput_seat_unref() in the udev backend destroys the seat, the device
list of that seat is invalid and we'd be accessing already freed bytes. To
avoid this, ref the seat before the device removal loop, then unref it once
we're done - that unref then may trigger the actual removal of the seat.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 19 Dec 2013 01:22:53 +0000 (11:22 +1000)]
Add libinput_event_get_context()
Add a function to retrieve the libinput context from any event.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 15 Jan 2014 06:57:30 +0000 (16:57 +1000)]
udev: Drop unused seat_name in struct udev_seat
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Wed, 15 Jan 2014 22:24:21 +0000 (23:24 +0100)]
test: Remove short option and fail on invalid options
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 15 Jan 2014 20:33:00 +0000 (21:33 +0100)]
test: Add udev suspend->resume test
Tests that suspend removes devices and that resume rediscovers them.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 15 Jan 2014 20:11:51 +0000 (21:11 +0100)]
test: Fix optstring in getopt_long call
Was missing the "l".
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Wed, 8 Jan 2014 07:39:27 +0000 (17:39 +1000)]
test: udev suspend tests
Peter Hutterer [Wed, 8 Jan 2014 07:39:16 +0000 (17:39 +1000)]
test: path suspend tests
Peter Hutterer [Tue, 10 Dec 2013 03:30:52 +0000 (13:30 +1000)]
test: add tests for libinput_create_from_path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
squashme path test
Peter Hutterer [Mon, 9 Dec 2013 06:36:11 +0000 (16:36 +1000)]
test: add a couple of tests for the udev-seat backend
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 05:02:11 +0000 (15:02 +1000)]
Add a device test suite
A rather large commit, copied from a similar (almost identical) suite in
libtouchpad and ported for libinput.
The goal here is to make testing for various devices easy, so the litest
("libinput test") wrappers do that. The idea is that each device has some
features, and tests are likely to exercise some features or won't work with
other features.
Each test case takes a list of required features and a list of excluded
features. The test suite will create a new test case for each device in the
suite that matches that set.
For example, the set of required LITEST_TOUCHPAD, excluded LITEST_BUTTON would
run on clickpads only, not on touchpads with buttons.
check supports suites and test cases, both named. We wrap that so that each
named set of cases we add are a test suite, with the set of devices being the
test cases. i.e.
litest_add("foo:bar", some_test_function, LITEST_ANY, LITEST_ANY);
adds a suite named "foo:bar" and test cases for both devices given, with their
shortnames as test case name, resulting in:
"foo:bar", "trackpoint"
"foo:bar", "clickpad"
...
Multiple test functions can be added to a suite. For tests without a device
requirement there is litest_add_no_device_test(...).
The environment variables CK_RUN_SUITE and CK_RUN_CASE can be used to narrow
the set of test cases. The test suite detects when run inside a debugger and
disables fork mode (the default).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 10 Dec 2013 22:20:59 +0000 (08:20 +1000)]
test: add test for minimal linker flags
The most basic program using libinput should only need to link against -linput
and get the rest resolved automatically.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 04:18:39 +0000 (14:18 +1000)]
test: add a build-test for -pedantic
We don't build with -pedantic, but a caller may try to actually stick to the
c99 standard, so let's make sure our public header doesn't cause any
issues there.
Likewise, make sure that our header compiles with GNU C90.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 04:17:35 +0000 (14:17 +1000)]
Add the framework for a test suite
Just the scaffolding, no actual tests just yet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 04:29:01 +0000 (14:29 +1000)]
Make sure our public header compiles with -pedantic
We don't use -pedantic, but a user of libinput may so let's make sure we don't
fail.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 10 Jan 2014 03:33:02 +0000 (13:33 +1000)]
gitignore: ignore .swp files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 13 Dec 2013 07:58:50 +0000 (17:58 +1000)]
Add libinput_next_event_type()
Returns the event type of the next event pending in the queue. For systems
that have the device init state separate from the actual event procesing
(read: xorg drivers) we need to be able to peek at the next event type to
check for the end of any initialization events (seat/device added) and the
beginning of actual device input events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 13 Dec 2013 07:49:38 +0000 (17:49 +1000)]
Add LIBEVENT_EVENT_NONE
This event type is needed to notify callers that there is currently no
event waiting (in a follow-up patch). Also, it it avoids true/false
inconsistencies on event types (LIBINPUT_EVENT_ADDED_SEAT would otherwise be
the only FALSE event). While that's not technically necessary, it may prevent
the odd bug further down the road.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 9 Jan 2014 03:12:23 +0000 (13:12 +1000)]
Drop capability events
We don't really support devices changing capabilities at runtime. The kernel
has no ability to tell us when this happens on an already-opened device and
the few devices that can literally change physical capabilities (e.g. the
wiimote) open up extra kernel devices instead of modifying the existing one.
Thus, we don't need to notify about devices changing capabilities.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 10 Dec 2013 03:20:36 +0000 (13:20 +1000)]
Add libinput_create_from_path
Hooking libinput up to udev isn't always possible, especially if libinput were
to be used in the X server which already has the udev handling built-in.
Add an option to create a context from a path.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 7 Jan 2014 04:54:55 +0000 (14:54 +1000)]
Suspend libinput before destroying it
libinput_suspend() already causes the fds to be closed, devices and seats to
be removed, etc. Call it before libinput_destroy() to reduce the
backend-specific code.
No real functional change, the udev backend already did this anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 23 Dec 2013 04:16:03 +0000 (14:16 +1000)]
udev: notify about a removed seat when the last device is removed
When the last device is removed from a seat, destroy the seat.
This guarantees seat removal events on libinput_suspend() as well.
Note that the seat must be manually unlinked, we can't rely on the unlinking
in libinput_seat_destroy. After the event, the seat's refcount is always > 1,
so the seat will live on until the event is destroyed. We need to make sure
it's not in the list anymore though.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 23 Dec 2013 04:10:56 +0000 (14:10 +1000)]
udev: Refcount the seat for each device
Use the seat's internal refcounting to up the reference each time we have a
device using it. This fixes the issue with seats being created but never
actually removed by anything.
udev_seat_get_named() will now return a seat with refcount 1 for a newly
created seat, or just up the refcount for the seat if it already exists.
This requires that the ADDED_SEAT and REMOVED_SEAT events up the refcount of
the seat as well: a device may be removed before the event is processed,
without the refcount the seat would be destroyed (if it's the last device on
the seat).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 13 Dec 2013 01:37:31 +0000 (11:37 +1000)]
Abstract the backend interface away
Remove the fixed calls into the udev backend and provide a basic interface
instead that allows other backends to hook into device/seat creation. This
enables multiple backends, specifically a path-based backend that is needed
for X.Org drivers.
This patch should have no visible functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>