summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-12-07doc: hook up doxygen to generate the public API documentationPeter Hutterer6-7/+2172
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-07Rename libinput_create_udev to libinput_create_from_udevPeter Hutterer2-8/+8
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-07udev-seat: fix leak when failing to add devicesPeter Hutterer1-1/+3
udev-monitor and the udev_monitor_source would leak. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06Drop include of evdev.h from evdev.hPeter Hutterer1-1/+0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06Drop unused libinput_fd_handle and libinput_fd_callbackPeter Hutterer1-4/+0
Obsolete with ce787552bce26ccac433c7fcf9868d2a5561a0cc Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06evdev: fix memcopy for calibrationPeter Hutterer1-1/+1
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-06Move libinput, libinput_seat and libinput_device to the topPeter Hutterer1-4/+4
Declare all three before they are used. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06Declare libinput_seat explicitlyPeter Hutterer1-0/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06libinput_dispatch: return -EAGAIN if no events are readyPeter Hutterer1-1/+1
Notify the caller that no events are currently ready to be processed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06libinput_dispatch: return negative error number on failurePeter Hutterer1-1/+2
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>
2013-12-06Make the slots unsigned, the kernel guarantees a base of 0Peter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-12-06Make buttons unsigned, there are no negative button numbersPeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-11-24Port udev-seat to be used in libinputJonas Ådahl9-215/+524
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>
2013-11-23util: Add logging utilitiesJonas Ådahl2-0/+33
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-19Merge branch 'master' into udevJonas Ådahl19-0/+3180
2013-11-19Add interface to libinput object and move screen dimension callback to itJonas Ådahl4-16/+23
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-17Use events instead of callbacks for capability registrationJonas Ådahl5-28/+89
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>
2013-11-17Introduce libinput object managing all input dataJonas Ådahl10-123/+414
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>
2013-11-17src/Makefile.a: Fix whitespaceJonas Ådahl1-3/+3
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-17Change API from using listeners to using an event queueJonas Ådahl3-106/+222
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>
2013-11-16launcher: add weston_launcher_close() dummyDavid Herrmann1-5/+10
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.
2013-11-16udev-seat: Repick seat after a new device was addedJonas Ådahl2-0/+6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-16launcher: Collect launcher state in new struct weston_launcherKristian Høgsberg1-1/+1
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.
2013-11-16Add more missing config.h includesDaniel Stone1-0/+2
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>
2013-11-16malloc + memset -> zallocPeter Hutterer1-2/+1
And for clients using the xmalloc helper, use xzalloc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-11-16udev: Use WL_OUTPUT udev attribute for pairing touchscreens to outputsKristian Høgsberg1-1/+9
2013-11-16compositor-drm: Enable seat constraining when configured in weston.iniRob Bradford1-0/+5
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).
2013-11-16udev-seat: Refactor out seat lookup and possible creationRob Bradford2-9/+22
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.
2013-11-16configure.ac: Enable AC_USE_SYSTEM_EXTENSIONSDaniel Stone1-0/+2
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]
2013-11-16udev-seat: Use udev rules to support multiple seatsRob Bradford2-22/+45
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.
2013-11-16udev-seat: Separate the seat out to its own structureRob Bradford2-26/+68
Thie will allow us to instantiate multiple seats.
2013-11-16udev-seat: Make the udev_input structure an embedded structureRob Bradford2-15/+8
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.
2013-11-16udev-seat: Rename udev_seat to udev_inputRob Bradford2-62/+62
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.
2013-11-16input: Add a seat name parameter to weston_seat_initRob Bradford1-1/+1
2013-11-16udev-seat: Fail input setup only if no devices are foundRob Bradford1-2/+3
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
2013-11-16input: Merge wl_seat into weston_seatKristian Høgsberg1-1/+1
2013-11-16udev-seat: Simplfy enable/disable interface a bitKristian Høgsberg2-28/+28
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.
2013-11-16compositor-drm: Move udev_seat to its own fileKristian Høgsberg2-0/+342
We get to move the input code out of compositor-drm.c and we'll be able to share it with the fbdev backend.
2013-11-13Don't use the `seat' concept on device capability enumJonas Ådahl3-21/+21
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-12Port evdev code to be used as a shared libraryJonas Ådahl17-315/+955
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>
2013-11-12filter: Remove unused variableJonas Ådahl2-2/+0
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10evdev: Synchronize keys only if seat is keyboard capableJonas Ådahl1-1/+1
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10Make weston_output_transform_coordinate() take wl_fixed_t coordinatesJonas Ådahl1-8/+12
This is to make it possible for future API to have non-integer coordinates as input. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10compositor: Remove redundant and not well-defined focus fieldKristian Høgsberg1-1/+1
It was never clear what this field really did.
2013-11-10evdev: Reference count input device's seat capabilitiesJonas Ådahl2-0/+18
When the only input device of a certain seat capability is unplugged, stop advertising the capability. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-10evdev: release devices on read() errorDavid Herrmann1-1/+8
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()).
2013-11-10evdev: Clear touch capability if we see a mouse-type buttonKristian Høgsberg1-4/+4
If an input device has BTN_LEFT (typically) it's not a touch screen but a touch pad.
2013-11-10evdev: Only init a pointer if the evdev device has a buttonKristian Høgsberg1-2/+2
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.
2013-11-10evdev: Stop looking for pointer buttons when we get to BTN_JOYSTICKKristian Høgsberg1-1/+1
We don't want to mark a touchscreen as a button device just because it exposes the BTN_TOUCH and BTN_TOOL buttons.
2013-11-10evdev: Process touch up events of single-touch devicesNeil Roberts2-13/+32
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