mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-30 22:20:07 +01:00
Merge branch 'master' into tablet-support
Manual changes: * add tablet APIs to libinput.sym * add the tablet-specific events to litest_event_type_str * add NULL for device_remove in the tablet interface Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
commit
24b1f2e995
17 changed files with 444 additions and 115 deletions
|
|
@ -1,4 +1,7 @@
|
|||
/*!@mainpage
|
||||
|
||||
libinput
|
||||
========
|
||||
|
||||
libinput is a library that handles input devices for display servers and other
|
||||
applications that need to directly deal with input devices.
|
||||
|
|
@ -17,3 +20,11 @@ http://cgit.freedesktop.org/wayland/libinput
|
|||
|
||||
For more information, visit:
|
||||
http://www.freedesktop.org/wiki/Software/libinput/
|
||||
|
||||
Bugs can be filed in the libinput component of Wayland:
|
||||
https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland
|
||||
|
||||
Online API documentation:
|
||||
http://wayland.freedesktop.org/libinput/doc/latest/modules.html
|
||||
|
||||
*/
|
||||
|
|
@ -5,7 +5,8 @@ if HAVE_DOXYGEN
|
|||
noinst_DATA = html/index.html
|
||||
|
||||
header_files = \
|
||||
$(top_srcdir)/src/libinput.h
|
||||
$(top_srcdir)/src/libinput.h \
|
||||
$(top_srcdir)/README.txt
|
||||
|
||||
html/index.html: libinput.doxygen $(header_files)
|
||||
$(AM_V_GEN)$(DOXYGEN) $<
|
||||
|
|
|
|||
|
|
@ -753,7 +753,8 @@ WARN_LOGFILE =
|
|||
# spaces.
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @top_srcdir@/src/libinput.h
|
||||
INPUT = @top_srcdir@/src/libinput.h \
|
||||
@top_srcdir@/README.txt
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ libinput_util_la_CFLAGS = -I$(top_srcdir)/include \
|
|||
$(LIBUDEV_CFLAGS) \
|
||||
$(GCC_CFLAGS)
|
||||
|
||||
libinput_la_LDFLAGS = -version-info $(LIBINPUT_LT_VERSION) -shared
|
||||
libinput_la_LDFLAGS = -version-info $(LIBINPUT_LT_VERSION) -shared \
|
||||
-Wl,--version-script=$(srcdir)/libinput.sym
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libinput.pc
|
||||
|
|
@ -56,4 +57,4 @@ pkgconfig_DATA = libinput.pc
|
|||
AM_CFLAGS = $(GCC_CFLAGS)
|
||||
|
||||
DISTCLEANFILES = libinput-version.h
|
||||
EXTRA_DIST = libinput-version.h.in
|
||||
EXTRA_DIST = libinput-version.h.in libinput.sym
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ tp_init_buttons(struct tp_dispatch *tp,
|
|||
}
|
||||
|
||||
void
|
||||
tp_destroy_buttons(struct tp_dispatch *tp)
|
||||
tp_remove_buttons(struct tp_dispatch *tp)
|
||||
{
|
||||
struct tp_touch *t;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ tp_edge_scroll_handle_none(struct tp_dispatch *tp,
|
|||
case SCROLL_EVENT_TIMEOUT:
|
||||
case SCROLL_EVENT_POSTED:
|
||||
log_bug_libinput(libinput,
|
||||
"unexpect scroll event in none state\n");
|
||||
"unexpected scroll event %d in none state\n",
|
||||
event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +129,8 @@ tp_edge_scroll_handle_edge_new(struct tp_dispatch *tp,
|
|||
switch (event) {
|
||||
case SCROLL_EVENT_TOUCH:
|
||||
log_bug_libinput(libinput,
|
||||
"unexpect scroll event in edge new state\n");
|
||||
"unexpected scroll event %d in edge new state\n",
|
||||
event);
|
||||
break;
|
||||
case SCROLL_EVENT_MOTION:
|
||||
t->scroll.edge &= tp_touch_get_edge(tp, t);
|
||||
|
|
@ -157,7 +159,8 @@ tp_edge_scroll_handle_edge(struct tp_dispatch *tp,
|
|||
case SCROLL_EVENT_TOUCH:
|
||||
case SCROLL_EVENT_TIMEOUT:
|
||||
log_bug_libinput(libinput,
|
||||
"unexpect scroll event in edge state\n");
|
||||
"unexpected scroll event %d in edge state\n",
|
||||
event);
|
||||
break;
|
||||
case SCROLL_EVENT_MOTION:
|
||||
/* If started at the bottom right, decide in which dir to scroll */
|
||||
|
|
@ -188,7 +191,8 @@ tp_edge_scroll_handle_area(struct tp_dispatch *tp,
|
|||
case SCROLL_EVENT_TIMEOUT:
|
||||
case SCROLL_EVENT_POSTED:
|
||||
log_bug_libinput(libinput,
|
||||
"unexpect scroll event in area state\n");
|
||||
"unexpected scroll event %d in area state\n",
|
||||
event);
|
||||
break;
|
||||
case SCROLL_EVENT_MOTION:
|
||||
break;
|
||||
|
|
@ -271,7 +275,7 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
|
|||
}
|
||||
|
||||
void
|
||||
tp_destroy_edge_scroll(struct tp_dispatch *tp)
|
||||
tp_remove_edge_scroll(struct tp_dispatch *tp)
|
||||
{
|
||||
struct tp_touch *t;
|
||||
|
||||
|
|
|
|||
|
|
@ -720,7 +720,7 @@ tp_init_tap(struct tp_dispatch *tp)
|
|||
}
|
||||
|
||||
void
|
||||
tp_destroy_tap(struct tp_dispatch *tp)
|
||||
tp_remove_tap(struct tp_dispatch *tp)
|
||||
{
|
||||
libinput_timer_cancel(&tp->tap.timer);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ tp_estimate_delta(int x0, int x1, int x2, int x3)
|
|||
void
|
||||
tp_get_delta(struct tp_touch *t, double *dx, double *dy)
|
||||
{
|
||||
if (t->history.count < 4) {
|
||||
if (t->history.count < TOUCHPAD_MIN_SAMPLES) {
|
||||
*dx = 0;
|
||||
*dy = 0;
|
||||
return;
|
||||
|
|
@ -448,6 +448,10 @@ tp_twofinger_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
|
|||
if (tp_tap_dragging(tp))
|
||||
return 0;
|
||||
|
||||
/* No 2fg scrolling while a clickpad is clicked */
|
||||
if (tp->buttons.is_clickpad && tp->buttons.state)
|
||||
return 0;
|
||||
|
||||
/* Only count active touches for 2 finger scrolling */
|
||||
tp_for_each_touch(tp, t) {
|
||||
if (tp_touch_active(tp, t))
|
||||
|
|
@ -512,9 +516,9 @@ tp_stop_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
|||
}
|
||||
|
||||
static void
|
||||
tp_destroy_scroll(struct tp_dispatch *tp)
|
||||
tp_remove_scroll(struct tp_dispatch *tp)
|
||||
{
|
||||
tp_destroy_edge_scroll(tp);
|
||||
tp_remove_edge_scroll(tp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -586,14 +590,67 @@ tp_post_process_state(struct tp_dispatch *tp, uint64_t time)
|
|||
tp->queued = TOUCHPAD_EVENT_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
tp_get_pointer_delta(struct tp_dispatch *tp, double *dx, double *dy)
|
||||
{
|
||||
struct tp_touch *t = tp_current_touch(tp);
|
||||
|
||||
if (!t->is_pointer) {
|
||||
tp_for_each_touch(tp, t) {
|
||||
if (t->is_pointer)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!t->is_pointer || !t->dirty)
|
||||
return;
|
||||
|
||||
tp_get_delta(t, dx, dy);
|
||||
}
|
||||
|
||||
static void
|
||||
tp_get_active_touches_delta(struct tp_dispatch *tp, double *dx, double *dy)
|
||||
{
|
||||
struct tp_touch *t;
|
||||
double tdx, tdy;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < tp->real_touches; i++) {
|
||||
t = tp_get_touch(tp, i);
|
||||
|
||||
if (!tp_touch_active(tp, t) || !t->dirty)
|
||||
continue;
|
||||
|
||||
tp_get_delta(t, &tdx, &tdy);
|
||||
*dx += tdx;
|
||||
*dy += tdy;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tp_post_pointer_motion(struct tp_dispatch *tp, uint64_t time)
|
||||
{
|
||||
double dx = 0.0, dy = 0.0;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
|
||||
/* When a clickpad is clicked, combine motion of all active touches */
|
||||
if (tp->buttons.is_clickpad && tp->buttons.state)
|
||||
tp_get_active_touches_delta(tp, &dx, &dy);
|
||||
else
|
||||
tp_get_pointer_delta(tp, &dx, &dy);
|
||||
|
||||
tp_filter_motion(tp, &dx, &dy, &dx_unaccel, &dy_unaccel, time);
|
||||
|
||||
if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) {
|
||||
pointer_notify_motion(&tp->device->base, time,
|
||||
dx, dy, dx_unaccel, dy_unaccel);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tp_post_events(struct tp_dispatch *tp, uint64_t time)
|
||||
{
|
||||
struct tp_touch *t = tp_current_touch(tp);
|
||||
double dx, dy;
|
||||
int filter_motion = 0;
|
||||
double dx_unaccel, dy_unaccel;
|
||||
|
||||
/* Only post (top) button events while suspended */
|
||||
if (tp->device->suspended) {
|
||||
|
|
@ -612,25 +669,7 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time)
|
|||
if (tp_post_scroll_events(tp, time) != 0)
|
||||
return;
|
||||
|
||||
if (!t->is_pointer) {
|
||||
tp_for_each_touch(tp, t) {
|
||||
if (t->is_pointer)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!t->is_pointer ||
|
||||
!t->dirty ||
|
||||
t->history.count < TOUCHPAD_MIN_SAMPLES)
|
||||
return;
|
||||
|
||||
tp_get_delta(t, &dx, &dy);
|
||||
tp_filter_motion(tp, &dx, &dy, &dx_unaccel, &dy_unaccel, time);
|
||||
|
||||
if (dx != 0.0 || dy != 0.0 || dx_unaccel != 0.0 || dy_unaccel != 0.0) {
|
||||
pointer_notify_motion(&tp->device->base, time,
|
||||
dx, dy, dx_unaccel, dy_unaccel);
|
||||
}
|
||||
tp_post_pointer_motion(tp, time);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -668,7 +707,7 @@ tp_process(struct evdev_dispatch *dispatch,
|
|||
}
|
||||
|
||||
static void
|
||||
tp_destroy_sendevents(struct tp_dispatch *tp)
|
||||
tp_remove_sendevents(struct tp_dispatch *tp)
|
||||
{
|
||||
libinput_timer_cancel(&tp->sendevents.trackpoint_timer);
|
||||
|
||||
|
|
@ -677,16 +716,24 @@ tp_destroy_sendevents(struct tp_dispatch *tp)
|
|||
&tp->sendevents.trackpoint_listener);
|
||||
}
|
||||
|
||||
static void
|
||||
tp_remove(struct evdev_dispatch *dispatch)
|
||||
{
|
||||
struct tp_dispatch *tp =
|
||||
(struct tp_dispatch*)dispatch;
|
||||
|
||||
tp_remove_tap(tp);
|
||||
tp_remove_buttons(tp);
|
||||
tp_remove_sendevents(tp);
|
||||
tp_remove_scroll(tp);
|
||||
}
|
||||
|
||||
static void
|
||||
tp_destroy(struct evdev_dispatch *dispatch)
|
||||
{
|
||||
struct tp_dispatch *tp =
|
||||
(struct tp_dispatch*)dispatch;
|
||||
|
||||
tp_destroy_tap(tp);
|
||||
tp_destroy_buttons(tp);
|
||||
tp_destroy_sendevents(tp);
|
||||
tp_destroy_scroll(tp);
|
||||
|
||||
free(tp->touches);
|
||||
free(tp);
|
||||
|
|
@ -858,6 +905,7 @@ tp_tag_device(struct evdev_device *device,
|
|||
|
||||
static struct evdev_dispatch_interface tp_interface = {
|
||||
tp_process,
|
||||
tp_remove,
|
||||
tp_destroy,
|
||||
tp_device_added,
|
||||
tp_device_removed,
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ int
|
|||
tp_init_tap(struct tp_dispatch *tp);
|
||||
|
||||
void
|
||||
tp_destroy_tap(struct tp_dispatch *tp);
|
||||
tp_remove_tap(struct tp_dispatch *tp);
|
||||
|
||||
int
|
||||
tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
|
||||
|
|
@ -298,7 +298,7 @@ tp_init_softbuttons(struct tp_dispatch *tp,
|
|||
double topbutton_size_mult);
|
||||
|
||||
void
|
||||
tp_destroy_buttons(struct tp_dispatch *tp);
|
||||
tp_remove_buttons(struct tp_dispatch *tp);
|
||||
|
||||
int
|
||||
tp_process_button(struct tp_dispatch *tp,
|
||||
|
|
@ -338,7 +338,7 @@ int
|
|||
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
|
||||
|
||||
void
|
||||
tp_destroy_edge_scroll(struct tp_dispatch *tp);
|
||||
tp_remove_edge_scroll(struct tp_dispatch *tp);
|
||||
|
||||
void
|
||||
tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time);
|
||||
|
|
|
|||
|
|
@ -541,6 +541,7 @@ tablet_destroy(struct evdev_dispatch *dispatch)
|
|||
|
||||
static struct evdev_dispatch_interface tablet_interface = {
|
||||
tablet_process,
|
||||
NULL, /* remove */
|
||||
tablet_destroy,
|
||||
NULL, /* device_added */
|
||||
NULL, /* device_removed */
|
||||
|
|
|
|||
29
src/evdev.c
29
src/evdev.c
|
|
@ -737,6 +737,7 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
|
|||
|
||||
struct evdev_dispatch_interface fallback_interface = {
|
||||
fallback_process,
|
||||
NULL, /* remove */
|
||||
fallback_destroy,
|
||||
NULL, /* device_added */
|
||||
NULL, /* device_removed */
|
||||
|
|
@ -1612,13 +1613,6 @@ err:
|
|||
return unhandled_device ? EVDEV_UNHANDLED_DEVICE : NULL;
|
||||
}
|
||||
|
||||
int
|
||||
evdev_device_get_keys(struct evdev_device *device, char *keys, size_t size)
|
||||
{
|
||||
memset(keys, 0, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
evdev_device_get_output(struct evdev_device *device)
|
||||
{
|
||||
|
|
@ -1995,6 +1989,8 @@ evdev_device_resume(struct evdev_device *device)
|
|||
struct libinput *libinput = device->base.seat->libinput;
|
||||
int fd;
|
||||
const char *devnode;
|
||||
struct input_event ev;
|
||||
enum libevdev_read_status status;
|
||||
|
||||
if (device->fd != -1)
|
||||
return 0;
|
||||
|
|
@ -2021,6 +2017,20 @@ evdev_device_resume(struct evdev_device *device)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
libevdev_change_fd(device->evdev, fd);
|
||||
libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC);
|
||||
|
||||
/* re-sync libevdev's view of the device, but discard the actual
|
||||
events. Our device is in a neutral state already */
|
||||
libevdev_next_event(device->evdev,
|
||||
LIBEVDEV_READ_FLAG_FORCE_SYNC,
|
||||
&ev);
|
||||
do {
|
||||
status = libevdev_next_event(device->evdev,
|
||||
LIBEVDEV_READ_FLAG_SYNC,
|
||||
&ev);
|
||||
} while (status == LIBEVDEV_READ_STATUS_SYNC);
|
||||
|
||||
device->source =
|
||||
libinput_add_fd(libinput, fd, evdev_device_dispatch, device);
|
||||
if (!device->source) {
|
||||
|
|
@ -2041,7 +2051,7 @@ evdev_device_remove(struct evdev_device *device)
|
|||
struct libinput_device *dev;
|
||||
|
||||
list_for_each(dev, &device->base.seat->devices_list, link) {
|
||||
struct evdev_device *d = (struct evdev_device*)dev;;
|
||||
struct evdev_device *d = (struct evdev_device*)dev;
|
||||
if (dev == &device->base)
|
||||
continue;
|
||||
|
||||
|
|
@ -2051,6 +2061,9 @@ evdev_device_remove(struct evdev_device *device)
|
|||
|
||||
evdev_device_suspend(device);
|
||||
|
||||
if (device->dispatch->interface->remove)
|
||||
device->dispatch->interface->remove(device->dispatch);
|
||||
|
||||
/* A device may be removed while suspended, mark it to
|
||||
* skip re-opening a different device with the same node */
|
||||
device->was_removed = true;
|
||||
|
|
|
|||
|
|
@ -167,6 +167,9 @@ struct evdev_dispatch_interface {
|
|||
struct input_event *event,
|
||||
uint64_t time);
|
||||
|
||||
/* Device is being removed (may be NULL) */
|
||||
void (*remove)(struct evdev_dispatch *dispatch);
|
||||
|
||||
/* Destroy an event dispatch handler and free all its resources. */
|
||||
void (*destroy)(struct evdev_dispatch *dispatch);
|
||||
|
||||
|
|
|
|||
|
|
@ -1597,22 +1597,6 @@ libinput_device_led_update(struct libinput_device *device,
|
|||
evdev_device_led_update((struct evdev_device *) device, leds);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_get_keys(struct libinput_device *device,
|
||||
char *keys, size_t size)
|
||||
{
|
||||
return evdev_device_get_keys((struct evdev_device *) device,
|
||||
keys,
|
||||
size);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT void
|
||||
libinput_device_calibrate(struct libinput_device *device,
|
||||
float calibration[6])
|
||||
{
|
||||
evdev_device_calibrate((struct evdev_device *) device, calibration);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT int
|
||||
libinput_device_has_capability(struct libinput_device *device,
|
||||
enum libinput_device_capability capability)
|
||||
|
|
|
|||
115
src/libinput.h
115
src/libinput.h
|
|
@ -35,13 +35,6 @@ extern "C" {
|
|||
__attribute__ ((format (printf, _format, _args)))
|
||||
#define LIBINPUT_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
|
||||
|
||||
/**
|
||||
* @mainpage
|
||||
* libinput is a generic input device handling library. It abstracts
|
||||
* commonly-used concepts such as keyboard, pointer and touchpad handling
|
||||
* behind an API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @page tpbuttons Touchpad button behavior
|
||||
*
|
||||
|
|
@ -185,9 +178,9 @@ extern "C" {
|
|||
*
|
||||
* If the property is unset, libinput assumes the resolution is 1000dpi.
|
||||
*
|
||||
* Note that HW does not usually provide information about the resolution
|
||||
* changes, libinput will thus not detect when a resolution changes to the
|
||||
* non-default value.
|
||||
* Note that HW does not usually provide information about run-time
|
||||
* resolution changes, libinput will thus not detect when a resolution
|
||||
* changes to the non-default value.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -370,13 +363,68 @@ enum libinput_event_type {
|
|||
LIBINPUT_EVENT_TABLET_BUTTON
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup base
|
||||
* @struct libinput
|
||||
*
|
||||
* A handle for accessing libinput. This struct is refcounted, use
|
||||
* libinput_ref() and libinput_unref().
|
||||
*/
|
||||
struct libinput;
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
* @struct libinput_device
|
||||
*
|
||||
* A base handle for accessing libinput devices. This struct is
|
||||
* refcounted, use libinput_device_ref() and libinput_device_unref().
|
||||
*/
|
||||
struct libinput_device;
|
||||
|
||||
/**
|
||||
* @ingroup seat
|
||||
* @struct libinput_seat
|
||||
*
|
||||
* The base handle for accessing libinput seats. This struct is
|
||||
* refcounted, use libinput_seat_ref() and libinput_seat_unref().
|
||||
*/
|
||||
struct libinput_seat;
|
||||
|
||||
/**
|
||||
* @ingroup event
|
||||
* @struct libinput_event
|
||||
*
|
||||
* The base event type. Use libinput_event_get_pointer_event() or similar to
|
||||
* get the actual event type.
|
||||
*
|
||||
* @warning Unlike other structs events are considered transient and
|
||||
* <b>not</b> refcounted.
|
||||
*/
|
||||
struct libinput_event;
|
||||
|
||||
/**
|
||||
* @ingroup event
|
||||
* @struct libinput_event_device_notify
|
||||
*
|
||||
* An event notifying the caller of a device being added or removed.
|
||||
*/
|
||||
struct libinput_event_device_notify;
|
||||
|
||||
/**
|
||||
* @ingroup event_keyboard
|
||||
* @struct libinput_event_keyboard
|
||||
*
|
||||
* A keyboard event representing a key press/release.
|
||||
*/
|
||||
struct libinput_event_keyboard;
|
||||
|
||||
/**
|
||||
* @ingroup event_pointer
|
||||
* @struct libinput_event_pointer
|
||||
*
|
||||
* A pointer event representing relative or absolute pointer movement,
|
||||
* a button press/release or scroll axis events.
|
||||
*/
|
||||
struct libinput_event_pointer;
|
||||
|
||||
/**
|
||||
|
|
@ -409,7 +457,12 @@ struct libinput_event_tablet;
|
|||
/**
|
||||
* @ingroup event
|
||||
*
|
||||
* Destroy the event.
|
||||
* Destroy the event, freeing all associated resources. Resources obtained
|
||||
* from this event must be considered invalid after this call.
|
||||
*
|
||||
* @warning Unlike other structs events are considered transient and
|
||||
* <b>not</b> refcounted. Calling libinput_event_destroy() <b>will</b>
|
||||
* destroy the event.
|
||||
*
|
||||
* @param event An event retrieved by libinput_get_event().
|
||||
*/
|
||||
|
|
@ -558,7 +611,6 @@ libinput_event_keyboard_get_key(struct libinput_event_keyboard *event);
|
|||
enum libinput_key_state
|
||||
libinput_event_keyboard_get_key_state(struct libinput_event_keyboard *event);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup event_keyboard
|
||||
*
|
||||
|
|
@ -855,7 +907,6 @@ libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
|
|||
struct libinput_event *
|
||||
libinput_event_pointer_get_base_event(struct libinput_event_pointer *event);
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup event_touch Touch events
|
||||
*
|
||||
|
|
@ -1221,6 +1272,17 @@ libinput_tool_set_user_data(struct libinput_tool *tool,
|
|||
* @defgroup base Initialization and manipulation of libinput contexts
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup base
|
||||
* @struct libinput_interface
|
||||
*
|
||||
* libinput does not open file descriptors to devices directly, instead
|
||||
* open_restricted() and close_restricted() are called for each path that
|
||||
* must be opened.
|
||||
*
|
||||
* @see libinput_udev_create_context
|
||||
* @see libinput_path_create_context
|
||||
*/
|
||||
struct libinput_interface {
|
||||
/**
|
||||
* Open the device at the given path with the flags provided and
|
||||
|
|
@ -1875,33 +1937,6 @@ void
|
|||
libinput_device_led_update(struct libinput_device *device,
|
||||
enum libinput_led leds);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*
|
||||
* @return The number of valid bytes in keys, or a negative errno on failure
|
||||
*/
|
||||
int
|
||||
libinput_device_get_keys(struct libinput_device *device,
|
||||
char *keys, size_t size)
|
||||
LIBINPUT_ATTRIBUTE_DEPRECATED;
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
* @deprecated Use libinput_device_config_calibration_set_matrix() instead.
|
||||
*/
|
||||
void
|
||||
libinput_device_calibrate(struct libinput_device *device,
|
||||
float calibration[6])
|
||||
LIBINPUT_ATTRIBUTE_DEPRECATED;
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
|
|
|
|||
137
src/libinput.sym
Normal file
137
src/libinput.sym
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/* in alphabetical order! */
|
||||
|
||||
LIBINPUT_0.8.0 {
|
||||
global:
|
||||
libinput_config_status_to_str;
|
||||
libinput_device_config_accel_get_default_speed;
|
||||
libinput_device_config_accel_get_speed;
|
||||
libinput_device_config_accel_is_available;
|
||||
libinput_device_config_accel_set_speed;
|
||||
libinput_device_config_buttons_get_default_left_handed;
|
||||
libinput_device_config_buttons_get_left_handed;
|
||||
libinput_device_config_buttons_has_left_handed;
|
||||
libinput_device_config_buttons_set_left_handed;
|
||||
libinput_device_config_calibration_get_default_matrix;
|
||||
libinput_device_config_calibration_get_matrix;
|
||||
libinput_device_config_calibration_has_matrix;
|
||||
libinput_device_config_calibration_set_matrix;
|
||||
libinput_device_config_scroll_get_button;
|
||||
libinput_device_config_scroll_get_default_button;
|
||||
libinput_device_config_scroll_get_default_method;
|
||||
libinput_device_config_scroll_get_default_natural_scroll_enabled;
|
||||
libinput_device_config_scroll_get_methods;
|
||||
libinput_device_config_scroll_get_method;
|
||||
libinput_device_config_scroll_get_natural_scroll_enabled;
|
||||
libinput_device_config_scroll_has_natural_scroll;
|
||||
libinput_device_config_scroll_set_button;
|
||||
libinput_device_config_scroll_set_method;
|
||||
libinput_device_config_scroll_set_natural_scroll_enabled;
|
||||
libinput_device_config_send_events_get_default_mode;
|
||||
libinput_device_config_send_events_get_modes;
|
||||
libinput_device_config_send_events_get_mode;
|
||||
libinput_device_config_send_events_set_mode;
|
||||
libinput_device_config_tap_get_default_enabled;
|
||||
libinput_device_config_tap_get_enabled;
|
||||
libinput_device_config_tap_get_finger_count;
|
||||
libinput_device_config_tap_set_enabled;
|
||||
libinput_device_get_context;
|
||||
libinput_device_get_id_product;
|
||||
libinput_device_get_id_vendor;
|
||||
libinput_device_get_name;
|
||||
libinput_device_get_output_name;
|
||||
libinput_device_get_seat;
|
||||
libinput_device_get_size;
|
||||
libinput_device_get_sysname;
|
||||
libinput_device_get_udev_device;
|
||||
libinput_device_get_user_data;
|
||||
libinput_device_has_button;
|
||||
libinput_device_has_capability;
|
||||
libinput_device_led_update;
|
||||
libinput_device_ref;
|
||||
libinput_device_set_seat_logical_name;
|
||||
libinput_device_set_user_data;
|
||||
libinput_device_unref;
|
||||
libinput_dispatch;
|
||||
libinput_event_destroy;
|
||||
libinput_event_device_notify_get_base_event;
|
||||
libinput_event_get_context;
|
||||
libinput_event_get_device_notify_event;
|
||||
libinput_event_get_device;
|
||||
libinput_event_get_keyboard_event;
|
||||
libinput_event_get_pointer_event;
|
||||
libinput_event_get_touch_event;
|
||||
libinput_event_get_type;
|
||||
libinput_event_keyboard_get_base_event;
|
||||
libinput_event_keyboard_get_key_state;
|
||||
libinput_event_keyboard_get_key;
|
||||
libinput_event_keyboard_get_seat_key_count;
|
||||
libinput_event_keyboard_get_time;
|
||||
libinput_event_pointer_get_absolute_x;
|
||||
libinput_event_pointer_get_absolute_x_transformed;
|
||||
libinput_event_pointer_get_absolute_y;
|
||||
libinput_event_pointer_get_absolute_y_transformed;
|
||||
libinput_event_pointer_get_axis;
|
||||
libinput_event_pointer_get_axis_value;
|
||||
libinput_event_pointer_get_base_event;
|
||||
libinput_event_pointer_get_button_state;
|
||||
libinput_event_pointer_get_button;
|
||||
libinput_event_pointer_get_dx;
|
||||
libinput_event_pointer_get_dx_unaccelerated;
|
||||
libinput_event_pointer_get_dy;
|
||||
libinput_event_pointer_get_dy_unaccelerated;
|
||||
libinput_event_pointer_get_seat_button_count;
|
||||
libinput_event_pointer_get_time;
|
||||
libinput_event_touch_get_base_event;
|
||||
libinput_event_touch_get_seat_slot;
|
||||
libinput_event_touch_get_slot;
|
||||
libinput_event_touch_get_time;
|
||||
libinput_event_touch_get_x;
|
||||
libinput_event_touch_get_x_transformed;
|
||||
libinput_event_touch_get_y;
|
||||
libinput_event_touch_get_y_transformed;
|
||||
libinput_get_event;
|
||||
libinput_get_fd;
|
||||
libinput_get_user_data;
|
||||
libinput_log_get_priority;
|
||||
libinput_log_set_handler;
|
||||
libinput_log_set_priority;
|
||||
libinput_next_event_type;
|
||||
libinput_path_add_device;
|
||||
libinput_path_create_context;
|
||||
libinput_path_remove_device;
|
||||
libinput_ref;
|
||||
libinput_resume;
|
||||
libinput_seat_get_context;
|
||||
libinput_seat_get_logical_name;
|
||||
libinput_seat_get_physical_name;
|
||||
libinput_seat_get_user_data;
|
||||
libinput_seat_ref;
|
||||
libinput_seat_set_user_data;
|
||||
libinput_seat_unref;
|
||||
libinput_suspend;
|
||||
libinput_udev_assign_seat;
|
||||
libinput_udev_create_context;
|
||||
libinput_unref;
|
||||
|
||||
/* tablet APIs, they are not part of any stable API promise yet.
|
||||
* keep them separate */
|
||||
libinput_event_get_tablet_event;
|
||||
libinput_event_tablet_axis_has_changed;
|
||||
libinput_event_tablet_get_axis_value;
|
||||
libinput_event_tablet_get_button;
|
||||
libinput_event_tablet_get_button_state;
|
||||
libinput_event_tablet_get_seat_button_count;
|
||||
libinput_event_tablet_get_time;
|
||||
libinput_event_tablet_get_tool;
|
||||
libinput_event_tablet_get_x_transformed;
|
||||
libinput_event_tablet_get_y_transformed;
|
||||
libinput_tool_get_serial;
|
||||
libinput_tool_get_type;
|
||||
libinput_tool_get_user_data;
|
||||
libinput_tool_has_axis;
|
||||
libinput_tool_ref;
|
||||
libinput_tool_set_user_data;
|
||||
libinput_tool_unref;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
@ -121,6 +121,8 @@ START_TEST(device_disable)
|
|||
struct libinput *li = dev->libinput;
|
||||
struct libinput_device *device;
|
||||
enum libinput_config_status status;
|
||||
struct libinput_event *event;
|
||||
struct litest_device *tmp;
|
||||
|
||||
device = dev->libinput_device;
|
||||
|
||||
|
|
@ -138,11 +140,30 @@ START_TEST(device_disable)
|
|||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
/* create a new device so the resumed fd isn't the same as the
|
||||
suspended one */
|
||||
tmp = litest_add_device(li, LITEST_KEYBOARD);
|
||||
ck_assert_notnull(tmp);
|
||||
litest_drain_events(li);
|
||||
|
||||
/* no event from resuming */
|
||||
status = libinput_device_config_send_events_set_mode(device,
|
||||
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
|
||||
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
/* event from renabled device */
|
||||
litest_event(dev, EV_REL, REL_X, 10);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
|
||||
libinput_dispatch(li);
|
||||
event = libinput_get_event(li);
|
||||
ck_assert_notnull(event);
|
||||
ck_assert_int_eq(libinput_event_get_type(event),
|
||||
LIBINPUT_EVENT_POINTER_MOTION);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
litest_delete_device(tmp);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
@ -572,7 +593,7 @@ START_TEST(device_disable_topsoftbutton)
|
|||
event = libinput_get_event(li);
|
||||
ck_assert_int_eq(libinput_event_get_type(event),
|
||||
LIBINPUT_EVENT_POINTER_BUTTON);
|
||||
ck_assert_int_eq(libinput_event_get_device(event),
|
||||
ck_assert_ptr_eq(libinput_event_get_device(event),
|
||||
trackpoint->libinput_device);
|
||||
ptrevent = libinput_event_get_pointer_event(event);
|
||||
ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent),
|
||||
|
|
@ -584,7 +605,7 @@ START_TEST(device_disable_topsoftbutton)
|
|||
event = libinput_get_event(li);
|
||||
ck_assert_int_eq(libinput_event_get_type(event),
|
||||
LIBINPUT_EVENT_POINTER_BUTTON);
|
||||
ck_assert_int_eq(libinput_event_get_device(event),
|
||||
ck_assert_ptr_eq(libinput_event_get_device(event),
|
||||
trackpoint->libinput_device);
|
||||
ptrevent = libinput_event_get_pointer_event(event);
|
||||
ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent),
|
||||
|
|
|
|||
|
|
@ -994,6 +994,66 @@ litest_drain_events(struct libinput *li)
|
|||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
litest_event_type_str(struct libinput_event *event)
|
||||
{
|
||||
const char *str = NULL;
|
||||
|
||||
switch (libinput_event_get_type(event)) {
|
||||
case LIBINPUT_EVENT_NONE:
|
||||
abort();
|
||||
case LIBINPUT_EVENT_DEVICE_ADDED:
|
||||
str = "ADDED";
|
||||
break;
|
||||
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
||||
str = "REMOVED";
|
||||
break;
|
||||
case LIBINPUT_EVENT_KEYBOARD_KEY:
|
||||
str = "KEY";
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_MOTION:
|
||||
str = "MOTION";
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
str = "ABSOLUTE";
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
str = "BUTTON";
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
str = "AXIS";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_DOWN:
|
||||
str = "TOUCH DOWN";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_UP:
|
||||
str = "TOUCH UP";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_MOTION:
|
||||
str = "TOUCH MOTION";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
||||
str = "TOUCH CANCEL";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TOUCH_FRAME:
|
||||
str = "TOUCH FRAME";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TABLET_AXIS:
|
||||
str = "TABLET AXIS";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TABLET_PROXIMITY_IN:
|
||||
str = "TABLET PROX IN";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TABLET_PROXIMITY_OUT:
|
||||
str = "TABLET PROX OUT";
|
||||
break;
|
||||
case LIBINPUT_EVENT_TABLET_BUTTON:
|
||||
str = "TABLET BUTTON";
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static void
|
||||
litest_print_event(struct libinput_event *event)
|
||||
{
|
||||
|
|
@ -1006,29 +1066,38 @@ litest_print_event(struct libinput_event *event)
|
|||
type = libinput_event_get_type(event);
|
||||
|
||||
fprintf(stderr,
|
||||
"device %s type %d ",
|
||||
"device %s type %s ",
|
||||
libinput_device_get_sysname(dev),
|
||||
type);
|
||||
litest_event_type_str(event));
|
||||
switch (type) {
|
||||
case LIBINPUT_EVENT_POINTER_MOTION:
|
||||
p = libinput_event_get_pointer_event(event);
|
||||
x = libinput_event_pointer_get_dx(p);
|
||||
y = libinput_event_pointer_get_dy(p);
|
||||
fprintf(stderr, "motion: %.2f/%.2f", x, y);
|
||||
fprintf(stderr, "%.2f/%.2f", x, y);
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
||||
p = libinput_event_get_pointer_event(event);
|
||||
x = libinput_event_pointer_get_absolute_x(p);
|
||||
y = libinput_event_pointer_get_absolute_y(p);
|
||||
fprintf(stderr, "motion: %.2f/%.2f", x, y);
|
||||
fprintf(stderr, "%.2f/%.2f", x, y);
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_BUTTON:
|
||||
p = libinput_event_get_pointer_event(event);
|
||||
fprintf(stderr,
|
||||
"button: %d state %d",
|
||||
"button %d state %d",
|
||||
libinput_event_pointer_get_button(p),
|
||||
libinput_event_pointer_get_button_state(p));
|
||||
break;
|
||||
case LIBINPUT_EVENT_POINTER_AXIS:
|
||||
p = libinput_event_get_pointer_event(event);
|
||||
fprintf(stderr,
|
||||
"axis %s value %.2f",
|
||||
libinput_event_pointer_get_axis(p) ==
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL ?
|
||||
"vert" : "horiz",
|
||||
libinput_event_pointer_get_axis_value(p));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue