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
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.
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.
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.
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
Kristian Høgsberg [Mon, 16 Dec 2013 22:43:29 +0000 (14:43 -0800)]
evdev: Replace EVDEV_BUTTON with local has_button 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
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.
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.
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.
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>
Peter Hutterer [Fri, 13 Dec 2013 07:50:49 +0000 (17:50 +1000)]
Documentation typo fix
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Jonas Ådahl [Sun, 8 Dec 2013 15:30:13 +0000 (16:30 +0100)]
Put libinput_event_destroy() together with other event functions
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 8 Dec 2013 11:36:27 +0000 (12:36 +0100)]
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>
Jonas Ådahl [Sun, 8 Dec 2013 11:35:40 +0000 (12:35 +0100)]
Put libinput_interface struct below base doxygen group
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 7 Dec 2013 15:41:43 +0000 (16:41 +0100)]
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>
Jonas Ådahl [Sat, 7 Dec 2013 15:01:17 +0000 (16:01 +0100)]
Remove unused disabled code
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 7 Dec 2013 13:06:55 +0000 (14:06 +0100)]
doc: Clarify that the caller need to free retrieved event
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Thu, 5 Dec 2013 23:58:00 +0000 (09:58 +1000)]
doc: hook up doxygen to generate the public API documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 08:35:32 +0000 (18:35 +1000)]
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>
Peter Hutterer [Thu, 5 Dec 2013 08:37:26 +0000 (18:37 +1000)]
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>
Peter Hutterer [Fri, 6 Dec 2013 01:51:09 +0000 (11:51 +1000)]
Drop include of evdev.h from evdev.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 6 Dec 2013 01:24:09 +0000 (11:24 +1000)]
Drop unused libinput_fd_handle and libinput_fd_callback
Obsolete with
ce787552bce26ccac433c7fcf9868d2a5561a0cc
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 08:32:36 +0000 (18:32 +1000)]
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>
Peter Hutterer [Thu, 5 Dec 2013 07:50:47 +0000 (17:50 +1000)]
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>
Peter Hutterer [Thu, 5 Dec 2013 07:50:09 +0000 (17:50 +1000)]
Declare libinput_seat explicitly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 07:33:47 +0000 (17:33 +1000)]
libinput_dispatch: return -EAGAIN if no events are ready
Notify the caller that no events are currently ready to be processed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 07:26:40 +0000 (17:26 +1000)]
libinput_dispatch: return negative error number on failure
Might as well tell the caller what went wrong without having to worry about
errno.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 07:04:42 +0000 (17:04 +1000)]
Make the slots unsigned, the kernel guarantees a base of 0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 5 Dec 2013 07:04:09 +0000 (17:04 +1000)]
Make buttons unsigned, there are no negative button numbers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sat, 23 Nov 2013 12:04:32 +0000 (13:04 +0100)]
Port udev-seat to be used in libinput
This patch ports udev-seat from weston to libinput, including adapting
libinput internals and API to provide seat and device discovery.
The public API is extended with device discovery, object reference, a
seat object. As libinput takes care of creating and destroying its
objects user data getter/setter is added in order to make it possible
for the client to directly associate an object application side with an
object library side.
Device discovery API is made up of the 'seat added', 'seat removed',
'device added' and 'device removed' events. The seat added/removed
events contains a pointer to a libinput_seat struct, while the device
added/removed events contains a pointer to a libinput_device event.
The objects are reference counted with libinput holding one reference by
default. The application can increase the reference count with
libinput_seat_ref() and libinput_device_ref() and decrease the reference
count with libinput_seat_unref() and libinput_device_unref().
The basic event struct is changed to have a 'target' union parameter
that can be either a libinput, libinput_seat or libinput_device struct
pointer.
There is one known problem with the current API that is the potentially
racy initialization.
The problem is when a device is both discovered and lost during initial
dispatchig, causing libinput to first queue a 'added' message, creating
the device with default reference count 1, then before going back to the
application queuing a 'removed' message, while at same time decreasing
reference count of the device to 0, causing it o be destroyed. The queue
will at this state contain two messages with pointers to free:ed memory.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 23 Nov 2013 11:55:44 +0000 (12:55 +0100)]
util: Add logging utilities
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 19 Nov 2013 21:29:38 +0000 (22:29 +0100)]
Merge branch 'master' into udev
Jonas Ådahl [Sun, 17 Nov 2013 18:31:34 +0000 (19:31 +0100)]
Add interface to libinput object and move screen dimension callback to it
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 17 Nov 2013 15:59:09 +0000 (16:59 +0100)]
Use events instead of callbacks for capability registration
This commit also introduces a new requirement to
libinput_device_destroy() - libinput_device_terminate() must be called
before libinput_device_destroy() in order to allow the user to dispatch
the events related to a terminating input devices while the device is
still valid.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 17 Nov 2013 10:19:50 +0000 (11:19 +0100)]
Introduce libinput object managing all input data
Instead of having the user manage added and removed fd's as well as the
fd used for creating evdev devices, introduce a libinput object that
itself has an epoll fd.
The user no longer manages multiple fd's per libinput instance, but
instead handles one fd, dispatches libinput when data is available, then
reading events using libinput_get_event().
libinput_event's are now per libinstance, but divided into categories.
So far the only category is device events. Device events are categorized
by the presence of a non-NULL device pointer in the event.
The current API usage should look like:
struct libinput libinput = ...;
struct libinput_event *event;
if (libinput_dispatch(libinput) != 0)
return -1;
while ((event = libinput_get_event(libinput))) {
if (event->device)
process_device_event(event);
free(event);
}
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 17 Nov 2013 01:38:58 +0000 (02:38 +0100)]
src/Makefile.a: Fix whitespace
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 16 Nov 2013 18:32:46 +0000 (19:32 +0100)]
Change API from using listeners to using an event queue
Instead of having the input drivers invoke user set callbacks during
libinput_device_dispatch() and add_fd callback, let the driver queue
events that the user then reads from using libinput_device_get_event().
A typical use case would be:
struct libinput_device *device = ...;
struct libinput_event *event;
libinput_device_dispatch(device);
while ((event = libinput_device_get_event(device))) {
process_event(device, event);
free(event);
}
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
David Herrmann [Mon, 21 Oct 2013 22:28:08 +0000 (00:28 +0200)]
launcher: add weston_launcher_close() dummy
If you request a device via weston_launcher_open(), you should now release
it via weston_launcher_close() instead of close(). This is currently not
needed but will be required for logind devices.
Jonas Ådahl [Thu, 17 Oct 2013 21:04:08 +0000 (23:04 +0200)]
udev-seat: Repick seat after a new device was added
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Kristian Høgsberg [Tue, 17 Sep 2013 21:41:03 +0000 (14:41 -0700)]
launcher: Collect launcher state in new struct weston_launcher
We're going to add a bit more launcher state, so start out by creating
a new struct weston_launcher we can track it in.
Daniel Stone [Thu, 15 Aug 2013 00:10:24 +0000 (01:10 +0100)]
Add more missing config.h includes
config.h includes were missing in a few files, including input.c, the
lack of which caused the X11 backend to segfault instantly due to not
having an xkbcommon context.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Peter Hutterer [Thu, 8 Aug 2013 01:57:05 +0000 (11:57 +1000)]
malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Kristian Høgsberg [Mon, 22 Jul 2013 22:11:11 +0000 (15:11 -0700)]
udev: Use WL_OUTPUT udev attribute for pairing touchscreens to outputs
Rob Bradford [Tue, 25 Jun 2013 17:56:42 +0000 (18:56 +0100)]
compositor-drm: Enable seat constraining when configured in weston.ini
This change tweaks weston_pointer_clamp to take into consideration if a
seat is constrained to a particular output by only considering the
pointer position valid if it is within the output we a constrained to.
This function is also used for the initial warping of the pointer when a
constraint is first established.
The other two changes are the application of the constraint when either
a new device added or a new output created and therefore outputs and
input devices can be brought up in either order.
v2: the code in create_output_for_connector has been spun off into a
new function setup_output_seat_constraint (Ander). The inappropriate
warping behaviour has been resolved by using weston_pointer_clamp
(Pekka).
Rob Bradford [Tue, 25 Jun 2013 17:56:40 +0000 (18:56 +0100)]
udev-seat: Refactor out seat lookup and possible creation
This change spills the code for looking up a seat by name and then
potentially creating it if it doesn't exist into a new function called
udev_seat_get_named.
This change allows us to reuse this code when looking up the seat
when parsing seat constraints per output.
Daniel Stone [Wed, 22 May 2013 15:03:19 +0000 (18:03 +0300)]
configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system. This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.
Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries. This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
[pq: rebased and converted more files]
Rob Bradford [Fri, 31 May 2013 17:09:59 +0000 (18:09 +0100)]
udev-seat: Use udev rules to support multiple seats
By labelling devices with ENV{WL_SEAT} in udev rules the devices will be
pulled into multiple weston seats.
As a result you can get multiple independent seats under the DRM and
fbdev backends.
Rob Bradford [Fri, 31 May 2013 17:09:58 +0000 (18:09 +0100)]
udev-seat: Separate the seat out to its own structure
Thie will allow us to instantiate multiple seats.
Rob Bradford [Fri, 31 May 2013 17:09:55 +0000 (18:09 +0100)]
udev-seat: Make the udev_input structure an embedded structure
And as a result of this stop iterating through the compositor seat list
(of one item) and instead access the udev_input structure directly.
This enables a refactoring to pull out the weston_seat into a separate
structure permitting multiple seats.
Rob Bradford [Fri, 31 May 2013 17:09:54 +0000 (18:09 +0100)]
udev-seat: Rename udev_seat to udev_input
This is a pure rename of the structure, functions and local variables in
preparation of the separation of the seat from the other udev input
handling.
Rob Bradford [Fri, 31 May 2013 17:09:50 +0000 (18:09 +0100)]
input: Add a seat name parameter to weston_seat_init
Rob Bradford [Mon, 3 Jun 2013 17:46:13 +0000 (18:46 +0100)]
udev-seat: Fail input setup only if no devices are found
Rather than failing if we cannot open any single device fail the input
setup if there are no input devices added.
https://bugs.freedesktop.org/show_bug.cgi?id=64506
Kristian Høgsberg [Tue, 7 May 2013 03:19:49 +0000 (23:19 -0400)]
input: Merge wl_seat into weston_seat
Kristian Høgsberg [Mon, 18 Feb 2013 21:50:19 +0000 (16:50 -0500)]
udev-seat: Simplfy enable/disable interface a bit
We always call enable_udev_monitor and add_devices together and always
disable_udev_monitor and remove_devices together. Let's just have one
entry point for enable and one for disable.
Kristian Høgsberg [Mon, 18 Feb 2013 21:15:53 +0000 (16:15 -0500)]
compositor-drm: Move udev_seat to its own file
We get to move the input code out of compositor-drm.c and we'll be
able to share it with the fbdev backend.
Jonas Ådahl [Wed, 13 Nov 2013 21:11:34 +0000 (22:11 +0100)]
Don't use the `seat' concept on device capability enum
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 10 Nov 2013 16:55:40 +0000 (17:55 +0100)]
Port evdev code to be used as a shared library
This commit introduces build script configuration for building a shared
library 'libinput.so' containing the evdev input device functionality
from weston.
evdev.c, evdev.h and evdev-touchpad.c are ported to not use the data
structures and API in weston and libwayland-server in order to minimize
dependencies.
The API of filter.c and filter.h are renamed to not include the
'weston_' prefix.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 12 Nov 2013 20:52:03 +0000 (21:52 +0100)]
filter: Remove unused variable
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sun, 10 Nov 2013 15:35:32 +0000 (16:35 +0100)]
evdev: Synchronize keys only if seat is keyboard capable
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Sat, 9 Nov 2013 23:30:10 +0000 (00:30 +0100)]
Make weston_output_transform_coordinate() take wl_fixed_t coordinates
This is to make it possible for future API to have non-integer
coordinates as input.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Kristian Høgsberg [Tue, 22 Oct 2013 19:40:54 +0000 (12:40 -0700)]
compositor: Remove redundant and not well-defined focus field
It was never clear what this field really did.
Jonas Ådahl [Thu, 17 Oct 2013 21:04:05 +0000 (23:04 +0200)]
evdev: Reference count input device's seat capabilities
When the only input device of a certain seat capability is unplugged,
stop advertising the capability.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
David Herrmann [Tue, 15 Oct 2013 12:29:56 +0000 (14:29 +0200)]
evdev: release devices on read() error
If read() fails without EAGAIN/EINTR, the device is very likely dead.
However, we must not remove the device as it might be muted/revoked. So we
simply remove the event-source to avoid polling the device and simply wait
for the udev-remove signal now.
Note that we cannot call evdev_device_destroy() as the caller created the
FD and might need custom code to close it (like weston_launcher_close()).
Kristian Høgsberg [Mon, 14 Oct 2013 22:46:13 +0000 (15:46 -0700)]
evdev: Clear touch capability if we see a mouse-type button
If an input device has BTN_LEFT (typically) it's not a touch screen but
a touch pad.
Kristian Høgsberg [Mon, 14 Oct 2013 22:32:08 +0000 (15:32 -0700)]
evdev: Only init a pointer if the evdev device has a button
We used to test for abs | rel | button, which inits a pointer device for
a device with just rel or abs capabilities. We now make sure we have either
rel or abs as well as button.
Kristian Høgsberg [Mon, 14 Oct 2013 22:28:01 +0000 (15:28 -0700)]
evdev: Stop looking for pointer buttons when we get to BTN_JOYSTICK
We don't want to mark a touchscreen as a button device just because it
exposes the BTN_TOUCH and BTN_TOOL buttons.
Neil Roberts [Tue, 24 Sep 2013 19:05:07 +0000 (20:05 +0100)]
evdev: Process touch up events of single-touch devices
Previously only the touch up key event was used for single-touch
devices and the touch down event was generated on the first motion
event. This was breaking if the touch up and down events were sent
without a motion in-between because the evdev driver wouldn't generate
a touch down event and Weston would lose track of the number of touch
points that are down. This patch changes it to track the up and down
key events as pending events similar to how it does for multi-touch
devices.
https://bugs.freedesktop.org/show_bug.cgi?id=69759
Neil Roberts [Tue, 24 Sep 2013 11:09:03 +0000 (12:09 +0100)]
evdev: Only track one pending event
Instead of having a mask of pending events there is now an enum with a
single value to represent the one pending event. The event gets
flushed explicitly as part of the handling code for each event type
rather than in the outer event reading loop. The pending event is used
so that we can combine multiple motion events into one and to make
sure that we have recieved the latest position before sending a touch
up or down event. This should fix the following problems with the old
approach:
• If you release a finger and press it down again quickly you could
get the up and down events in the same batch. However the pending
events were always processed in the order down then up so it would
end up notifying two down events and then an up. The pending event
is now always flushed when there is a new up or down event so they
will always be in the right order.
• When it got a slot event it would immediately change the slot number
and then set the pending event. Then when it flushed the events it
would use the new slot number to flush the old pending event so the
events could have the wrong finger. The pending event is now
immediately flushed when a slot event is received so it will have
the right finger.
• If you get more than 32 events in one read then it was resetting the
pending events before processing the next batch in
evdev_process_events. If four fingers were pressed down at once then
it ended up with more than 32 events and the sync message would be
in the second batch. The pending flag for the last finger was
getting cleared so it never got emitted. In this patch the pending
event is no longer reset after reading nor is it explicitly flushed.
Instead it is flushed when we receive a EV_SYN event or a different
pending event needs to replace it.
The touchpad handling code was trying to use the pending event
mechanism to notify the relative motion events. I'm not sure why it
was doing this because it looks the event would effectively get
emitted as soon as the touchpad_process function is finished anyway
and it wasn't accumulating the values. Instead I've just changed it to
emit the event directly.
https://bugs.freedesktop.org/show_bug.cgi?id=67563
Neil Roberts [Fri, 20 Sep 2013 14:03:29 +0000 (15:03 +0100)]
evdev: Flush motion events when the slot changes, not just after sync
If two fingers are released almost simultaneously then evdev can send
the touch up events in one bunch without sending a sync event
in-between. However, the evdev_device struct only keeps track of one
pending touch up event so in this case the second touch up event would
override the first and it would be lost. This patch changes it to also
flush the events whenever the slot changes so that it will flush the
previous touch up event before trying to queue the next one.
https://bugs.freedesktop.org/show_bug.cgi?id=67563
Hardening [Wed, 18 Sep 2013 21:56:35 +0000 (23:56 +0200)]
Rename current, origin, scale, origin_scale
This patch renames that fields to have consistent names.
Kristian Høgsberg [Thu, 29 Aug 2013 20:49:35 +0000 (13:49 -0700)]
evdev: Don't parse config file again, use compositor->config
Kristian Høgsberg [Thu, 29 Aug 2013 05:12:24 +0000 (22:12 -0700)]
evdev: Don't transform device->abs.x/y in place
We don't always get both an X and an Y event in a SYN report, so we end
up transforming the coordinate we don't get twice. For example, if we
only receive an ABS_X event, we transform the already transformed
device->abs.y again in transform_absolute() when applying the calibration.
Kristian Høgsberg [Mon, 26 Aug 2013 21:35:32 +0000 (14:35 -0700)]
evdev: Initliaze device->link so we can wl_list_remove() without crashing
We were testing for wl_list_empty() on a { NULL, NULL } list (which
returns false) and then wl_list_remove()ing the device (which crashes).
Daniel Stone [Thu, 15 Aug 2013 00:10:24 +0000 (01:10 +0100)]
Add more missing config.h includes
config.h includes were missing in a few files, including input.c, the
lack of which caused the X11 backend to segfault instantly due to not
having an xkbcommon context.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Kristian Høgsberg [Tue, 13 Aug 2013 21:55:39 +0000 (14:55 -0700)]
evdev: Ignore joystick devices
We don't handle them in any way now and having your steering wheel move
the cursor isn't useful. Applications can still open evdev devices and
access them directly like they already do.
Armin K [Tue, 30 Jul 2013 23:41:03 +0000 (01:41 +0200)]
evdev-touchpad: Set some options using weston.ini
This patch adds 3 new options to weston.ini to allow
the user to change default constant_accel_factor,
min_accel_factor and max_accel_factor. If no options
are set, it falls back using defaults as it did before.
v2: create weston_config_section_get_double and use it
instead of manualy converting string to double.
v3: add default values in weston_config_get_double
instead of using conditionals.
v4: don't pass diagonal as pointer.
Rolf Morel [Fri, 9 Aug 2013 14:32:17 +0000 (16:32 +0200)]
evdev: write EV_SYN input_event along with led events to device
Other clients of an evdev device need to have the events they receive
be separated, in moment in time, from other events by an EV_SYN/
SYN_REPORT. This is the responsibility of the client who writes events
into the stream.
Rusty Lynch [Fri, 9 Aug 2013 04:08:17 +0000 (21:08 -0700)]
evdev: Use touch ID 0 when generating touch up event
device->mt.slot is uninitialized when we're not receiving the
evdev slot events. Always use ID 0 as we do when we generate the
touch down and motion events.