2013-11-10 17:55:40 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2013 Jonas Ådahl
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef LIBINPUT_H
|
|
|
|
|
#define LIBINPUT_H
|
|
|
|
|
|
2014-03-24 23:40:39 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-11-10 17:55:40 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdint.h>
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
#include <libudev.h>
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2014-06-06 15:56:50 +10:00
|
|
|
#define LIBINPUT_ATTRIBUTE_PRINTF(_format, _args) \
|
|
|
|
|
__attribute__ ((format (printf, _format, _args)))
|
2014-06-12 11:44:31 +10:00
|
|
|
#define LIBINPUT_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
|
2014-06-06 15:56:50 +10:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @mainpage
|
|
|
|
|
* libinput is a generic input device handling library. It abstracts
|
|
|
|
|
* commonly-used concepts such as keyboard, pointer and touchpad handling
|
|
|
|
|
* behind an API.
|
|
|
|
|
*/
|
|
|
|
|
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
/**
|
|
|
|
|
* @page tpbuttons Touchpad button behavior
|
|
|
|
|
*
|
|
|
|
|
* For touchpad devices without physical buttons, libinput enables an
|
|
|
|
|
* emulated right button area through either of two methods.
|
|
|
|
|
*
|
|
|
|
|
* Software button areas
|
|
|
|
|
* =====================
|
2014-06-24 18:55:25 -04:00
|
|
|
* On most touchpads, the bottom area of the touchpad is split into a left
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
* and a right-button area. Pressing the touchpad down with a finger in
|
|
|
|
|
* those areas will generate clicks as shown in the diagram below:
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
+------------------------+
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
| LEFT |
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
+------------------------+
|
|
|
|
|
| LEFT | RIGHT |
|
|
|
|
|
+------------------------+
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* Generally, the touchpad will emulate a right-button click if the finger
|
|
|
|
|
* was set down in the right button area and did not leave the
|
|
|
|
|
* right button area before clicking, even if another finger was already
|
|
|
|
|
* down on the touchpad in another area.
|
|
|
|
|
* A middle click is generated by clicking the touchpad when one finger is
|
|
|
|
|
* in the bottom left button area, and one finger is in the botton right
|
|
|
|
|
* button area.
|
|
|
|
|
* The exact behavior of the touchpad is implementation-dependent.
|
|
|
|
|
*
|
2014-06-12 11:55:21 +10:00
|
|
|
* Top software button area
|
|
|
|
|
* ========================
|
|
|
|
|
* On selected touchpads, the top area of the touchpad is a separate set of
|
|
|
|
|
* software buttons split into a left, middle and right button area.
|
|
|
|
|
* Pressing the touchpad down with a finger in those areas will generate
|
|
|
|
|
* clicks as shown in the diagram below:
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
+------------------------+
|
|
|
|
|
| LEFT | MIDDLE | RIGHT |
|
|
|
|
|
+------------------------+
|
|
|
|
|
| |
|
|
|
|
|
| LEFT |
|
|
|
|
|
| |
|
|
|
|
|
+------------------------+
|
|
|
|
|
| LEFT | RIGHT |
|
|
|
|
|
+------------------------+
|
|
|
|
|
* @endcode
|
|
|
|
|
* This behavior is enabled on the Lenovo *40 series (T440, T540, T240...)
|
|
|
|
|
* and the Lenovo Helix, Yoga S1 and Carbon X1 2nd.
|
|
|
|
|
*
|
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-28 09:44:11 +10:00
|
|
|
* Clickfinger
|
|
|
|
|
* ===========
|
|
|
|
|
* On Apple touchpads, no button areas are provided. Instead, use a
|
|
|
|
|
* two-finger click for a right button click, and a three-finger click for a
|
|
|
|
|
* middle button click.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-09-10 09:31:08 +10:00
|
|
|
/**
|
|
|
|
|
* @page udev_config Static device configuration via udev
|
|
|
|
|
*
|
|
|
|
|
* libinput supports some static configuration through udev properties.
|
|
|
|
|
* These propertiesare read when the device is initially added
|
|
|
|
|
* to libinput's device list, i.e. before the @ref
|
|
|
|
|
* LIBINPUT_EVENT_DEVICE_ADDED event is generated.
|
|
|
|
|
*
|
|
|
|
|
* The following udev properties are supported:
|
|
|
|
|
* <dl>
|
|
|
|
|
* <dt>LIBINPUT_CALIBRATION_MATRIX</dt>
|
|
|
|
|
* <dd>Sets the calibration matrix, see
|
|
|
|
|
* libinput_device_config_calibration_get_default_matrix(). If unset,
|
|
|
|
|
* defaults to the identity matrix.</dd>
|
|
|
|
|
* <dt>ID_SEAT</dt>
|
|
|
|
|
* <dd>Assigns the physical seat for this device. See
|
|
|
|
|
* libinput_seat_get_physical_name(). Defaults to "seat0".</dd>
|
|
|
|
|
* <dt>WL_SEAT</dt>
|
|
|
|
|
* <dd>Assigns the logical seat for this device. See
|
|
|
|
|
* libinput_seat_get_logical_name()
|
|
|
|
|
* context. Defaults to "default".</dd>
|
|
|
|
|
* </dl>
|
|
|
|
|
*
|
|
|
|
|
* Below is an example udev rule to assign "seat1" to a device from vendor
|
|
|
|
|
* 0x012a with the model ID of 0x034b.
|
|
|
|
|
* @code
|
|
|
|
|
* ACTION=="add|change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="012a", \
|
|
|
|
|
* ENV{ID_MODEL_ID}=="034b", ENV{ID_SEAT}="seat1"
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2014-02-12 14:20:18 +10:00
|
|
|
/**
|
|
|
|
|
* Log priority for internal logging messages.
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_log_priority {
|
|
|
|
|
LIBINPUT_LOG_PRIORITY_DEBUG = 10,
|
|
|
|
|
LIBINPUT_LOG_PRIORITY_INFO = 20,
|
|
|
|
|
LIBINPUT_LOG_PRIORITY_ERROR = 30,
|
|
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Capabilities on a device. A device may have one or more capabilities
|
|
|
|
|
* at a time, and capabilities may appear or disappear during the
|
2014-04-21 19:20:39 +02:00
|
|
|
* lifetime of the device.
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2013-11-13 22:11:34 +01:00
|
|
|
enum libinput_device_capability {
|
|
|
|
|
LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_POINTER = 1,
|
2013-12-06 14:29:01 +10:00
|
|
|
LIBINPUT_DEVICE_CAP_TOUCH = 2
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Logical state of a key. Note that the logical state may not represent
|
|
|
|
|
* the physical state of the key.
|
|
|
|
|
*/
|
2014-06-17 07:55:35 +10:00
|
|
|
enum libinput_key_state {
|
|
|
|
|
LIBINPUT_KEY_STATE_RELEASED = 0,
|
|
|
|
|
LIBINPUT_KEY_STATE_PRESSED = 1
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Mask reflecting LEDs on a device.
|
|
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
enum libinput_led {
|
|
|
|
|
LIBINPUT_LED_NUM_LOCK = (1 << 0),
|
|
|
|
|
LIBINPUT_LED_CAPS_LOCK = (1 << 1),
|
2013-12-06 14:29:01 +10:00
|
|
|
LIBINPUT_LED_SCROLL_LOCK = (1 << 2)
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Logical state of a physical button. Note that the logical state may not
|
|
|
|
|
* represent the physical state of the button.
|
|
|
|
|
*/
|
2014-06-03 20:08:02 -04:00
|
|
|
enum libinput_button_state {
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED = 0,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED = 1
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Axes on a device that are not x or y coordinates.
|
2014-11-07 16:08:34 +10:00
|
|
|
*
|
|
|
|
|
* The two scroll axes @ref LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and
|
|
|
|
|
* @ref LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL are engaged separately,
|
|
|
|
|
* depending on the device. libinput provides some scroll direction locking
|
|
|
|
|
* but it is up to the caller to determine which axis is needed and
|
|
|
|
|
* appropriate in the current interaction
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
enum libinput_pointer_axis {
|
2014-04-26 20:01:22 +10:00
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL = 0,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL = 1,
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Event type for events returned by libinput_get_event().
|
|
|
|
|
*/
|
2013-11-16 19:32:46 +01:00
|
|
|
enum libinput_event_type {
|
2014-01-25 11:52:33 +01:00
|
|
|
/**
|
|
|
|
|
* This is not a real event type, and is only used to tell the user that
|
|
|
|
|
* no new event is available in the queue. See
|
|
|
|
|
* libinput_next_event_type().
|
|
|
|
|
*/
|
2013-12-13 17:49:38 +10:00
|
|
|
LIBINPUT_EVENT_NONE = 0,
|
2014-01-25 11:46:55 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Signals that a device has been added to the context. The device will
|
|
|
|
|
* not be read until the next time the user calls libinput_dispatch()
|
|
|
|
|
* and data is available.
|
|
|
|
|
*
|
|
|
|
|
* This allows setting up initial device configuration before any events
|
|
|
|
|
* are created.
|
|
|
|
|
*/
|
2013-12-19 12:04:24 +10:00
|
|
|
LIBINPUT_EVENT_DEVICE_ADDED,
|
2014-01-25 11:46:55 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Signals that a device has been removed. No more events from the
|
|
|
|
|
* associated device will be in the queue or be queued after this event.
|
|
|
|
|
*/
|
2013-12-19 12:04:24 +10:00
|
|
|
LIBINPUT_EVENT_DEVICE_REMOVED,
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
|
2013-11-16 19:32:46 +01:00
|
|
|
LIBINPUT_EVENT_KEYBOARD_KEY = 300,
|
|
|
|
|
|
|
|
|
|
LIBINPUT_EVENT_POINTER_MOTION = 400,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_BUTTON,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_AXIS,
|
|
|
|
|
|
2014-02-19 21:39:26 +01:00
|
|
|
LIBINPUT_EVENT_TOUCH_DOWN = 500,
|
|
|
|
|
LIBINPUT_EVENT_TOUCH_UP,
|
|
|
|
|
LIBINPUT_EVENT_TOUCH_MOTION,
|
|
|
|
|
LIBINPUT_EVENT_TOUCH_CANCEL,
|
2013-12-20 10:15:00 +10:00
|
|
|
/**
|
|
|
|
|
* Signals the end of a set of touchpoints at one device sample
|
|
|
|
|
* time. This event has no coordinate information attached.
|
|
|
|
|
*/
|
|
|
|
|
LIBINPUT_EVENT_TOUCH_FRAME
|
2013-11-16 19:32:46 +01:00
|
|
|
};
|
|
|
|
|
|
2013-12-05 17:50:47 +10:00
|
|
|
struct libinput;
|
|
|
|
|
struct libinput_device;
|
|
|
|
|
struct libinput_seat;
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
struct libinput_event;
|
2014-01-15 17:10:30 +10:00
|
|
|
struct libinput_event_device_notify;
|
2013-12-19 16:40:48 +10:00
|
|
|
struct libinput_event_keyboard;
|
2013-12-19 13:15:28 +10:00
|
|
|
struct libinput_event_pointer;
|
2013-12-20 10:15:00 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
* @struct libinput_event_touch
|
|
|
|
|
*
|
|
|
|
|
* Touch event representing a touch down, move or up, as well as a touch
|
|
|
|
|
* cancel and touch frame events. Valid event types for this event are @ref
|
2014-02-19 21:39:26 +01:00
|
|
|
* LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_FRAME.
|
2013-12-20 10:15:00 +10:00
|
|
|
*/
|
2013-12-19 17:16:19 +10:00
|
|
|
struct libinput_event_touch;
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2014-06-09 23:39:06 +02:00
|
|
|
* @defgroup event Accessing and destruction of events
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
|
2013-12-08 16:30:13 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Destroy the event.
|
|
|
|
|
*
|
|
|
|
|
* @param event An event retrieved by libinput_get_event().
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
libinput_event_destroy(struct libinput_event *event);
|
|
|
|
|
|
2013-12-08 16:35:04 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Get the type of the event.
|
|
|
|
|
*
|
|
|
|
|
* @param event An event retrieved by libinput_get_event().
|
|
|
|
|
*/
|
2013-12-08 12:36:27 +01:00
|
|
|
enum libinput_event_type
|
|
|
|
|
libinput_event_get_type(struct libinput_event *event);
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
|
2013-12-19 11:22:53 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Get the libinput context from the event.
|
|
|
|
|
*
|
|
|
|
|
* @param event The libinput event
|
|
|
|
|
* @return The libinput context for this event.
|
|
|
|
|
*/
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput *
|
2013-12-19 11:22:53 +10:00
|
|
|
libinput_event_get_context(struct libinput_event *event);
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2014-01-17 17:59:30 +10:00
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Return the device associated with this event, if applicable. For device
|
|
|
|
|
* added/removed events this is the device added or removed. For all other
|
|
|
|
|
* device events, this is the device that generated the event.
|
|
|
|
|
*
|
|
|
|
|
* This device is not refcounted and its lifetime is that of the event. Use
|
|
|
|
|
* libinput_device_ref() before using the device outside of this scope.
|
|
|
|
|
*
|
|
|
|
|
* @return The device associated with this event
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
2013-11-16 19:32:46 +01:00
|
|
|
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput_device *
|
2014-01-17 17:59:30 +10:00
|
|
|
libinput_event_get_device(struct libinput_event *event);
|
2013-11-16 19:32:46 +01:00
|
|
|
|
2013-12-20 09:22:32 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Return the pointer event that is this input event. If the event type does
|
|
|
|
|
* not match the pointer event types, this function returns NULL.
|
|
|
|
|
*
|
2014-03-25 13:55:47 +10:00
|
|
|
* The inverse of this function is libinput_event_pointer_get_base_event().
|
|
|
|
|
*
|
2013-12-20 09:22:32 +10:00
|
|
|
* @return A pointer event, or NULL for other events
|
|
|
|
|
*/
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput_event_pointer *
|
2013-12-20 09:22:32 +10:00
|
|
|
libinput_event_get_pointer_event(struct libinput_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Return the keyboard event that is this input event. If the event type does
|
|
|
|
|
* not match the keyboard event types, this function returns NULL.
|
|
|
|
|
*
|
2014-03-25 13:55:47 +10:00
|
|
|
* The inverse of this function is libinput_event_keyboard_get_base_event().
|
|
|
|
|
*
|
2013-12-20 09:22:32 +10:00
|
|
|
* @return A keyboard event, or NULL for other events
|
|
|
|
|
*/
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput_event_keyboard *
|
2013-12-20 09:22:32 +10:00
|
|
|
libinput_event_get_keyboard_event(struct libinput_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Return the touch event that is this input event. If the event type does
|
|
|
|
|
* not match the touch event types, this function returns NULL.
|
|
|
|
|
*
|
2014-03-25 13:55:47 +10:00
|
|
|
* The inverse of this function is libinput_event_touch_get_base_event().
|
|
|
|
|
*
|
2013-12-20 09:22:32 +10:00
|
|
|
* @return A touch event, or NULL for other events
|
|
|
|
|
*/
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput_event_touch *
|
2013-12-20 09:22:32 +10:00
|
|
|
libinput_event_get_touch_event(struct libinput_event *event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* Return the device event that is this input event. If the event type does
|
|
|
|
|
* not match the device event types, this function returns NULL.
|
|
|
|
|
*
|
2014-03-25 13:55:47 +10:00
|
|
|
* The inverse of this function is
|
|
|
|
|
* libinput_event_device_notify_get_base_event().
|
|
|
|
|
*
|
2013-12-20 09:22:32 +10:00
|
|
|
* @return A device event, or NULL for other events
|
|
|
|
|
*/
|
2014-01-25 11:33:09 +01:00
|
|
|
struct libinput_event_device_notify *
|
2013-12-20 09:22:32 +10:00
|
|
|
libinput_event_get_device_notify_event(struct libinput_event *event);
|
|
|
|
|
|
2014-03-25 13:55:47 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event
|
|
|
|
|
*
|
|
|
|
|
* @return The generic libinput_event of this event
|
|
|
|
|
*/
|
|
|
|
|
struct libinput_event *
|
|
|
|
|
libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event);
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @defgroup event_keyboard Keyboard events
|
|
|
|
|
*
|
|
|
|
|
* Key events are generated when a key changes its logical state, usually by
|
|
|
|
|
* being pressed or released.
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_keyboard
|
|
|
|
|
*
|
|
|
|
|
* @return The event time for this event
|
|
|
|
|
*/
|
2013-12-08 12:36:27 +01:00
|
|
|
uint32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_keyboard_get_time(struct libinput_event_keyboard *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_keyboard
|
|
|
|
|
*
|
|
|
|
|
* @return The keycode that triggered this key event
|
|
|
|
|
*/
|
2013-12-08 12:36:27 +01:00
|
|
|
uint32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_keyboard_get_key(struct libinput_event_keyboard *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_keyboard
|
|
|
|
|
*
|
|
|
|
|
* @return The state change of the key
|
|
|
|
|
*/
|
2014-06-17 07:55:35 +10:00
|
|
|
enum libinput_key_state
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-03-25 13:55:47 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event_keyboard
|
|
|
|
|
*
|
|
|
|
|
* @return The generic libinput_event of this event
|
|
|
|
|
*/
|
|
|
|
|
struct libinput_event *
|
|
|
|
|
libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event);
|
|
|
|
|
|
2014-04-01 21:57:45 +02:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_keyboard
|
|
|
|
|
*
|
|
|
|
|
* For the key of a LIBINPUT_EVENT_KEYBOARD_KEY event, return the total number
|
|
|
|
|
* of keys pressed on all devices on the associated seat after the event was
|
|
|
|
|
* triggered.
|
|
|
|
|
*
|
|
|
|
|
" @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_KEYBOARD_KEY. For other events, this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @return the seat wide pressed key count for the key of this event
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_event_keyboard_get_seat_key_count(
|
|
|
|
|
struct libinput_event_keyboard *event);
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @defgroup event_pointer Pointer events
|
|
|
|
|
*
|
|
|
|
|
* Pointer events reflect motion, button and scroll events, as well as
|
|
|
|
|
* events from other axes.
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* @return The event time for this event
|
|
|
|
|
*/
|
2013-12-08 12:36:27 +01:00
|
|
|
uint32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_time(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
2014-01-28 22:50:26 +01:00
|
|
|
* Return the delta between the last event and the current event. For pointer
|
|
|
|
|
* events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function
|
|
|
|
|
* returns 0.
|
2013-12-19 17:50:49 +10:00
|
|
|
*
|
2014-07-23 18:03:15 +10:00
|
|
|
* If a device employs pointer acceleration, the delta returned by this
|
|
|
|
|
* function is the accelerated delta.
|
|
|
|
|
*
|
2013-12-19 17:50:49 +10:00
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION.
|
|
|
|
|
*
|
|
|
|
|
* @return the relative x movement since the last event
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_dx(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
2014-01-28 22:50:26 +01:00
|
|
|
* Return the delta between the last event and the current event. For pointer
|
|
|
|
|
* events that are not of type LIBINPUT_EVENT_POINTER_MOTION, this function
|
|
|
|
|
* returns 0.
|
2013-12-19 17:50:49 +10:00
|
|
|
*
|
2014-07-23 18:03:15 +10:00
|
|
|
* If a device employs pointer acceleration, the delta returned by this
|
|
|
|
|
* function is the accelerated delta.
|
|
|
|
|
*
|
2013-12-19 17:50:49 +10:00
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION.
|
|
|
|
|
*
|
|
|
|
|
* @return the relative y movement since the last event
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_dy(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
|
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
2014-06-19 11:30:21 +10:00
|
|
|
* Return the current absolute x coordinate of the pointer event, in mm from
|
|
|
|
|
* the top left corner of the device. To get the corresponding output screen
|
2014-07-03 09:59:26 +10:00
|
|
|
* coordinate, use libinput_event_pointer_get_absolute_x_transformed().
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
|
|
|
|
* For pointer events that are not of type
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
|
2013-12-19 17:50:49 +10:00
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
|
|
|
|
|
*
|
2014-01-25 11:53:53 +01:00
|
|
|
* @return the current absolute x coordinate
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
2014-06-19 11:30:21 +10:00
|
|
|
* Return the current absolute y coordinate of the pointer event, in mm from
|
|
|
|
|
* the top left corner of the device. To get the corresponding output screen
|
2014-07-03 09:59:26 +10:00
|
|
|
* coordinate, use libinput_event_pointer_get_absolute_y_transformed().
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
|
|
|
|
* For pointer events that are not of type
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
|
2013-12-19 17:50:49 +10:00
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
|
|
|
|
|
*
|
2014-01-25 11:53:53 +01:00
|
|
|
* @return the current absolute y coordinate
|
2013-12-19 17:50:49 +10:00
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-01-25 11:53:53 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the current absolute x coordinate of the pointer event, transformed to
|
|
|
|
|
* screen coordinates.
|
|
|
|
|
*
|
|
|
|
|
* For pointer events that are not of type
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this function is
|
|
|
|
|
* undefined.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
|
|
|
|
|
*
|
|
|
|
|
* @param event The libinput pointer event
|
|
|
|
|
* @param width The current output screen width
|
|
|
|
|
* @return the current absolute x coordinate transformed to a screen coordinate
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-01-25 11:53:53 +01:00
|
|
|
libinput_event_pointer_get_absolute_x_transformed(
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
uint32_t width);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the current absolute y coordinate of the pointer event, transformed to
|
|
|
|
|
* screen coordinates.
|
|
|
|
|
*
|
|
|
|
|
* For pointer events that are not of type
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, the return value of this function is
|
|
|
|
|
* undefined.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE.
|
|
|
|
|
*
|
|
|
|
|
* @param event The libinput pointer event
|
|
|
|
|
* @param height The current output screen height
|
|
|
|
|
* @return the current absolute y coordinate transformed to a screen coordinate
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-01-25 11:53:53 +01:00
|
|
|
libinput_event_pointer_get_absolute_y_transformed(
|
|
|
|
|
struct libinput_event_pointer *event,
|
|
|
|
|
uint32_t height);
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the button that triggered this event.
|
|
|
|
|
* For pointer events that are not of type LIBINPUT_EVENT_POINTER_BUTTON,
|
|
|
|
|
* this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_BUTTON.
|
|
|
|
|
*
|
|
|
|
|
* @return the button triggering this event
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
|
|
|
|
uint32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_button(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the button state that triggered this event.
|
|
|
|
|
* For pointer events that are not of type LIBINPUT_EVENT_POINTER_BUTTON,
|
|
|
|
|
* this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_BUTTON.
|
|
|
|
|
*
|
|
|
|
|
* @return the button state triggering this event
|
|
|
|
|
*/
|
2014-06-03 20:08:02 -04:00
|
|
|
enum libinput_button_state
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_button_state(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-04-01 21:57:45 +02:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* For the button of a LIBINPUT_EVENT_POINTER_BUTTON event, return the total
|
|
|
|
|
* number of buttons pressed on all devices on the associated seat after the
|
|
|
|
|
* the event was triggered.
|
|
|
|
|
*
|
|
|
|
|
" @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_BUTTON. For other events, this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @return the seat wide pressed button count for the key of this event
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_event_pointer_get_seat_button_count(
|
|
|
|
|
struct libinput_event_pointer *event);
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the axis that triggered this event.
|
|
|
|
|
* For pointer events that are not of type LIBINPUT_EVENT_POINTER_AXIS,
|
|
|
|
|
* this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_AXIS.
|
|
|
|
|
*
|
|
|
|
|
* @return the axis triggering this event
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
|
|
|
|
enum libinput_pointer_axis
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_axis(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* Return the axis value of the given axis. The interpretation of the value
|
|
|
|
|
* is dependent on the axis. For the two scrolling axes
|
2014-04-26 20:01:22 +10:00
|
|
|
* LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL and
|
|
|
|
|
* LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, the value of the event is in
|
2013-12-19 17:50:49 +10:00
|
|
|
* relative scroll units, with the positive direction being down or right,
|
|
|
|
|
* respectively. The dimension of a scroll unit is equal to one unit of
|
|
|
|
|
* motion in the respective axis, where applicable (e.g. touchpad two-finger
|
|
|
|
|
* scrolling).
|
|
|
|
|
*
|
|
|
|
|
* For pointer events that are not of type LIBINPUT_EVENT_POINTER_AXIS,
|
|
|
|
|
* this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function for events other than
|
|
|
|
|
* LIBINPUT_EVENT_POINTER_AXIS.
|
|
|
|
|
*
|
|
|
|
|
* @return the axis value of this event
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-03-25 13:55:47 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_pointer
|
|
|
|
|
*
|
|
|
|
|
* @return The generic libinput_event of this event
|
|
|
|
|
*/
|
|
|
|
|
struct libinput_event *
|
|
|
|
|
libinput_event_pointer_get_base_event(struct libinput_event_pointer *event);
|
|
|
|
|
|
|
|
|
|
|
2013-12-08 12:36:27 +01:00
|
|
|
/**
|
2013-12-19 17:50:49 +10:00
|
|
|
* @defgroup event_touch Touch events
|
|
|
|
|
*
|
|
|
|
|
* Events from absolute touch devices.
|
2013-12-08 12:36:27 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
|
|
|
|
* @return The event time for this event
|
|
|
|
|
*/
|
2013-12-08 12:36:27 +01:00
|
|
|
uint32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_touch_get_time(struct libinput_event_touch *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
2014-02-11 23:30:28 +01:00
|
|
|
* Get the slot of this touch event. See the kernel's multitouch
|
2013-12-19 17:50:49 +10:00
|
|
|
* protocol B documentation for more information.
|
|
|
|
|
*
|
2014-02-12 20:56:06 +01:00
|
|
|
* If the touch event has no assigned slot, for example if it is from a
|
|
|
|
|
* single touch device, this function returns -1.
|
|
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_CANCEL or
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_FRAME.
|
2013-12-20 10:15:00 +10:00
|
|
|
*
|
2014-02-11 23:30:28 +01:00
|
|
|
* @return The slot of this touch event
|
2013-12-19 17:50:49 +10:00
|
|
|
*/
|
2014-02-12 20:52:14 +01:00
|
|
|
int32_t
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_touch_get_slot(struct libinput_event_touch *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-01-30 22:44:49 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
|
|
|
|
* Get the seat slot of the touch event. A seat slot is a non-negative seat
|
|
|
|
|
* wide unique identifier of an active touch point.
|
|
|
|
|
*
|
|
|
|
|
* Events from single touch devices will be represented as one individual
|
|
|
|
|
* touch point per device.
|
|
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* @note this function should not be called for LIBINPUT_EVENT_TOUCH_CANCEL or
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_FRAME.
|
2014-01-30 22:44:49 +01:00
|
|
|
*
|
|
|
|
|
* @return The seat slot of the touch event
|
|
|
|
|
*/
|
|
|
|
|
int32_t
|
|
|
|
|
libinput_event_touch_get_seat_slot(struct libinput_event_touch *event);
|
|
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
2014-06-19 11:30:21 +10:00
|
|
|
* Return the current absolute x coordinate of the touch event, in mm from
|
|
|
|
|
* the top left corner of the device. To get the corresponding output screen
|
|
|
|
|
* coordinate, use libinput_event_touch_get_x_transformed().
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_MOTION.
|
2013-12-20 10:15:00 +10:00
|
|
|
*
|
2014-01-25 11:53:53 +01:00
|
|
|
* @param event The libinput touch event
|
|
|
|
|
* @return the current absolute x coordinate
|
2013-12-19 17:50:49 +10:00
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_touch_get_x(struct libinput_event_touch *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2013-12-19 17:50:49 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
2014-06-19 11:30:21 +10:00
|
|
|
* Return the current absolute y coordinate of the touch event, in mm from
|
|
|
|
|
* the top left corner of the device. To get the corresponding output screen
|
|
|
|
|
* coordinate, use libinput_event_touch_get_y_transformed().
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* For LIBINPUT_EVENT_TOUCH_UP 0 is returned.
|
|
|
|
|
*
|
|
|
|
|
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_MOTION.
|
2013-12-20 10:15:00 +10:00
|
|
|
*
|
2014-01-25 11:53:53 +01:00
|
|
|
* @param event The libinput touch event
|
|
|
|
|
* @return the current absolute y coordinate
|
2013-12-19 17:50:49 +10:00
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-02-11 23:29:34 +01:00
|
|
|
libinput_event_touch_get_y(struct libinput_event_touch *event);
|
2013-12-08 12:36:27 +01:00
|
|
|
|
2014-01-25 11:53:53 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
|
|
|
|
* Return the current absolute x coordinate of the touch event, transformed to
|
|
|
|
|
* screen coordinates.
|
|
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_MOTION.
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
|
|
|
|
* @param event The libinput touch event
|
|
|
|
|
* @param width The current output screen width
|
|
|
|
|
* @return the current absolute x coordinate transformed to a screen coordinate
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-01-25 11:53:53 +01:00
|
|
|
libinput_event_touch_get_x_transformed(struct libinput_event_touch *event,
|
|
|
|
|
uint32_t width);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
|
|
|
|
* Return the current absolute y coordinate of the touch event, transformed to
|
|
|
|
|
* screen coordinates.
|
|
|
|
|
*
|
2014-02-19 21:39:26 +01:00
|
|
|
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
|
|
|
|
|
* LIBINPUT_EVENT_TOUCH_MOTION.
|
2014-01-25 11:53:53 +01:00
|
|
|
*
|
|
|
|
|
* @param event The libinput touch event
|
|
|
|
|
* @param height The current output screen height
|
|
|
|
|
* @return the current absolute y coordinate transformed to a screen coordinate
|
|
|
|
|
*/
|
2014-06-02 23:09:27 +02:00
|
|
|
double
|
2014-01-25 11:53:53 +01:00
|
|
|
libinput_event_touch_get_y_transformed(struct libinput_event_touch *event,
|
|
|
|
|
uint32_t height);
|
|
|
|
|
|
2014-03-25 13:55:47 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup event_touch
|
|
|
|
|
*
|
|
|
|
|
* @return The generic libinput_event of this event
|
|
|
|
|
*/
|
|
|
|
|
struct libinput_event *
|
|
|
|
|
libinput_event_touch_get_base_event(struct libinput_event_touch *event);
|
|
|
|
|
|
2013-12-08 12:35:40 +01:00
|
|
|
/**
|
|
|
|
|
* @defgroup base Initialization and manipulation of libinput contexts
|
|
|
|
|
*/
|
|
|
|
|
|
2013-11-17 19:31:34 +01:00
|
|
|
struct libinput_interface {
|
2013-12-13 11:04:01 +10:00
|
|
|
/**
|
|
|
|
|
* Open the device at the given path with the flags provided and
|
|
|
|
|
* return the fd.
|
|
|
|
|
*
|
|
|
|
|
* @param path The device path to open
|
|
|
|
|
* @param flags Flags as defined by open(2)
|
|
|
|
|
* @param user_data The user_data provided in
|
2014-06-25 11:42:35 +10:00
|
|
|
* libinput_udev_create_context()
|
2013-12-13 11:04:01 +10:00
|
|
|
*
|
|
|
|
|
* @return the file descriptor, or a negative errno on failure.
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
int (*open_restricted)(const char *path, int flags, void *user_data);
|
2013-12-13 11:04:01 +10:00
|
|
|
/**
|
|
|
|
|
* Close the file descriptor.
|
|
|
|
|
*
|
|
|
|
|
* @param fd The file descriptor to close
|
|
|
|
|
* @param user_data The user_data provided in
|
2014-06-25 11:42:35 +10:00
|
|
|
* libinput_udev_create_context()
|
2013-12-13 11:04:01 +10:00
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
void (*close_restricted)(int fd, void *user_data);
|
2013-11-10 17:55:40 +01:00
|
|
|
};
|
|
|
|
|
|
2014-06-12 11:44:31 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Create a new libinput context from udev. This context is inactive until
|
|
|
|
|
* assigned a seat ID with libinput_udev_assign_seat().
|
|
|
|
|
*
|
|
|
|
|
* @param interface The callback interface
|
|
|
|
|
* @param user_data Caller-specific data passed to the various callback
|
|
|
|
|
* interfaces.
|
|
|
|
|
* @param udev An already initialized udev context
|
|
|
|
|
*
|
|
|
|
|
* @return An initialized, but inactive libinput context or NULL on error
|
|
|
|
|
*/
|
|
|
|
|
struct libinput *
|
|
|
|
|
libinput_udev_create_context(const struct libinput_interface *interface,
|
|
|
|
|
void *user_data,
|
|
|
|
|
struct udev *udev);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Assign a seat to this libinput context. New devices or the removal of
|
|
|
|
|
* existing devices will appear as events during libinput_dispatch().
|
|
|
|
|
*
|
|
|
|
|
* libinput_udev_assign_seat() succeeds even if no input devices are currently
|
|
|
|
|
* available on this seat, or if devices are available but fail to open in
|
|
|
|
|
* @ref libinput_interface::open_restricted. Devices that do not have the
|
|
|
|
|
* minimum capabilities to be recognized as pointer, keyboard or touch
|
|
|
|
|
* device are ignored. Such devices and those that failed to open
|
|
|
|
|
* ignored until the next call to libinput_resume().
|
|
|
|
|
*
|
|
|
|
|
* This function may only be called once per context.
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A libinput context initialized with
|
|
|
|
|
* libinput_udev_create_context()
|
|
|
|
|
* @param seat_id A seat identifier. This string must not be NULL.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success or -1 on failure.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_udev_assign_seat(struct libinput *libinput,
|
2014-06-28 22:41:29 +02:00
|
|
|
const char *seat_id);
|
2014-06-12 11:44:31 +10:00
|
|
|
|
2013-12-10 13:20:36 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
2014-01-29 15:38:48 +10:00
|
|
|
* Create a new libinput context that requires the caller to manually add or
|
|
|
|
|
* remove devices with libinput_path_add_device() and
|
|
|
|
|
* libinput_path_remove_device().
|
|
|
|
|
*
|
|
|
|
|
* The context is fully initialized but will not generate events until at
|
|
|
|
|
* least one device has been added.
|
2013-12-10 13:20:36 +10:00
|
|
|
*
|
2014-06-25 00:06:58 +02:00
|
|
|
* The reference count of the context is initialized to 1. See @ref
|
|
|
|
|
* libinput_unref.
|
|
|
|
|
*
|
2013-12-10 13:20:36 +10:00
|
|
|
* @param interface The callback interface
|
|
|
|
|
* @param user_data Caller-specific data passed to the various callback
|
|
|
|
|
* interfaces.
|
|
|
|
|
*
|
2014-01-29 15:38:48 +10:00
|
|
|
* @return An initialized, empty libinput context.
|
2013-12-10 13:20:36 +10:00
|
|
|
*/
|
|
|
|
|
struct libinput *
|
2014-01-29 15:38:48 +10:00
|
|
|
libinput_path_create_context(const struct libinput_interface *interface,
|
|
|
|
|
void *user_data);
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2014-01-29 16:37:45 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Add a device to a libinput context initialized with
|
2014-04-21 19:20:40 +02:00
|
|
|
* libinput_path_create_context(). If successful, the device will be
|
2014-01-29 16:37:45 +10:00
|
|
|
* added to the internal list and re-opened on libinput_resume(). The device
|
|
|
|
|
* can be removed with libinput_path_remove_device().
|
|
|
|
|
*
|
|
|
|
|
* If the device was successfully initialized, it is returned in the device
|
|
|
|
|
* argument. The lifetime of the returned device pointer is limited until
|
2014-04-21 19:20:41 +02:00
|
|
|
* the next libinput_dispatch(), use libinput_device_ref() to keep a permanent
|
2014-01-29 16:37:45 +10:00
|
|
|
* reference.
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
* @param path Path to an input device
|
|
|
|
|
* @return The newly initiated device on success, or NULL on failure.
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function on a libinput
|
2014-06-25 11:42:35 +10:00
|
|
|
* context initialized with libinput_udev_create_context().
|
2014-01-29 16:37:45 +10:00
|
|
|
*/
|
|
|
|
|
struct libinput_device *
|
|
|
|
|
libinput_path_add_device(struct libinput *libinput,
|
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Remove a device from a libinput context initialized with
|
2014-04-21 19:20:40 +02:00
|
|
|
* libinput_path_create_context() or added to such a context with
|
2014-01-29 16:37:45 +10:00
|
|
|
* libinput_path_add_device().
|
|
|
|
|
*
|
|
|
|
|
* Events already processed from this input device are kept in the queue,
|
|
|
|
|
* the LIBINPUT_EVENT_DEVICE_REMOVED event marks the end of events for this
|
|
|
|
|
* device.
|
|
|
|
|
*
|
|
|
|
|
* If no matching device exists, this function does nothing.
|
|
|
|
|
*
|
|
|
|
|
* @param device A libinput device
|
|
|
|
|
*
|
|
|
|
|
* @note It is an application bug to call this function on a libinput
|
2014-06-25 11:42:35 +10:00
|
|
|
* context initialized with libinput_udev_create_context().
|
2014-01-29 16:37:45 +10:00
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
libinput_path_remove_device(struct libinput_device *device);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* libinput keeps a single file descriptor for all events. Call into
|
|
|
|
|
* libinput_dispatch() if any events become available on this fd.
|
|
|
|
|
*
|
|
|
|
|
* @return the file descriptor used to notify of pending events.
|
|
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
int
|
2013-11-17 11:19:50 +01:00
|
|
|
libinput_get_fd(struct libinput *libinput);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Main event dispatchment function. Reads events of the file descriptors
|
2013-12-13 17:50:49 +10:00
|
|
|
* and processes them internally. Use libinput_get_event() to retrieve the
|
2013-12-06 09:58:00 +10:00
|
|
|
* events.
|
|
|
|
|
*
|
2013-12-30 22:08:35 +01:00
|
|
|
* Dispatching does not necessarily queue libinput events.
|
|
|
|
|
*
|
2013-12-06 09:58:00 +10:00
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, or a negative errno on failure
|
|
|
|
|
*/
|
2013-11-17 11:19:50 +01:00
|
|
|
int
|
|
|
|
|
libinput_dispatch(struct libinput *libinput);
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Retrieve the next event from libinput's internal event queue.
|
|
|
|
|
*
|
2013-12-07 16:41:43 +01:00
|
|
|
* After handling the retrieved event, the caller must destroy it using
|
|
|
|
|
* libinput_event_destroy().
|
2013-12-07 14:06:55 +01:00
|
|
|
*
|
2013-12-06 09:58:00 +10:00
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
* @return The next available event, or NULL if no event is available.
|
|
|
|
|
*/
|
2013-11-16 19:32:46 +01:00
|
|
|
struct libinput_event *
|
2013-11-17 11:19:50 +01:00
|
|
|
libinput_get_event(struct libinput *libinput);
|
|
|
|
|
|
2013-12-13 17:58:50 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Return the type of the next event in the internal queue. This function
|
|
|
|
|
* does not pop the event off the queue and the next call to
|
|
|
|
|
* libinput_get_event() returns that event.
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
* @return The event type of the next available event or LIBINPUT_EVENT_NONE
|
|
|
|
|
* if no event is availble.
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_event_type
|
|
|
|
|
libinput_next_event_type(struct libinput *libinput);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
* @return the caller-specific data previously assigned in
|
|
|
|
|
* libinput_create_udev().
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
void *
|
|
|
|
|
libinput_get_user_data(struct libinput *libinput);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Resume a suspended libinput context. This re-enables device
|
|
|
|
|
* monitoring and adds existing devices.
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
* @see libinput_suspend
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success or -1 on failure
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
int
|
|
|
|
|
libinput_resume(struct libinput *libinput);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Suspend monitoring for new devices and close existing devices.
|
|
|
|
|
* This all but terminates libinput but does keep the context
|
|
|
|
|
* valid to be resumed with libinput_resume().
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
void
|
|
|
|
|
libinput_suspend(struct libinput *libinput);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
2014-06-25 00:06:58 +02:00
|
|
|
* Add a reference to the context. A context is destroyed whenever the
|
|
|
|
|
* reference count reaches 0. See @ref libinput_unref.
|
|
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized valid libinput context
|
|
|
|
|
* @return The passed libinput context
|
|
|
|
|
*/
|
|
|
|
|
struct libinput *
|
|
|
|
|
libinput_ref(struct libinput *libinput);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Dereference the libinput context. After this, the context may have been
|
|
|
|
|
* destroyed, if the last reference was dereferenced. If so, the context is
|
|
|
|
|
* invalid and may not be interacted with.
|
2013-12-06 09:58:00 +10:00
|
|
|
*
|
|
|
|
|
* @param libinput A previously initialized libinput context
|
2014-06-25 00:06:58 +02:00
|
|
|
* @return NULL if context was destroyed otherwise the passed context
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2014-06-25 00:06:58 +02:00
|
|
|
struct libinput *
|
|
|
|
|
libinput_unref(struct libinput *libinput);
|
2013-11-17 11:19:50 +01:00
|
|
|
|
2014-02-12 14:20:18 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Set the global log priority. Messages with priorities equal to or
|
|
|
|
|
* higher than the argument will be printed to the current log handler.
|
|
|
|
|
*
|
|
|
|
|
* The default log priority is LIBINPUT_LOG_PRIORITY_ERROR.
|
|
|
|
|
*
|
2014-06-18 19:51:19 +10:00
|
|
|
* @param libinput A previously initialized libinput context
|
2014-02-12 14:20:18 +10:00
|
|
|
* @param priority The minimum priority of log messages to print.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_log_set_handler
|
2014-06-12 11:12:50 +10:00
|
|
|
* @see libinput_log_get_priority
|
2014-02-12 14:20:18 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2014-06-18 19:51:19 +10:00
|
|
|
libinput_log_set_priority(struct libinput *libinput,
|
|
|
|
|
enum libinput_log_priority priority);
|
2014-02-12 14:20:18 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Get the global log priority. Messages with priorities equal to or
|
|
|
|
|
* higher than the argument will be printed to the current log handler.
|
|
|
|
|
*
|
|
|
|
|
* The default log priority is LIBINPUT_LOG_PRIORITY_ERROR.
|
|
|
|
|
*
|
2014-06-18 19:51:19 +10:00
|
|
|
* @param libinput A previously initialized libinput context
|
2014-02-12 14:20:18 +10:00
|
|
|
* @return The minimum priority of log messages to print.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_log_set_handler
|
2014-06-12 11:12:50 +10:00
|
|
|
* @see libinput_log_set_priority
|
2014-02-12 14:20:18 +10:00
|
|
|
*/
|
|
|
|
|
enum libinput_log_priority
|
2014-06-18 19:51:19 +10:00
|
|
|
libinput_log_get_priority(const struct libinput *libinput);
|
2014-02-12 14:20:18 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Log handler type for custom logging.
|
|
|
|
|
*
|
2014-06-18 19:51:19 +10:00
|
|
|
* @param libinput The libinput context
|
2014-02-12 14:20:18 +10:00
|
|
|
* @param priority The priority of the current message
|
|
|
|
|
* @param format Message format in printf-style
|
|
|
|
|
* @param args Message arguments
|
|
|
|
|
*
|
2014-11-04 10:28:00 +10:00
|
|
|
* @see libinput_log_set_priority
|
|
|
|
|
* @see libinput_log_get_priority
|
2014-02-12 14:20:18 +10:00
|
|
|
* @see libinput_log_set_handler
|
|
|
|
|
*/
|
2014-06-18 19:51:19 +10:00
|
|
|
typedef void (*libinput_log_handler)(struct libinput *libinput,
|
|
|
|
|
enum libinput_log_priority priority,
|
2014-06-06 15:56:50 +10:00
|
|
|
const char *format, va_list args)
|
|
|
|
|
LIBINPUT_ATTRIBUTE_PRINTF(3, 0);
|
2014-02-12 14:20:18 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup base
|
|
|
|
|
*
|
|
|
|
|
* Set the global log handler. Messages with priorities equal to or higher
|
|
|
|
|
* than the current log priority will be passed to the given
|
|
|
|
|
* log handler.
|
|
|
|
|
*
|
|
|
|
|
* The default log handler prints to stderr.
|
|
|
|
|
*
|
2014-06-18 19:51:19 +10:00
|
|
|
* @param libinput A previously initialized libinput context
|
2014-02-12 14:20:18 +10:00
|
|
|
* @param log_handler The log handler for library messages.
|
|
|
|
|
*
|
2014-11-04 10:28:00 +10:00
|
|
|
* @see libinput_log_set_priority
|
|
|
|
|
* @see libinput_log_get_priority
|
2014-02-12 14:20:18 +10:00
|
|
|
*/
|
|
|
|
|
void
|
2014-06-18 19:51:19 +10:00
|
|
|
libinput_log_set_handler(struct libinput *libinput,
|
|
|
|
|
libinput_log_handler log_handler);
|
2014-02-12 14:20:18 +10:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @defgroup seat Initialization and manipulation of seats
|
2014-01-15 17:04:00 +10:00
|
|
|
*
|
|
|
|
|
* A seat has two identifiers, the physical name and the logical name. The
|
|
|
|
|
* physical name is summarized as the list of devices a process on the same
|
|
|
|
|
* physical seat has access to.
|
|
|
|
|
*
|
|
|
|
|
* The logical seat name is the seat name for a logical group of devices. A
|
|
|
|
|
* compositor may use that to create additonal seats as independent device
|
|
|
|
|
* sets. Alternatively, a compositor may limit itself to a single logical
|
|
|
|
|
* seat, leaving a second compositor to manage devices on the other logical
|
|
|
|
|
* seats.
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* +---+--------+------------+------------------------+------------+
|
|
|
|
|
* | | event0 | | | log seat A |
|
|
|
|
|
* | K +--------+ | +------------+
|
|
|
|
|
* | e | event1 | phys seat0 | libinput context 1 | |
|
|
|
|
|
* | r +--------+ | | log seat B |
|
|
|
|
|
* | n | event2 | | | |
|
|
|
|
|
* | e +--------+------------+------------------------+------------+
|
|
|
|
|
* | l | event3 | phys seat1 | libinput context 2 | log seat C |
|
|
|
|
|
* +---+--------+------------+------------------------+------------+
|
|
|
|
|
* @endcode
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
|
|
|
|
* Increase the refcount of the seat. A seat will be freed whenever the
|
|
|
|
|
* refcount reaches 0. This may happen during dispatch if the
|
|
|
|
|
* seat was removed from the system. A caller must ensure to reference
|
|
|
|
|
* the seat correctly to avoid dangling pointers.
|
|
|
|
|
*
|
|
|
|
|
* @param seat A previously obtained seat
|
2014-06-25 00:06:57 +02:00
|
|
|
* @return The passed seat
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2014-06-25 00:06:57 +02:00
|
|
|
struct libinput_seat *
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
libinput_seat_ref(struct libinput_seat *seat);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
|
|
|
|
* Decrease the refcount of the seat. A seat will be freed whenever the
|
|
|
|
|
* refcount reaches 0. This may happen during dispatch if the
|
|
|
|
|
* seat was removed from the system. A caller must ensure to reference
|
|
|
|
|
* the seat correctly to avoid dangling pointers.
|
|
|
|
|
*
|
|
|
|
|
* @param seat A previously obtained seat
|
2014-06-25 00:06:57 +02:00
|
|
|
* @return NULL if seat was destroyed, otherwise the passed seat
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2014-06-25 00:06:57 +02:00
|
|
|
struct libinput_seat *
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
libinput_seat_unref(struct libinput_seat *seat);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
|
|
|
|
* Set caller-specific data associated with this seat. libinput does
|
|
|
|
|
* not manage, look at, or modify this data. The caller must ensure the
|
|
|
|
|
* data is valid.
|
|
|
|
|
*
|
|
|
|
|
* @param seat A previously obtained seat
|
|
|
|
|
* @param user_data Caller-specific data pointer
|
|
|
|
|
* @see libinput_seat_get_user_data
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
void
|
|
|
|
|
libinput_seat_set_user_data(struct libinput_seat *seat, void *user_data);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
|
|
|
|
* Get the caller-specific data associated with this seat, if any.
|
|
|
|
|
*
|
|
|
|
|
* @param seat A previously obtained seat
|
|
|
|
|
* @return Caller-specific data pointer or NULL if none was set
|
|
|
|
|
* @see libinput_seat_set_user_data
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
void *
|
|
|
|
|
libinput_seat_get_user_data(struct libinput_seat *seat);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
2014-01-15 17:04:00 +10:00
|
|
|
* Return the physical name of the seat. For libinput contexts created from
|
|
|
|
|
* udev, this is always the same value as passed into
|
2014-06-25 11:42:35 +10:00
|
|
|
* libinput_udev_assign_seat() and all seats from that context will have
|
2014-01-29 15:35:20 +10:00
|
|
|
* the same physical name.
|
2014-01-15 17:04:00 +10:00
|
|
|
*
|
|
|
|
|
* The physical name of the seat is one that is usually set by the system or
|
|
|
|
|
* lower levels of the stack. In most cases, this is the base filter for
|
|
|
|
|
* devices - devices assigned to seats outside the current seat will not
|
|
|
|
|
* be available to the caller.
|
|
|
|
|
*
|
|
|
|
|
* @param seat A previously obtained seat
|
|
|
|
|
* @return the physical name of this seat
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
libinput_seat_get_physical_name(struct libinput_seat *seat);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup seat
|
|
|
|
|
*
|
|
|
|
|
* Return the logical name of the seat. This is an identifier to group sets
|
|
|
|
|
* of devices within the compositor.
|
|
|
|
|
*
|
2013-12-06 09:58:00 +10:00
|
|
|
* @param seat A previously obtained seat
|
2014-01-15 17:04:00 +10:00
|
|
|
* @return the logical name of this seat
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
const char *
|
2014-01-15 17:04:00 +10:00
|
|
|
libinput_seat_get_logical_name(struct libinput_seat *seat);
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @defgroup device Initialization and manipulation of input devices
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
*/
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Increase the refcount of the input device. An input device will be freed
|
|
|
|
|
* whenever the refcount reaches 0. This may happen during dispatch if the
|
|
|
|
|
* device was removed from the system. A caller must ensure to reference
|
|
|
|
|
* the device correctly to avoid dangling pointers.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
2014-06-25 00:06:57 +02:00
|
|
|
* @return The passed device
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2014-06-25 00:06:57 +02:00
|
|
|
struct libinput_device *
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
libinput_device_ref(struct libinput_device *device);
|
2013-11-16 19:32:46 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Decrease the refcount of the input device. An input device will be freed
|
|
|
|
|
* whenever the refcount reaches 0. This may happen during dispatch if the
|
|
|
|
|
* device was removed from the system. A caller must ensure to reference
|
|
|
|
|
* the device correctly to avoid dangling pointers.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
2014-06-25 00:06:57 +02:00
|
|
|
* @return NULL if device was destroyed, otherwise the passed device
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2014-06-25 00:06:57 +02:00
|
|
|
struct libinput_device *
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
libinput_device_unref(struct libinput_device *device);
|
2013-11-17 16:59:09 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Set caller-specific data associated with this input device. libinput does
|
|
|
|
|
* not manage, look at, or modify this data. The caller must ensure the
|
|
|
|
|
* data is valid.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @param user_data Caller-specific data pointer
|
|
|
|
|
* @see libinput_device_get_user_data
|
|
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
void
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
libinput_device_set_user_data(struct libinput_device *device, void *user_data);
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the caller-specific data associated with this input device, if any.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return Caller-specific data pointer or NULL if none was set
|
|
|
|
|
* @see libinput_device_set_user_data
|
|
|
|
|
*/
|
2013-11-17 11:19:50 +01:00
|
|
|
void *
|
|
|
|
|
libinput_device_get_user_data(struct libinput_device *device);
|
|
|
|
|
|
2013-12-15 17:50:04 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the system name of the device.
|
|
|
|
|
*
|
2014-06-27 12:55:29 +10:00
|
|
|
* To get the descriptive device name, use libinput_device_get_name().
|
|
|
|
|
*
|
2013-12-15 17:50:04 +01:00
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return System name of the device
|
2014-06-27 12:55:29 +10:00
|
|
|
*
|
2013-12-15 17:50:04 +01:00
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
libinput_device_get_sysname(struct libinput_device *device);
|
|
|
|
|
|
2014-06-27 12:55:29 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* The descriptive device name as advertised by the kernel and/or the
|
|
|
|
|
* hardware itself. To get the sysname for this device, use
|
|
|
|
|
* libinput_device_get_sysname().
|
|
|
|
|
*
|
|
|
|
|
* The lifetime of the returned string is tied to the struct
|
|
|
|
|
* libinput_device. The string may be the empty string but is never NULL.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return The device name
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
libinput_device_get_name(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the product ID for this device.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return The product ID of this device
|
|
|
|
|
*/
|
|
|
|
|
unsigned int
|
|
|
|
|
libinput_device_get_id_product(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the vendor ID for this device.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return The vendor ID of this device
|
|
|
|
|
*/
|
|
|
|
|
unsigned int
|
|
|
|
|
libinput_device_get_id_vendor(struct libinput_device *device);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* A device may be mapped to a single output, or all available outputs. If a
|
|
|
|
|
* device is mapped to a single output only, a relative device may not move
|
|
|
|
|
* beyond the boundaries of this output. An absolute device has its input
|
|
|
|
|
* coordinates mapped to the extents of this output.
|
|
|
|
|
*
|
|
|
|
|
* @return the name of the output this device is mapped to, or NULL if no
|
|
|
|
|
* output is set
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
const char *
|
|
|
|
|
libinput_device_get_output_name(struct libinput_device *device);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the seat associated with this input device.
|
|
|
|
|
*
|
2014-02-10 11:40:55 +10:00
|
|
|
* A seat can be uniquely identified by the physical and logical seat name.
|
|
|
|
|
* There will ever be only one seat instance with a given physical and logical
|
|
|
|
|
* seat name pair at any given time, but if no external reference is kept, it
|
|
|
|
|
* may be destroyed if no device belonging to it is left.
|
|
|
|
|
*
|
2013-12-06 09:58:00 +10:00
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @return The seat this input device belongs to
|
|
|
|
|
*/
|
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>
2013-11-23 13:04:32 +01:00
|
|
|
struct libinput_seat *
|
|
|
|
|
libinput_device_get_seat(struct libinput_device *device);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Update the LEDs on the device, if any. If the device does not have
|
|
|
|
|
* LEDs, or does not have one or more of the LEDs given in the mask, this
|
|
|
|
|
* function does nothing.
|
|
|
|
|
*
|
|
|
|
|
* @param device A previously obtained device
|
|
|
|
|
* @param leds A mask of the LEDs to set, or unset.
|
|
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
void
|
|
|
|
|
libinput_device_led_update(struct libinput_device *device,
|
|
|
|
|
enum libinput_led leds);
|
|
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Set the bitmask in keys to the bitmask of the keys present on the device
|
|
|
|
|
* (see linux/input.h), up to size characters.
|
|
|
|
|
*
|
|
|
|
|
* @param device A current input device
|
|
|
|
|
* @param keys An array filled with the bitmask for the keys
|
|
|
|
|
* @param size Size of the keys array
|
2014-03-13 15:54:47 +10:00
|
|
|
*
|
|
|
|
|
* @return The number of valid bytes in keys, or a negative errno on failure
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
int
|
|
|
|
|
libinput_device_get_keys(struct libinput_device *device,
|
2014-07-27 15:43:59 +02:00
|
|
|
char *keys, size_t size)
|
|
|
|
|
LIBINPUT_ATTRIBUTE_DEPRECATED;
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2013-12-06 09:58:00 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
2014-08-26 11:41:19 +10:00
|
|
|
* @deprecated Use libinput_device_config_calibration_set_matrix() instead.
|
2013-12-06 09:58:00 +10:00
|
|
|
*/
|
2013-11-10 17:55:40 +01:00
|
|
|
void
|
|
|
|
|
libinput_device_calibrate(struct libinput_device *device,
|
2014-08-26 11:41:19 +10:00
|
|
|
float calibration[6])
|
|
|
|
|
LIBINPUT_ATTRIBUTE_DEPRECATED;
|
2013-11-10 17:55:40 +01:00
|
|
|
|
2013-12-15 17:45:02 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Check if the given device has the specified capability
|
|
|
|
|
*
|
|
|
|
|
* @return 1 if the given device has the capability or 0 if not
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_has_capability(struct libinput_device *device,
|
|
|
|
|
enum libinput_device_capability capability);
|
|
|
|
|
|
2014-06-17 15:45:07 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Get the physical size of a device in mm, where meaningful. This function
|
|
|
|
|
* only succeeds on devices with the required data, i.e. tablets, touchpads
|
|
|
|
|
* and touchscreens.
|
|
|
|
|
*
|
|
|
|
|
* If this function returns nonzero, width and height are unmodified.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device
|
|
|
|
|
* @param width Set to the width of the device
|
|
|
|
|
* @param height Set to the height of the device
|
|
|
|
|
* @return 0 on success, or nonzero otherwise
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_get_size(struct libinput_device *device,
|
|
|
|
|
double *width,
|
|
|
|
|
double *height);
|
|
|
|
|
|
2014-11-06 12:27:35 +01:00
|
|
|
/**
|
|
|
|
|
* @ingroup device
|
|
|
|
|
*
|
|
|
|
|
* Check if a @ref LIBINPUT_DEVICE_CAP_POINTER device has a button with the
|
|
|
|
|
* passed in code (see linux/input.h).
|
|
|
|
|
*
|
|
|
|
|
* @param device A current input device
|
|
|
|
|
* @param code button code to check for
|
|
|
|
|
*
|
|
|
|
|
* @return 1 if the device supports this button code, 0 if it does not, -1
|
|
|
|
|
* on error.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_has_button(struct libinput_device *device, uint32_t code);
|
2014-05-16 09:06:41 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @defgroup config Device configuration
|
|
|
|
|
*
|
|
|
|
|
* Enable, disable, change and/or check for device-specific features. For
|
|
|
|
|
* all features, libinput assigns a default based on the hardware
|
|
|
|
|
* configuration. This default can be obtained with the respective
|
|
|
|
|
* get_default call.
|
|
|
|
|
*
|
|
|
|
|
* Some configuration option may be dependent on or mutually exclusive with
|
|
|
|
|
* with other options. The behavior in those cases is
|
|
|
|
|
* implementation-defined, the caller must ensure that the options are set
|
|
|
|
|
* in the right order.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-07-21 11:15:43 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Status codes returned when applying configuration settings.
|
|
|
|
|
*/
|
2014-05-16 09:06:41 +10:00
|
|
|
enum libinput_config_status {
|
|
|
|
|
LIBINPUT_CONFIG_STATUS_SUCCESS = 0, /**< Config applied successfully */
|
|
|
|
|
LIBINPUT_CONFIG_STATUS_UNSUPPORTED, /**< Configuration not available on
|
|
|
|
|
this device */
|
|
|
|
|
LIBINPUT_CONFIG_STATUS_INVALID, /**< Invalid parameter range */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
2014-07-21 11:15:43 +10:00
|
|
|
* @ingroup config
|
2014-05-16 09:06:41 +10:00
|
|
|
*
|
|
|
|
|
* Return a string describing the error.
|
|
|
|
|
*
|
|
|
|
|
* @param status The status to translate to a string
|
|
|
|
|
* @return A human-readable string representing the error or NULL for an
|
|
|
|
|
* invalid status.
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
libinput_config_status_to_str(enum libinput_config_status status);
|
|
|
|
|
|
2014-07-21 11:07:25 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_tap_state {
|
|
|
|
|
LIBINPUT_CONFIG_TAP_DISABLED, /**< Tapping is to be disabled, or is
|
|
|
|
|
currently disabled */
|
|
|
|
|
LIBINPUT_CONFIG_TAP_ENABLED, /**< Tapping is to be enabled, or is
|
|
|
|
|
currently enabled */
|
|
|
|
|
};
|
|
|
|
|
|
2014-01-07 11:42:32 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check if the device supports tap-to-click. See
|
|
|
|
|
* libinput_device_config_tap_set_enabled() for more information.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The number of fingers that can generate a tap event, or 0 if the
|
|
|
|
|
* device does not support tapping.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_tap_set_enabled
|
|
|
|
|
* @see libinput_device_config_tap_get_enabled
|
2014-08-26 11:33:59 +10:00
|
|
|
* @see libinput_device_config_tap_get_default_enabled
|
2014-01-07 11:42:32 +10:00
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_tap_get_finger_count(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Enable or disable tap-to-click on this device, with a default mapping of
|
|
|
|
|
* 1, 2, 3 finger tap mapping to left, right, middle click, respectively.
|
|
|
|
|
* Tapping is limited by the number of simultaneous touches
|
|
|
|
|
* supported by the device, see
|
|
|
|
|
* libinput_device_config_tap_get_finger_count().
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
2014-07-21 11:07:25 +10:00
|
|
|
* @param enable @ref LIBINPUT_CONFIG_TAP_ENABLED to enable tapping or @ref
|
|
|
|
|
* LIBINPUT_CONFIG_TAP_DISABLED to disable tapping
|
2014-01-07 11:42:32 +10:00
|
|
|
*
|
|
|
|
|
* @return A config status code. Disabling tapping on a device that does not
|
|
|
|
|
* support tapping always succeeds.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_tap_get_finger_count
|
|
|
|
|
* @see libinput_device_config_tap_get_enabled
|
|
|
|
|
* @see libinput_device_config_tap_get_default_enabled
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_tap_set_enabled(struct libinput_device *device,
|
2014-07-21 11:07:25 +10:00
|
|
|
enum libinput_config_tap_state enable);
|
2014-01-07 11:42:32 +10:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check if tap-to-click is enabled on this device. If the device does not
|
|
|
|
|
* support tapping, this function always returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
2014-07-21 11:07:25 +10:00
|
|
|
* @return @ref LIBINPUT_CONFIG_TAP_ENABLED if tapping is currently enabled,
|
|
|
|
|
* or @ref LIBINPUT_CONFIG_TAP_DISABLED is currently disabled
|
2014-01-07 11:42:32 +10:00
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_tap_get_finger_count
|
|
|
|
|
* @see libinput_device_config_tap_set_enabled
|
|
|
|
|
* @see libinput_device_config_tap_get_default_enabled
|
|
|
|
|
*/
|
2014-07-21 11:07:25 +10:00
|
|
|
enum libinput_config_tap_state
|
2014-01-07 11:42:32 +10:00
|
|
|
libinput_device_config_tap_get_enabled(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Return the default setting for whether tapping is enabled on this device.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
2014-07-21 11:07:25 +10:00
|
|
|
* @return @ref LIBINPUT_CONFIG_TAP_ENABLED if tapping is enabled by default,
|
|
|
|
|
* or @ref LIBINPUT_CONFIG_TAP_DISABLED is disabled by default
|
2014-01-07 11:42:32 +10:00
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_tap_get_finger_count
|
|
|
|
|
* @see libinput_device_config_tap_set_enabled
|
|
|
|
|
* @see libinput_device_config_tap_get_enabled
|
|
|
|
|
*/
|
2014-07-21 11:07:25 +10:00
|
|
|
enum libinput_config_tap_state
|
2014-01-07 11:42:32 +10:00
|
|
|
libinput_device_config_tap_get_default_enabled(struct libinput_device *device);
|
|
|
|
|
|
2014-08-26 11:41:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check if the device can be calibrated via a calibration matrix.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to check
|
|
|
|
|
* @return non-zero if the device can be calibrated, zero otherwise.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_calibration_set_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_default_matrix
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_calibration_has_matrix(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Apply the 3x3 transformation matrix to absolute device coordinates. This
|
|
|
|
|
* matrix has no effect on relative events.
|
|
|
|
|
*
|
|
|
|
|
* Given a 6-element array [a, b, c, d, e, f], the matrix is applied as
|
|
|
|
|
* @code
|
|
|
|
|
* [ a b c ] [ x ]
|
|
|
|
|
* [ d e f ] * [ y ]
|
|
|
|
|
* [ 0 0 1 ] [ 1 ]
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* The translation component (c, f) is expected to be normalized to the
|
|
|
|
|
* device coordinate range. For example, the matrix
|
|
|
|
|
* @code
|
|
|
|
|
* [ 1 0 1 ]
|
|
|
|
|
* [ 0 1 -1 ]
|
|
|
|
|
* [ 0 0 1 ]
|
|
|
|
|
* @endcode
|
|
|
|
|
* moves all coordinates by 1 device-width to the right and 1 device-height
|
|
|
|
|
* up.
|
|
|
|
|
*
|
|
|
|
|
* The rotation matrix for rotation around the origin is defined as
|
|
|
|
|
* @code
|
|
|
|
|
* [ cos(a) -sin(a) 0 ]
|
|
|
|
|
* [ sin(a) cos(a) 0 ]
|
|
|
|
|
* [ 0 0 1 ]
|
|
|
|
|
* @endcode
|
|
|
|
|
* Note that any rotation requires an additional translation component to
|
|
|
|
|
* translate the rotated coordinates back into the original device space.
|
|
|
|
|
* The rotation matrixes for 90, 180 and 270 degrees clockwise are:
|
|
|
|
|
* @code
|
|
|
|
|
* 90 deg cw: 180 deg cw: 270 deg cw:
|
|
|
|
|
* [ 0 -1 1] [ -1 0 1] [ 0 1 0 ]
|
|
|
|
|
* [ 1 0 0] [ 0 -1 1] [ -1 0 1 ]
|
|
|
|
|
* [ 0 0 1] [ 0 0 1] [ 0 0 1 ]
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param matrix An array representing the first two rows of a 3x3 matrix as
|
|
|
|
|
* described above.
|
|
|
|
|
*
|
|
|
|
|
* @return A config status code.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_calibration_has_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_default_matrix
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_calibration_set_matrix(struct libinput_device *device,
|
|
|
|
|
const float matrix[6]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Return the current calibration matrix for this device.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param matrix Set to the array representing the first two rows of a 3x3 matrix as
|
|
|
|
|
* described in libinput_device_config_calibration_set_matrix().
|
|
|
|
|
*
|
|
|
|
|
* @return 0 if no calibration is set and the returned matrix is the
|
|
|
|
|
* identity matrix, 1 otherwise
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_calibration_has_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_set_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_default_matrix
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_calibration_get_matrix(struct libinput_device *device,
|
|
|
|
|
float matrix[6]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
2014-09-10 09:00:09 +10:00
|
|
|
* Return the default calibration matrix for this device. On most devices,
|
|
|
|
|
* this is the identity matrix. If the udev property
|
|
|
|
|
* <b>LIBINPUT_CALIBRATION_MATRIX</b> is set on the respective udev device,
|
|
|
|
|
* that property's value becomes the default matrix.
|
|
|
|
|
*
|
|
|
|
|
* The udev property is parsed as 6 floating point numbers separated by a
|
|
|
|
|
* single space each (scanf(3) format "%f %f %f %f %f %f").
|
|
|
|
|
* The 6 values represent the first two rows of the calibration matrix as
|
|
|
|
|
* described in libinput_device_config_calibration_set_matrix().
|
|
|
|
|
*
|
|
|
|
|
* Example values are:
|
|
|
|
|
* @code
|
|
|
|
|
* ENV{LIBINPUT_CALIBRATION_MATRIX}="1 0 0 0 1 0" # default
|
|
|
|
|
* ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0" # 90 degree clockwise
|
|
|
|
|
* ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1" # 180 degree clockwise
|
|
|
|
|
* ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1" # 270 degree clockwise
|
|
|
|
|
* ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0" # reflect along y axis
|
|
|
|
|
* @endcode
|
2014-08-26 11:41:19 +10:00
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param matrix Set to the array representing the first two rows of a 3x3 matrix as
|
|
|
|
|
* described in libinput_device_config_calibration_set_matrix().
|
|
|
|
|
*
|
|
|
|
|
* @return 0 if no calibration is set and the returned matrix is the
|
|
|
|
|
* identity matrix, 1 otherwise
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_calibration_has_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_set_matrix
|
|
|
|
|
* @see libinput_device_config_calibration_get_default_matrix
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_calibration_get_default_matrix(struct libinput_device *device,
|
|
|
|
|
float matrix[6]);
|
|
|
|
|
|
2014-01-30 16:18:55 +10:00
|
|
|
/**
|
|
|
|
|
* The send-event mode of a device defines when a device may generate events
|
|
|
|
|
* and pass those events to the caller.
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_send_events_mode {
|
|
|
|
|
/**
|
2014-10-30 15:36:52 +10:00
|
|
|
* Send events from this device normally. This is a placeholder
|
|
|
|
|
* mode only, any device detected by libinput can be enabled. Do not
|
|
|
|
|
* test for this value as bitmask.
|
2014-01-30 16:18:55 +10:00
|
|
|
*/
|
2014-10-30 15:36:52 +10:00
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED = 0,
|
2014-01-30 16:18:55 +10:00
|
|
|
/**
|
|
|
|
|
* Do not send events through this device. Depending on the device,
|
|
|
|
|
* this may close all file descriptors on the device or it may leave
|
|
|
|
|
* the file descriptors open and route events through a different
|
|
|
|
|
* device.
|
2014-10-30 15:36:52 +10:00
|
|
|
*
|
|
|
|
|
* If this bit field is set, other disable modes may be
|
|
|
|
|
* ignored. For example, if both @ref
|
|
|
|
|
* LIBINPUT_CONFIG_SEND_EVENTS_DISABLED and @ref
|
|
|
|
|
* LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE are set,
|
|
|
|
|
* the device remains disabled when all external pointer devices are
|
|
|
|
|
* unplugged.
|
2014-01-30 16:18:55 +10:00
|
|
|
*/
|
2014-10-30 15:36:52 +10:00
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED = (1 << 0),
|
2014-01-30 16:18:55 +10:00
|
|
|
/**
|
|
|
|
|
* If an external pointer device is plugged in, do not send events
|
|
|
|
|
* from this device. This option may be available on built-in
|
|
|
|
|
* touchpads.
|
|
|
|
|
*/
|
2014-10-30 15:36:52 +10:00
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE = (1 << 1),
|
2014-01-30 16:18:55 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Return the possible send-event modes for this device. These modes define
|
|
|
|
|
* when a device may process and send events.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return A bitmask of possible modes.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_send_events_set_mode
|
|
|
|
|
* @see libinput_device_config_send_events_get_mode
|
|
|
|
|
* @see libinput_device_config_send_events_get_default_mode
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_device_config_send_events_get_modes(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
2014-09-22 16:37:36 +10:00
|
|
|
* @ingroup config
|
|
|
|
|
*
|
2014-01-30 16:18:55 +10:00
|
|
|
* Set the send-event mode for this device. The mode defines when the device
|
|
|
|
|
* processes and sends events to the caller.
|
|
|
|
|
*
|
|
|
|
|
* The selected mode may not take effect immediately. Events already
|
|
|
|
|
* received and processed from this device are unaffected and will be passed
|
|
|
|
|
* to the caller on the next call to libinput_get_event().
|
|
|
|
|
*
|
2014-10-30 15:36:52 +10:00
|
|
|
* If the mode is a bitmask of @ref libinput_config_send_events_mode,
|
|
|
|
|
* the device may wait for or generate events until it is in a neutral
|
|
|
|
|
* state. For example, this may include waiting for or generating button
|
|
|
|
|
* release events.
|
2014-01-30 16:18:55 +10:00
|
|
|
*
|
|
|
|
|
* If the device is already suspended, this function does nothing and
|
|
|
|
|
* returns success. Changing the send-event mode on a device that has been
|
|
|
|
|
* removed is permitted.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
2014-10-30 15:36:52 +10:00
|
|
|
* @param mode A bitmask of send-events modes
|
2014-01-30 16:18:55 +10:00
|
|
|
*
|
|
|
|
|
* @return A config status code.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_send_events_get_modes
|
|
|
|
|
* @see libinput_device_config_send_events_get_mode
|
|
|
|
|
* @see libinput_device_config_send_events_get_default_mode
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_send_events_set_mode(struct libinput_device *device,
|
2014-10-30 15:36:52 +10:00
|
|
|
uint32_t mode);
|
2014-01-30 16:18:55 +10:00
|
|
|
|
|
|
|
|
/**
|
2014-09-22 16:37:36 +10:00
|
|
|
* @ingroup config
|
|
|
|
|
*
|
2014-01-30 16:18:55 +10:00
|
|
|
* Get the send-event mode for this device. The mode defines when the device
|
|
|
|
|
* processes and sends events to the caller.
|
|
|
|
|
*
|
2014-10-30 15:36:52 +10:00
|
|
|
* If a caller enables the bits for multiple modes, some of which are
|
|
|
|
|
* subsets of another mode libinput may drop the bits that are subsets. In
|
|
|
|
|
* other words, don't expect libinput_device_config_send_events_get_mode()
|
|
|
|
|
* to always return exactly the same bitmask as passed into
|
|
|
|
|
* libinput_device_config_send_events_set_mode().
|
|
|
|
|
*
|
2014-01-30 16:18:55 +10:00
|
|
|
* @param device The device to configure
|
2014-10-30 15:36:52 +10:00
|
|
|
* @return The current bitmask of the send-event mode for this device.
|
2014-01-30 16:18:55 +10:00
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_send_events_get_modes
|
|
|
|
|
* @see libinput_device_config_send_events_set_mode
|
|
|
|
|
* @see libinput_device_config_send_events_get_default_mode
|
|
|
|
|
*/
|
2014-10-30 15:36:52 +10:00
|
|
|
uint32_t
|
2014-01-30 16:18:55 +10:00
|
|
|
libinput_device_config_send_events_get_mode(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
2014-09-22 16:37:36 +10:00
|
|
|
* @ingroup config
|
|
|
|
|
*
|
2014-01-30 16:18:55 +10:00
|
|
|
* Get the default send-event mode for this device. The mode defines when
|
|
|
|
|
* the device processes and sends events to the caller.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
2014-10-30 15:36:52 +10:00
|
|
|
* @return The bitmask of the send-event mode for this device.
|
2014-01-30 16:18:55 +10:00
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_send_events_get_modes
|
|
|
|
|
* @see libinput_device_config_send_events_set_mode
|
2014-11-10 11:59:12 +01:00
|
|
|
* @see libinput_device_config_send_events_get_mode
|
2014-01-30 16:18:55 +10:00
|
|
|
*/
|
2014-10-30 15:36:52 +10:00
|
|
|
uint32_t
|
2014-01-30 16:18:55 +10:00
|
|
|
libinput_device_config_send_events_get_default_mode(struct libinput_device *device);
|
|
|
|
|
|
2014-05-15 15:46:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check if a device uses libinput-internal pointer-acceleration.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return 0 if the device is not accelerated, nonzero if it is accelerated
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_accel_is_available(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Set the pointer acceleration speed of this pointer device within a range
|
|
|
|
|
* of [-1, 1], where 0 is the default acceleration for this device, -1 is
|
|
|
|
|
* the slowest acceleration and 1 is the maximum acceleration available on
|
|
|
|
|
* this device. The actual pointer acceleration mechanism is
|
|
|
|
|
* implementation-dependent, as is the number of steps available within the
|
|
|
|
|
* range. libinput picks the semantically closest acceleration step if the
|
|
|
|
|
* requested value does not match a discreet setting.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param speed The normalized speed, in a range of [-1, 1]
|
|
|
|
|
*
|
|
|
|
|
* @return A config status code
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_accel_set_speed(struct libinput_device *device,
|
|
|
|
|
double speed);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the current pointer acceleration setting for this pointer device. The
|
|
|
|
|
* returned value is normalized to a range of [-1, 1].
|
|
|
|
|
* See libinput_device_config_accel_set_speed() for details.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return The current speed, range -1 to 1
|
|
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
libinput_device_config_accel_get_speed(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Return the default speed setting for this device, normalized to a range
|
|
|
|
|
* of [-1, 1].
|
|
|
|
|
* See libinput_device_config_accel_set_speed() for details.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The default speed setting for this device.
|
|
|
|
|
*/
|
|
|
|
|
double
|
|
|
|
|
libinput_device_config_accel_get_default_speed(struct libinput_device *device);
|
|
|
|
|
|
2014-09-18 15:10:19 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Return non-zero if the device supports "natural scrolling".
|
|
|
|
|
*
|
|
|
|
|
* In traditional scroll mode, the movement of fingers on a touchpad when
|
|
|
|
|
* scrolling matches the movement of the scroll bars. When the fingers move
|
|
|
|
|
* down, the scroll bar moves down, a line of text on the screen moves
|
|
|
|
|
* towards the upper end of the screen. This also matches scroll wheels on
|
|
|
|
|
* mice (wheel down, content moves up).
|
|
|
|
|
*
|
|
|
|
|
* Natural scrolling is the term coined by Apple for inverted scrolling.
|
|
|
|
|
* In this mode, the effect of scrolling movement of fingers on a touchpad
|
|
|
|
|
* resemble physical manipulation of paper. When the fingers move down, a
|
|
|
|
|
* line of text on the screen moves down (scrollbars move up). This is the
|
|
|
|
|
* opposite of scroll wheels on mice.
|
|
|
|
|
*
|
|
|
|
|
* A device supporting natural scrolling can be switched between traditional
|
|
|
|
|
* scroll mode and natural scroll mode.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return 0 if natural scrolling is not supported, non-zero if natural
|
|
|
|
|
* scrolling is supported by this device
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_set_natural_scroll_enabled
|
|
|
|
|
* @see libinput_device_config_get_natural_scroll_enabled
|
|
|
|
|
* @see libinput_device_config_get_default_natural_scroll_enabled
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_scroll_has_natural_scroll(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Enable or disable natural scrolling on the device.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param enable non-zero to enable, zero to disable natural scrolling
|
|
|
|
|
*
|
|
|
|
|
* @return a config status code
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_has_natural_scroll
|
|
|
|
|
* @see libinput_device_config_get_natural_scroll_enabled
|
|
|
|
|
* @see libinput_device_config_get_default_natural_scroll_enabled
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_scroll_set_natural_scroll_enabled(struct libinput_device *device,
|
|
|
|
|
int enable);
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the current mode for scrolling on this device
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return zero if natural scrolling is disabled, non-zero if enabled
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_has_natural_scroll
|
|
|
|
|
* @see libinput_device_config_set_natural_scroll_enabled
|
|
|
|
|
* @see libinput_device_config_get_default_natural_scroll_enabled
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_scroll_get_natural_scroll_enabled(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the default mode for scrolling on this device
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return zero if natural scrolling is disabled by default, non-zero if enabled
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_has_natural_scroll
|
|
|
|
|
* @see libinput_device_config_set_natural_scroll_enabled
|
|
|
|
|
* @see libinput_device_config_get_natural_scroll_enabled
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_scroll_get_default_natural_scroll_enabled(struct libinput_device *device);
|
|
|
|
|
|
2014-09-22 16:48:41 +10:00
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check if a device has a button configuration that supports left-handed
|
|
|
|
|
* usage.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return Non-zero if the device can be set to left-handed, or zero
|
|
|
|
|
* otherwise
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_buttons_set_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_default_left_handed
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_buttons_has_left_handed(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Set the left-handed configuration of the device. A device in left-handed
|
|
|
|
|
* mode sends a left button event instead of the right button and vice
|
|
|
|
|
* versa.
|
|
|
|
|
*
|
|
|
|
|
* The exact button behavior is device-dependent. On a mouse and most
|
|
|
|
|
* pointing devices, left and right buttons are swapped but the middle
|
|
|
|
|
* button is unmodified. On a touchpad, physical buttons (if present) are
|
|
|
|
|
* swapped. On a clickpad, the top and bottom software-emulated buttons are
|
|
|
|
|
* swapped where present, the main area of the touchpad remains a left
|
|
|
|
|
* button. Tapping and clickfinger behavior is not affected by this setting.
|
|
|
|
|
*
|
|
|
|
|
* Changing the left-handed configuration of a device may not take effect
|
|
|
|
|
* until all buttons have been logically released.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param left_handed Zero to disable, non-zero to enable left-handed mode
|
|
|
|
|
* @return A configuration status code
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_buttons_has_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_default_left_handed
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_buttons_set_left_handed(struct libinput_device *device,
|
|
|
|
|
int left_handed);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the current left-handed configuration of the device.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return Zero if the device is in right-handed mode, non-zero if the
|
|
|
|
|
* device is in left-handed mode
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_buttons_has_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_set_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_default_left_handed
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_buttons_get_left_handed(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the default left-handed configuration of the device.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return Zero if the device is in right-handed mode by default, or non-zero if the
|
|
|
|
|
* device is in left-handed mode by default
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_buttons_has_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_set_left_handed
|
|
|
|
|
* @see libinput_device_config_buttons_get_left_handed
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
libinput_device_config_buttons_get_default_left_handed(struct libinput_device *device);
|
|
|
|
|
|
2014-11-03 14:52:59 +01:00
|
|
|
/**
|
|
|
|
|
* The scroll mode of a device selects when to generate scroll axis events
|
|
|
|
|
* instead of pointer motion events.
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_scroll_mode {
|
|
|
|
|
/**
|
|
|
|
|
* Never send scroll events instead of pointer motion events.
|
|
|
|
|
* Note scroll wheels, etc. will still send scroll events.
|
|
|
|
|
*/
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_NO_SCROLL = 0,
|
|
|
|
|
/**
|
|
|
|
|
* Send scroll events when 2 fingers are down on the device.
|
|
|
|
|
*/
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_2FG = (1 << 0),
|
|
|
|
|
/**
|
|
|
|
|
* Send scroll events when a finger is moved along the bottom or
|
|
|
|
|
* right edge of a device.
|
|
|
|
|
*/
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_EDGE = (1 << 1),
|
|
|
|
|
/**
|
|
|
|
|
* Send scroll events when a button is down and the device moves
|
|
|
|
|
* along a scroll-capable axis.
|
|
|
|
|
*/
|
|
|
|
|
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN = (1 << 2),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Check which scroll modes a device supports. The mode defines when to
|
|
|
|
|
* generate scroll axis events instead of pointer motion events.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
*
|
|
|
|
|
* @return A bitmask of possible modes.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_device_config_scroll_get_modes(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Set the scroll mode for this device. The mode defines when to
|
|
|
|
|
* generate scroll axis events instead of pointer motion events.
|
|
|
|
|
*
|
|
|
|
|
* @note Setting @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN enables
|
|
|
|
|
* the scroll mode, but scrolling is only activated when the configured
|
|
|
|
|
* button is held down. If no button is set, i.e.
|
|
|
|
|
* libinput_device_config_scroll_get_button() returns 0, scrolling
|
|
|
|
|
* cannot activate.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param mode The scroll mode for this device.
|
|
|
|
|
*
|
|
|
|
|
* @return A config status code.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_scroll_set_mode(struct libinput_device *device,
|
|
|
|
|
enum libinput_config_scroll_mode mode);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the scroll mode for this device. The mode defines when to
|
|
|
|
|
* generate scroll axis events instead of pointer motion events.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The current scroll mode for this device.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_scroll_mode
|
|
|
|
|
libinput_device_config_scroll_get_mode(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the default scroll mode for this device. The mode defines when to
|
|
|
|
|
* generate scroll axis events instead of pointer motion events.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The default scroll mode for this device.
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_scroll_mode
|
|
|
|
|
libinput_device_config_scroll_get_default_mode(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
|
|
|
|
* for this device.
|
|
|
|
|
*
|
|
|
|
|
* When the current scroll mode is set to @ref
|
|
|
|
|
* LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN, no button press/release events
|
|
|
|
|
* will be send for the configured button.
|
|
|
|
|
*
|
|
|
|
|
* When the configured button is pressed, any motion events along a
|
|
|
|
|
* scroll-capable axis are turned into scroll axis events.
|
|
|
|
|
*
|
|
|
|
|
* @note Setting the button does not change the scroll mode. To change the
|
|
|
|
|
* scroll mode call libinput_device_config_scroll_set_mode().
|
|
|
|
|
*
|
2014-11-19 11:22:17 +10:00
|
|
|
* If the button is 0, button scrolling is effectively disabled.
|
|
|
|
|
*
|
2014-11-03 14:52:59 +01:00
|
|
|
* @param device The device to configure
|
|
|
|
|
* @param button The button which when pressed switches to sending scroll events
|
|
|
|
|
*
|
|
|
|
|
* @return a config status code
|
|
|
|
|
* @retval LIBINPUT_CONFIG_STATUS_SUCCESS on success
|
|
|
|
|
* @retval LIBINPUT_CONFIG_STATUS_UNSUPPORTED if @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN is not supported
|
|
|
|
|
* @retval LIBINPUT_CONFIG_STATUS_INVALID the given button does not
|
|
|
|
|
* exist on this device
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
enum libinput_config_status
|
|
|
|
|
libinput_device_config_scroll_set_button(struct libinput_device *device,
|
|
|
|
|
uint32_t button);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode for
|
|
|
|
|
* this device.
|
|
|
|
|
*
|
|
|
|
|
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll mode is not supported,
|
|
|
|
|
* or no button is set, this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @note The return value is independent of the currently selected
|
|
|
|
|
* scroll-mode. For button scrolling to activate, a device must have the
|
|
|
|
|
* @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode enabled, and a non-zero
|
|
|
|
|
* button set as scroll button.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The button which when pressed switches to sending scroll events
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_button
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_device_config_scroll_get_button(struct libinput_device *device);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup config
|
|
|
|
|
*
|
|
|
|
|
* Get the default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
|
|
|
|
* for this device.
|
|
|
|
|
*
|
|
|
|
|
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll mode is not supported,
|
|
|
|
|
* or no default button is set, this function returns 0.
|
|
|
|
|
*
|
|
|
|
|
* @param device The device to configure
|
|
|
|
|
* @return The default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
|
|
|
|
*
|
|
|
|
|
* @see libinput_device_config_scroll_get_modes
|
|
|
|
|
* @see libinput_device_config_scroll_set_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_mode
|
|
|
|
|
* @see libinput_device_config_scroll_get_default_mode
|
|
|
|
|
* @see libinput_device_config_scroll_set_button
|
|
|
|
|
* @see libinput_device_config_scroll_get_button
|
|
|
|
|
*/
|
|
|
|
|
uint32_t
|
|
|
|
|
libinput_device_config_scroll_get_default_button(struct libinput_device *device);
|
|
|
|
|
|
2014-03-24 23:40:39 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2013-11-10 17:55:40 +01:00
|
|
|
#endif /* LIBINPUT_H */
|