mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-21 00:20:05 +01:00
Instead of having a test device which only purpose is to test absolute coordinate transformation, use the litest_create_device_with_overrides() API to create a specially crafted wacom touch device with high resolution. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
121 lines
3.9 KiB
C
121 lines
3.9 KiB
C
/*
|
|
* Copyright © 2013 Red Hat, Inc.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#if HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#ifndef LITEST_H
|
|
#define LITEST_H
|
|
|
|
#include <stdbool.h>
|
|
#include <check.h>
|
|
#include <libevdev/libevdev.h>
|
|
#include <libevdev/libevdev-uinput.h>
|
|
#include <libinput.h>
|
|
|
|
enum litest_device_type {
|
|
LITEST_NO_DEVICE = -1,
|
|
LITEST_SYNAPTICS_CLICKPAD,
|
|
LITEST_SYNAPTICS_TOUCHPAD,
|
|
LITEST_BCM5974,
|
|
LITEST_KEYBOARD,
|
|
LITEST_TRACKPOINT,
|
|
LITEST_MOUSE,
|
|
LITEST_WACOM_TOUCH,
|
|
};
|
|
|
|
enum litest_device_feature {
|
|
LITEST_DISABLE_DEVICE = -1,
|
|
LITEST_ANY = 0,
|
|
LITEST_TOUCHPAD = 1 << 0,
|
|
LITEST_CLICKPAD = 1 << 1,
|
|
LITEST_BUTTON = 1 << 2,
|
|
LITEST_KEYS = 1 << 3,
|
|
LITEST_POINTER = 1 << 4,
|
|
LITEST_WHEEL = 1 << 5,
|
|
LITEST_TOUCH = 1 << 6,
|
|
LITEST_SINGLE_TOUCH = 1 << 7,
|
|
};
|
|
|
|
struct litest_device {
|
|
struct libevdev *evdev;
|
|
struct libevdev_uinput *uinput;
|
|
struct libinput *libinput;
|
|
struct libinput_device *libinput_device;
|
|
struct litest_device_interface *interface;
|
|
};
|
|
|
|
void litest_add(const char *name, void *func,
|
|
enum litest_device_feature required_feature,
|
|
enum litest_device_feature excluded_feature);
|
|
void litest_add_no_device(const char *name, void *func);
|
|
|
|
int litest_run(int argc, char **argv);
|
|
struct litest_device * litest_create_device(enum litest_device_type which);
|
|
struct libevdev_uinput *
|
|
litest_create_uinput_device_from_description(const char *name,
|
|
const struct input_id *id,
|
|
const struct input_absinfo *abs,
|
|
const int *events);
|
|
struct litest_device *
|
|
litest_create_device_with_overrides(enum litest_device_type which,
|
|
const char *name_override,
|
|
struct input_id *id_override,
|
|
const struct input_absinfo *abs_override,
|
|
const int *events_override);
|
|
struct litest_device *litest_current_device(void);
|
|
void litest_delete_device(struct litest_device *d);
|
|
int litest_handle_events(struct litest_device *d);
|
|
|
|
void litest_event(struct litest_device *t,
|
|
unsigned int type,
|
|
unsigned int code,
|
|
int value);
|
|
void litest_touch_up(struct litest_device *d, unsigned int slot);
|
|
void litest_touch_move(struct litest_device *d,
|
|
unsigned int slot,
|
|
int x,
|
|
int y);
|
|
void litest_touch_down(struct litest_device *d,
|
|
unsigned int slot,
|
|
int x,
|
|
int y);
|
|
void litest_touch_move_to(struct litest_device *d,
|
|
unsigned int slot,
|
|
int x_from, int y_from,
|
|
int x_to, int y_to,
|
|
int steps);
|
|
void litest_button_click(struct litest_device *d,
|
|
unsigned int button,
|
|
bool is_press);
|
|
void litest_drain_events(struct libinput *li);
|
|
|
|
struct libevdev_uinput * litest_create_uinput_device(const char *name,
|
|
struct input_id *id,
|
|
...);
|
|
struct libevdev_uinput * litest_create_uinput_abs_device(const char *name,
|
|
struct input_id *id,
|
|
const struct input_absinfo *abs,
|
|
...);
|
|
|
|
#endif /* LITEST_H */
|