platform/upstream/libinput.git
10 years agoAdd COPYING file
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>
10 years agoevdev: Don't queue touch events when no touch capability is reported
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>
10 years agoevdev: Don't report touch devices with buttons as actual touch devices
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>
10 years agoDocument the LIBINPUT_EVENT_NONE event type
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>
10 years agoAllow initial device configuration after receiving DEVICE_ADDED event
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>
10 years agoFix some coding style inconsistencies
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>
10 years agoevdev: Make evdev manage its seat reference
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>
10 years agoRemove redundant device pointer from device notify event
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>
10 years agoSimplify device reference counting of events
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>
10 years agoevdev: Make error handling more consistent
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>
10 years agotest: add a simple touch test
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>
10 years agotest: add basic pointer motion and button test
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>
10 years agotest: add a wacom touch devices (absolute touchscreen)
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>
10 years agotest: Add a basic mouse test device
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>
10 years agotest: Add a common helper function to drain all current events
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>
10 years agoevdev: don't ignore scroll events with a value greater than 1/-1
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>
10 years agopath: get ID_SEAT and WL_SEAT from udev for the device node
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>
10 years agoDrop event classes
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>
10 years agoPromote touch frames to top-level events
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>
10 years agoProvide accessors to retrieve the right event type
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>
10 years agoAdd documentation for the various events
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>
10 years agozalloc all events to make sure we have defined defaults
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>
10 years agoReduce touch events to a single event type
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>
10 years agoReduce pointer events to one single type
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>
10 years agoReduce keyboard events to one single type
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>
10 years agoImprove namespacing of event types
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>
10 years agoMerge the device added/removed events into a single device notify event
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>
10 years agoDrop libinput_event_get_target()
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>
10 years agoAdd a generic libinput_event_get_device() function
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>
10 years agoSplit seats into having a physical and a logical name
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>
10 years agoDrop seat events
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>
10 years agoAdd libinput_event_get_context()
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>
10 years agoudev: Drop unused seat_name in struct udev_seat
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>
10 years agotest: Remove short option and fail on invalid options
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>
10 years agotest: Add udev suspend->resume test
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>
10 years agotest: Fix optstring in getopt_long call
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>
10 years agotest: udev suspend tests
Peter Hutterer [Wed, 8 Jan 2014 07:39:27 +0000 (17:39 +1000)]
test: udev suspend tests

10 years agotest: path suspend tests
Peter Hutterer [Wed, 8 Jan 2014 07:39:16 +0000 (17:39 +1000)]
test: path suspend tests

10 years agotest: add tests for libinput_create_from_path
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

10 years agotest: add a couple of tests for the udev-seat backend
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>
10 years agoAdd a device test suite
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>
10 years agotest: add test for minimal linker flags
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>
10 years agotest: add a build-test for -pedantic
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>
10 years agoAdd the framework for a test suite
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>
10 years agoMake sure our public header compiles with -pedantic
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>
10 years agogitignore: ignore .swp files
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>
10 years agoAdd libinput_next_event_type()
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>
10 years agoAdd LIBEVENT_EVENT_NONE
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>
10 years agoDrop capability events
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>
10 years agoAdd libinput_create_from_path
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>
10 years agoSuspend libinput before destroying it
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>
10 years agoudev: notify about a removed seat when the last device is removed
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>
10 years agoudev: Refcount the seat for each device
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>
10 years agoAbstract the backend interface away
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>
10 years agoDrop the destroyed sources list on libinput_destroy()
Peter Hutterer [Tue, 7 Jan 2014 05:45:55 +0000 (15:45 +1000)]
Drop the destroyed sources list on libinput_destroy()

==2772== 40 bytes in 1 blocks are definitely lost in loss record 3 of 4
==2772==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2772==    by 0x405EC7: libinput_add_fd (libinput.c:335)
==2772==    by 0x40B346: udev_input_enable (udev-seat.c:268)
==2772==    by 0x40B5E7: libinput_create_from_udev (udev-seat.c:369)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAllow libinput_destroy() on a NULL pointer
Peter Hutterer [Tue, 24 Dec 2013 01:00:37 +0000 (11:00 +1000)]
Allow libinput_destroy() on a NULL pointer

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoudev: plug leak when double-resuming
Peter Hutterer [Wed, 8 Jan 2014 02:53:46 +0000 (12:53 +1000)]
udev: plug leak when double-resuming

Leak when calling
  libinput_suspend();
  libinput_resume();
  libinput_resume();

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAdd two asserts to avoid underrunning the seat/device refcount
Peter Hutterer [Wed, 8 Jan 2014 06:40:14 +0000 (16:40 +1000)]
Add two asserts to avoid underrunning the seat/device refcount

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAlways allocate an event queue
Peter Hutterer [Tue, 24 Dec 2013 03:50:10 +0000 (13:50 +1000)]
Always allocate an event queue

On the typical setup we have at least 3 events pending as soon as we hook it
up (seat added, device added, capability). In the udev case we get up to > 64
events without even having input events on my laptop with only two extra
devices connected. So always allocate an event buffer to avoid spurious
resizing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoDon't access event buffer after realloc
Peter Hutterer [Tue, 24 Dec 2013 03:46:20 +0000 (13:46 +1000)]
Don't access event buffer after realloc

realloc() may free the original event buffer, don't access it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agogitignore: ignore ctags files
Peter Hutterer [Tue, 24 Dec 2013 00:52:28 +0000 (10:52 +1000)]
gitignore: ignore ctags files

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agogitignore: generalise .libs/ and .deps/
Peter Hutterer [Tue, 24 Dec 2013 00:51:41 +0000 (10:51 +1000)]
gitignore: generalise .libs/ and .deps/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoRemove duplicate gitignore entries
Peter Hutterer [Tue, 24 Dec 2013 00:51:17 +0000 (10:51 +1000)]
Remove duplicate gitignore entries

Already covered by a global rule

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoDestroy associated reference counted objects when destroying context
Jonas Ådahl [Tue, 31 Dec 2013 15:11:03 +0000 (16:11 +0100)]
Destroy associated reference counted objects when destroying context

This avoids issues with device and seat objects depending on a valid
context.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoudev-seat: Don't notify about removal when destroying context
Jonas Ådahl [Tue, 31 Dec 2013 13:45:50 +0000 (14:45 +0100)]
udev-seat: Don't notify about removal when destroying context

As events will just be destroyed before leaving the libinput scope
during destruction, don't waste time on queueing them.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoDestroy unprocessed events properly when destroying context
Jonas Ådahl [Mon, 30 Dec 2013 21:11:33 +0000 (22:11 +0100)]
Destroy unprocessed events properly when destroying context

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoDon't return error when dispatching didn't queue any event
Jonas Ådahl [Mon, 30 Dec 2013 21:08:35 +0000 (22:08 +0100)]
Don't return error when dispatching didn't queue any event

As reading from timers or evdev does not necessarily mean an input
event is queued and ready to be retrieved with libinput_get_event(),
don't report such behaviour as an error.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev: Drop joystick rejection heurstics
Kristian Høgsberg [Mon, 16 Dec 2013 23:57:53 +0000 (15:57 -0800)]
evdev: Drop joystick rejection heurstics

We now no longer add joysticks at all.  They show up as absolute motion
devices without has_button, so we don't add them as a pointer.  We may add
a keyboard for the keyboard-style keys, but that's fine.  With the previous
commit, we no longer generate spurious absolute pointer motion for the abs
axes.

https://bugs.freedesktop.org/show_bug.cgi?id=71687

10 years agoevdev: Reject absolute motion if we're not a pointer or a touch device
Kristian Høgsberg [Mon, 16 Dec 2013 23:51:22 +0000 (15:51 -0800)]
evdev: Reject absolute motion if we're not a pointer or a touch device

Some joysticks have certain buttons that acts keyboard keys.  As such,
we'll reconize them as keyboards but not pointers.  In that case, don't
send pointer motion events when we get absolute joystick events.

10 years agoevdev: Drop obsolete accelerometer reject rule
Kristian Høgsberg [Mon, 16 Dec 2013 23:37:16 +0000 (15:37 -0800)]
evdev: Drop obsolete accelerometer reject rule

This rule triggers for devices with an ABS_X/Y evaluators and no
keyboard or multitouch events.  There is no way we would ever add such
a device as a pointer, keyboard or touch device anyway.  A pointer
device requires has_button (in which case the !has_key condtion would
fail); a keyboard device would also mean !has_key is false and a touch
screen device implies that !device->is_mt is false.

10 years agoevdev: Remove EVDEV_TOUCH and with it evdev_device->caps
Kristian Høgsberg [Mon, 16 Dec 2013 23:19:30 +0000 (15:19 -0800)]
evdev: Remove EVDEV_TOUCH and with it evdev_device->caps

We now keep all the configuration intermediate results inside
evdev_configure_device() and the result is device->seat_caps.

10 years agoevdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit
Kristian Høgsberg [Mon, 16 Dec 2013 23:07:59 +0000 (15:07 -0800)]
evdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit

10 years agoevdev: Replace EVDEV_BUTTON with local has_button flag
Kristian Høgsberg [Mon, 16 Dec 2013 22:43:29 +0000 (14:43 -0800)]
evdev: Replace EVDEV_BUTTON with local has_button flag

10 years agoevdev: Replace EVDEV_MOTION_ABS with local has_abs flag
Kristian Høgsberg [Mon, 16 Dec 2013 21:55:48 +0000 (13:55 -0800)]
evdev: Replace EVDEV_MOTION_ABS with local has_abs flag

10 years agoevdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events
Kristian Høgsberg [Mon, 16 Dec 2013 21:42:40 +0000 (13:42 -0800)]
evdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events

We split up has_abs into plain ABS_X/Y and MT events, but this shouldn't
introduce any logic changes.

10 years agoevdev: Drop EVDEV_MOTION_REL flag
Kristian Høgsberg [Mon, 16 Dec 2013 19:25:19 +0000 (11:25 -0800)]
evdev: Drop EVDEV_MOTION_REL flag

This is only used inside evdev_configure_device() and we now use a local
has_rel flag instead.

10 years agoevdev: Combine evdev_handle_device() and evdev_configure_device()
Kristian Høgsberg [Mon, 16 Dec 2013 19:01:56 +0000 (11:01 -0800)]
evdev: Combine evdev_handle_device() and evdev_configure_device()

We split the device probing and idenfication somewhat arbitrarily between
these two functions.  This commit combines them into one.  Return of -1
indicates error, 0 success, but succesful probing can return a device
with device->caps == 0, which means we don't handle the device.

10 years agodoc: extract static members as well
Peter Hutterer [Thu, 19 Dec 2013 01:06:40 +0000 (11:06 +1000)]
doc: extract static members as well

We only run doxygen over the public headers, so if we have a static function
in those make sure they show up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoDocumentation typo fix
Peter Hutterer [Fri, 13 Dec 2013 07:50:49 +0000 (17:50 +1000)]
Documentation typo fix

10 years agoFix typo in comment
Peter Hutterer [Fri, 13 Dec 2013 04:40:33 +0000 (14:40 +1000)]
Fix typo in comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoDocument the open/close_restricted interface
Peter Hutterer [Fri, 13 Dec 2013 01:04:01 +0000 (11:04 +1000)]
Document the open/close_restricted interface

Specifically, document that it needs to return a negative errno on failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAdd libudev and -lm to Requires.private
Peter Hutterer [Tue, 10 Dec 2013 21:27:02 +0000 (07:27 +1000)]
Add libudev and -lm to Requires.private

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAdd -lm to library
Peter Hutterer [Tue, 10 Dec 2013 22:03:33 +0000 (08:03 +1000)]
Add -lm to library

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoudev: print errno if we can't open a device
Peter Hutterer [Fri, 13 Dec 2013 01:05:07 +0000 (11:05 +1000)]
udev: print errno if we can't open a device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoutil: add ARRAY_FOR_EACH helper
Peter Hutterer [Fri, 6 Dec 2013 04:35:22 +0000 (14:35 +1000)]
util: add ARRAY_FOR_EACH helper

Requires c99, but that's the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agodoc: group li_fixed_t into the fixed point functions
Peter Hutterer [Thu, 19 Dec 2013 01:05:29 +0000 (11:05 +1000)]
doc: group li_fixed_t into the fixed point functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoMove zalloc() up to libinput-util.h
Peter Hutterer [Fri, 6 Dec 2013 04:47:09 +0000 (14:47 +1000)]
Move zalloc() up to libinput-util.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoUnref seats and devices in libinput_destroy()
Jonas Ådahl [Mon, 16 Dec 2013 21:52:05 +0000 (22:52 +0100)]
Unref seats and devices in libinput_destroy()

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoudev-seat: Remove unused declaration
Jonas Ådahl [Sun, 15 Dec 2013 20:25:10 +0000 (21:25 +0100)]
udev-seat: Remove unused declaration

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoudev: include libinput-private.h for struct libinput
Peter Hutterer [Tue, 10 Dec 2013 01:39:29 +0000 (11:39 +1000)]
udev: include libinput-private.h for struct libinput

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agofix typo in documentation
Peter Hutterer [Tue, 10 Dec 2013 01:33:29 +0000 (11:33 +1000)]
fix typo in documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoconfigure: require c99
Peter Hutterer [Fri, 6 Dec 2013 04:52:38 +0000 (14:52 +1000)]
configure: require c99

This enables a few nice things that gcc would otherwise not allow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoudev: fail libinput_create_from_udev for NULL values
Peter Hutterer [Mon, 9 Dec 2013 06:34:49 +0000 (16:34 +1000)]
udev: fail libinput_create_from_udev for NULL values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoconfigure: add libudev dependency
Peter Hutterer [Mon, 9 Dec 2013 06:21:06 +0000 (16:21 +1000)]
configure: add libudev dependency

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAllow for NULL in libinput_destroy
Peter Hutterer [Mon, 9 Dec 2013 11:27:31 +0000 (21:27 +1000)]
Allow for NULL in libinput_destroy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoAllow for NULL in libevdev_event_destroy
Peter Hutterer [Mon, 9 Dec 2013 11:26:54 +0000 (21:26 +1000)]
Allow for NULL in libevdev_event_destroy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoIntroduce libinput_device_get_sysname() API
Jonas Ådahl [Sun, 15 Dec 2013 16:50:04 +0000 (17:50 +0100)]
Introduce libinput_device_get_sysname() API

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoExport li_fixed_to_(int|double) converters
Jonas Ådahl [Sun, 15 Dec 2013 16:47:45 +0000 (17:47 +0100)]
Export li_fixed_to_(int|double) converters

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoIntroduce libinput_device_has_capability() API
Jonas Ådahl [Sun, 15 Dec 2013 16:45:02 +0000 (17:45 +0100)]
Introduce libinput_device_has_capability() API

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agodoc: Document basic event accessor functions
Jonas Ådahl [Sun, 8 Dec 2013 15:35:04 +0000 (16:35 +0100)]
doc: Document basic event accessor functions

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>