Commit graph

2388 commits

Author SHA1 Message Date
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
Jonas Ådahl
758e553645 Reference count event target struct when applicable
If the target of an event is a reference counted object, such as
libinput_seat and libinput_device, make events own its own reference to
the object, releasing it when destroyed.

In order to do this, a new API requirement and function are introduced;
libinput_event_destroy(). The user is required to use
libinput_event_destroy() instead of free() after having retrieved an
event using libinput_get_event().

This fixes a race that would be triggered if a device or seat would be
added and removed before the user calling libinput_get_event().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-07 16:41:43 +01:00
Jonas Ådahl
5836054306 Remove unused disabled code
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-07 16:01:17 +01:00
Jonas Ådahl
caf19d5968 doc: Clarify that the caller need to free retrieved event
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-07 14:06:55 +01:00
Peter Hutterer
2d2df7842c doc: hook up doxygen to generate the public API documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-07 14:06:46 +01:00
Peter Hutterer
075119dd5a Rename libinput_create_udev to libinput_create_from_udev
A lot more obvious what it does, it creates a libinput context from a udev
handler (rather than creating the udev handler).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-07 13:55:37 +01:00
Peter Hutterer
d50c5108c1 udev-seat: fix leak when failing to add devices
udev-monitor and the udev_monitor_source would leak.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-07 13:55:31 +01:00
Peter Hutterer
7b09c753de Drop include of evdev.h from evdev.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 13:52:16 +10:00
Peter Hutterer
c06804b643 Drop unused libinput_fd_handle and libinput_fd_callback
Obsolete with ce787552bc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 13:52:16 +10:00
Peter Hutterer
9e6cf91f48 evdev: fix memcopy for calibration
Function arguments with fixed length are still just pointers, so
sizeof(calibration) here is sizeof(float*), not sizeof(float) * 6.

evdev.c: In function 'evdev_device_calibrate':
evdev.c:693:54: warning: argument to 'sizeof' in 'memcpy' call is the same
  pointer type 'float *' as the destination; expected 'float' or an explicit
  length [-Wsizeof-pointer-memaccess]
  memcpy(device->abs.calibration, calibration, sizeof calibration);

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 13:52:16 +10:00
Peter Hutterer
adf859c2e9 Move libinput, libinput_seat and libinput_device to the top
Declare all three before they are used.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 13:52:16 +10:00
Peter Hutterer
8999445894 Declare libinput_seat explicitly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06 13:52:16 +10:00