Commit graph

22 commits

Author SHA1 Message Date
Peter Hutterer
b4a74bcebc Assert that the interface is actually filled in.
Had this in a private bug report recently. Missing hooks for open/close just
segfault with little information to debug. Add an assert, this is definitely a
bug in the caller and we don't need to recover from that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-07 13:05:26 +10:00
Peter Hutterer
cc46e00e81 test: fix memleak in the udev_device_sysname() test
If a device sends other events at startup, those events weren't freed. This
can happen on tablet devices that send proximity events immediately after
DEVICE_ADDED.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-09 16:47:07 +10:00
Peter Hutterer
bc9f16b40e COPYING: Update boilerplate from MIT X11 to MIT Expat license
To quote Bryce Harrington from [1]:
"MIT has released software under several slightly different licenses,
including the old 'X11 License' or 'MIT License'.  Some code under this
license was in fact included in X.org's Xserver in the past.  However,
X.org now prefers the MIT Expat License as the standard (which,
confusingly, is also referred to as the 'MIT License').  See
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

When Wayland started, it was Kristian Høgsberg's intent to license it
compatibly with X.org.  "I wanted Wayland to be usable (license-wise)
whereever X was usable."  But, the text of the older X11 License was
taken for Wayland, rather than X11's current standard.  This patch
corrects this by swapping in the intended text."

libinput is a fork of weston and thus inherited the original license intent
and the license boilerplate itself.

See this thread on wayland-devel here for a discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-May/022301.html

[1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022552.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2015-06-16 14:36:04 +10:00
Peter Hutterer
0ca29c6ddc Add streq() helper to use instead of strcmp() == 0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-26 08:46:05 +10:00
Peter Hutterer
9dbeb9d0f7 test: move main() into litest
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:33 +10:00
Peter Hutterer
6e6cca47af Add libinput_set_user_data
Previously, the pointer could only be passed into the context on creation
time and was immutable after that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 14:49:39 +10:00
Peter Hutterer
348cff5701 test: add seat changing tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-25 16:34:22 +10:00
Jonas Ådahl
4be59a972a test: Use only one test device for some udev and path tests
Some tests in test/path.c and test/udev.c are not dependent on
device behaviour but rather managing of device lifetime etc. Run those
tests only once with only one device, resulting more or less the same
code coverage but shorter run time.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:35:19 +02:00
Peter Hutterer
125e98a1f8 style fix: Remove duplicate empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-22 09:00:45 +10:00
Peter Hutterer
bad56cac5b Merge branch 'ref-counting-context'
Conflicts:
	src/udev-seat.c
	test/log.c
2014-06-25 10:32:42 +10:00
Jonas Ådahl
faab25c25c Make context reference counted
Instead of only allowing one owner keeping a libinput context alive,
make context reference counted, replacing libinput_destroy() with
libinput_unref() while adding another function libinput_ref().

Even though there might not be any current use cases, it doesn't mean we
should hard code this usage model in the API. The old behaviour can be
emulated by never calling libinput_ref() while replacing
libinput_destroy() with libinput_unref().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 10:27:03 +10:00
Peter Hutterer
6250397ac8 udev: split libinput_udev context init into two functions
This is preparation work for context-specific log handlers.

Callers are now encouraged to first initialize the context with
libinput_udev_create_context() and then set the seat for this context with
libinput_udev_assign_seat().

In the upcoming patch to support context-specific log handlers this enables a
caller to set the log handler for a context before any devices are
initialized. Otherwise, a log message generated by a new device may pass a
libinput context that the caller is not yet aware of.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-23 15:39:08 +10:00
Jonas Ådahl
b34139c9e7 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>
2014-02-10 22:28:46 +01:00
Peter Hutterer
75427b0788 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>
2014-02-10 11:23:36 +10:00
Peter Hutterer
20416ae4b7 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>
2014-01-31 14:57:18 +10:00
Peter Hutterer
54db6527ae 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>
2014-01-21 22:50:59 +01:00
Peter Hutterer
60d46e6bd7 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>
2014-01-21 22:50:58 +01:00
Peter Hutterer
c29a8e8093 Split seats into having a physical and a logical name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-17 18:17:45 +10:00
Peter Hutterer
5b5b6bca06 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>
2014-01-17 18:17:11 +10:00
Jonas Ådahl
9659511693 test: Add udev suspend->resume test
Tests that suspend removes devices and that resume rediscovers them.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-01-15 21:33:00 +01:00
Peter Hutterer
541b1c4891 test: udev suspend tests 2014-01-15 12:03:25 +10:00
Peter Hutterer
08d0c55e62 test: add a couple of tests for the udev-seat backend
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-15 12:03:25 +10:00