Commit graph

399 commits

Author SHA1 Message Date
Peter Hutterer
1ee5b28c6e 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>
2014-01-09 11:13:53 +10:00
Peter Hutterer
cd6a65bf37 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>
2014-01-08 20:45:58 +01:00
Peter Hutterer
4e67b6da39 Allow libinput_destroy() on a NULL pointer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-08 20:45:58 +01:00
Peter Hutterer
c789a0fdd7 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>
2014-01-08 20:45:58 +01:00
Peter Hutterer
ded615c64f Add two asserts to avoid underrunning the seat/device refcount
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-08 20:45:58 +01:00
Peter Hutterer
c0ac1ef9f2 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>
2014-01-07 21:28:08 +01:00
Peter Hutterer
faee8fe1a7 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>
2014-01-07 21:27:30 +01:00
Peter Hutterer
4c41c6b2da gitignore: ignore ctags files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-07 21:23:36 +01:00
Peter Hutterer
bc7b784b59 gitignore: generalise .libs/ and .deps/
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-07 21:23:09 +01:00
Peter Hutterer
1a829b7399 Remove duplicate gitignore entries
Already covered by a global rule

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-01-07 21:22:51 +01:00
Jonas Ådahl
68619ec714 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>
2014-01-03 22:38:42 +01:00
Jonas Ådahl
e637b9b0f5 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>
2014-01-03 22:33:16 +01:00
Jonas Ådahl
e92b996cff Destroy unprocessed events properly when destroying context
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-01-03 22:32:59 +01:00
Jonas Ådahl
847ce34597 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>
2014-01-03 22:31:04 +01:00
Kristian Høgsberg
fef5004c46 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
2013-12-21 12:54:27 +01:00
Kristian Høgsberg
4004080f27 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.
2013-12-21 12:53:29 +01:00
Kristian Høgsberg
83f3319f18 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.
2013-12-21 12:51:52 +01:00
Kristian Høgsberg
6eebf35653 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.
2013-12-21 12:49:17 +01:00
Kristian Høgsberg
f6caf57b00 evdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit 2013-12-21 12:44:03 +01:00
Kristian Høgsberg
4124ca1433 evdev: Replace EVDEV_BUTTON with local has_button flag 2013-12-21 12:35:43 +01:00
Kristian Høgsberg
a847278c4a evdev: Replace EVDEV_MOTION_ABS with local has_abs flag 2013-12-21 12:34:26 +01:00
Kristian Høgsberg
7226e8c368 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.
2013-12-21 12:32:31 +01:00
Kristian Høgsberg
606706f87f evdev: Drop EVDEV_MOTION_REL flag
This is only used inside evdev_configure_device() and we now use a local
has_rel flag instead.
2013-12-21 12:32:06 +01:00
Kristian Høgsberg
a5db876938 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.
2013-12-21 12:25:17 +01:00
Peter Hutterer
e13d0c8248 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>
2013-12-21 12:11:03 +01:00
Peter Hutterer
ea246471d3 Documentation typo fix 2013-12-21 12:10:45 +01:00
Peter Hutterer
727b21f366 Fix typo in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:10:38 +01:00
Peter Hutterer
ecc8d6c42d 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>
2013-12-21 12:10:32 +01:00
Peter Hutterer
ed87c6dbb0 Add libudev and -lm to Requires.private
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:10:19 +01:00
Peter Hutterer
c7af6193b6 Add -lm to library
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:10:09 +01:00
Peter Hutterer
ac1f1acb41 udev: print errno if we can't open a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:10:03 +01:00
Peter Hutterer
b59d9c537b util: add ARRAY_FOR_EACH helper
Requires c99, but that's the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:09:55 +01:00
Peter Hutterer
95c6ac638f doc: group li_fixed_t into the fixed point functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:09:39 +01:00
Peter Hutterer
e4f4389341 Move zalloc() up to libinput-util.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-21 12:09:27 +01:00
Jonas Ådahl
58a33bd51c Unref seats and devices in libinput_destroy()
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-16 22:52:05 +01:00
Jonas Ådahl
3bf28bfc14 udev-seat: Remove unused declaration
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-15 21:25:10 +01:00
Peter Hutterer
1ad76d584f udev: include libinput-private.h for struct libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:10:06 +01:00
Peter Hutterer
c869aeda9e fix typo in documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:08:05 +01:00
Peter Hutterer
ce5a068daf 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>
2013-12-15 21:07:50 +01:00
Peter Hutterer
4f9c0839fb udev: fail libinput_create_from_udev for NULL values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:42 +01:00
Peter Hutterer
48608f1f6a configure: add libudev dependency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:30 +01:00
Peter Hutterer
2ee299afcc Allow for NULL in libinput_destroy
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:21 +01:00
Peter Hutterer
c188943568 Allow for NULL in libevdev_event_destroy
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-15 21:07:03 +01:00
Jonas Ådahl
1dad790a7f Introduce libinput_device_get_sysname() API
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-15 17:50:04 +01:00
Jonas Ådahl
8ac43ac5b8 Export li_fixed_to_(int|double) converters
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-15 17:47:45 +01:00
Jonas Ådahl
d791a7ab09 Introduce libinput_device_has_capability() API
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-15 17:45:02 +01:00
Jonas Ådahl
0c43efb9bd doc: Document basic event accessor functions
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-08 21:26:11 +01:00
Jonas Ådahl
67455487f8 Put libinput_event_destroy() together with other event functions
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-08 16:30:13 +01:00
Jonas Ådahl
ef2deab618 Make even structs private
To ease the possibility to extend messages with more information, make
every event struct private, while providing functions used for accessing
the parameters previously found directly in the public structs.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-08 12:36:27 +01:00
Jonas Ådahl
aae7b4e0bc Put libinput_interface struct below base doxygen group
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-08 12:35:53 +01:00