Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
udev-monitor and the udev_monitor_source would leak.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Obsolete with ce787552bce26ccac433c7fcf9868d2a5561a0cc
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
Declare all three before they are used.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Notify the caller that no events are currently ready to be processed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
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>
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
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>
|
|
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.
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
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.
|
|
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>
|
|
And for clients using the xmalloc helper, use xzalloc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
|
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).
|
|
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.
|
|
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]
|
|
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.
|
|
Thie will allow us to instantiate multiple seats.
|
|
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.
|
|
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.
|
|
|
|
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
|
|
|
|
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.
|
|
We get to move the input code out of compositor-drm.c and we'll be
able to share it with the fbdev backend.
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
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>
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
This is to make it possible for future API to have non-integer
coordinates as input.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
It was never clear what this field really did.
|
|
When the only input device of a certain seat capability is unplugged,
stop advertising the capability.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
|
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()).
|
|
If an input device has BTN_LEFT (typically) it's not a touch screen but
a touch pad.
|
|
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.
|
|
We don't want to mark a touchscreen as a button device just because it
exposes the BTN_TOUCH and BTN_TOOL buttons.
|
|
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
|