...
 
Commits (38)
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
libinput_jobs:
default_settings: &default_settings
working_directory: ~/libinput
# Define a couple of standardized build targets
# that we call from every build container
build_and_test_default: &build_and_test_default
name: Build
command: |
rm -rf build
meson build ${MESON_PARAMS}
mesonconf build
ninja -v -C build ${NINJA_ARGS}
environment:
MESON_PARAMS: --prefix=/opt/libinput
build_and_test: &build_and_test
run:
<<: *build_and_test_default
build_no_libwacom: &build_no_libwacom
run:
<<: *build_and_test_default
name: Build - No libwacom
environment:
MESON_PARAMS: -Dlibwacom=false
build_no_debug_gui: &build_no_debug_gui
run:
<<: *build_and_test_default
name: Build - No debug-gui
environment:
MESON_PARAMS: -Ddebug-gui=false
build_no_tests: &build_no_tests
run:
<<: *build_and_test_default
name: Build - No tests
environment:
MESON_PARAMS: -Dtests=false
build_no_docs: &build_no_docs
run:
<<: *build_and_test_default
name: Build - No docs
environment:
MESON_PARAMS: -Ddocumentation=false
ninja_scan_build: &ninja_scan_build
run:
<<: *build_and_test_default
name: Ninja scan-build
environment:
NINJA_ARGS: scan-build
install: &install
run:
name: Installing
command: ninja -v -C build install
export_logs: &export_logs
store_artifacts:
path: ~/libinput/build/meson-logs
# Ubuntu's meson is too old, these instructions are
# meson-specific
meson_from_git: &meson_from_git
run:
name: Install meson from git
environment:
MESON_VERSION: 0.41.0
command: |
git clone https://github.com/mesonbuild/meson
pushd meson
git checkout -f ${MESON_VERSION}
python3 ./setup.py install --prefix=/usr --install-layout=deb --install-lib=/usr/share/meson --install-scripts=/usr/share/meson
popd
rm -rf meson
fedora_install: &fedora_install
run:
name: Install prerequisites
command: |
dnf install -y git gcc gcc-c++ meson check-devel libudev-devel libevdev-devel doxygen graphviz valgrind binutils libwacom-devel cairo-devel gtk3-devel glib2-devel mtdev-devel
fedora_build_all: &fedora_build_all
<<: *default_settings
steps:
- *fedora_install
- checkout
- *build_and_test
- *install
- *export_logs
- *build_no_libwacom
- *build_no_debug_gui
- *build_no_tests
- *build_no_docs
ubuntu_install: &ubuntu_install
run:
name: Install prerequisites
command: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository universe
apt-get update
apt-get install -y git gcc g++ meson check libudev-dev libevdev-dev doxygen graphviz valgrind binutils libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev
ubuntu_build_all: &ubuntu_build_all
<<: *default_settings
steps:
- *ubuntu_install
- *meson_from_git # meson version not recent enough
- checkout
- *build_and_test
- *install
- *export_logs
- *build_no_libwacom
- *build_no_debug_gui
- *build_no_tests
- *build_no_docs
scan_build_run: &scan_build_run
<<: *default_settings
steps:
- *fedora_install
- run:
name: Install clang and find
command: dnf install -y clang-analyzer findutils
- checkout
- *ninja_scan_build
- *export_logs
- run:
name: Check scan-build results
command: test ! -d ~/libinput/build/meson-logs/scanbuild || test $(find ~/libinput/build/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 || (echo "Check scan-build results" && false)
version: 2
jobs:
fedora_latest:
<<: *fedora_build_all
docker:
- image: fedora:latest
ubuntu_17_04:
<<: *ubuntu_build_all
docker:
- image: ubuntu:zesty
scan_build:
<<: *scan_build_run
docker:
- image: fedora:latest
workflows:
version: 2
compile:
jobs:
- fedora_latest
- scan_build
- ubuntu_17_04
......@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
m4_define([libinput_major_version], [1])
m4_define([libinput_minor_version], [8])
m4_define([libinput_micro_version], [0])
m4_define([libinput_micro_version], [4])
m4_define([libinput_version],
[libinput_major_version.libinput_minor_version.libinput_micro_version])
......
......@@ -26,15 +26,29 @@ $> sudo ninja -C builddir/ install
$> sudo udevadm hwdb --update
@endcode
The ```prefix``` option or other options can be changed later with the
```mesonconf``` command.
Additional options may also be specified. For example:
@code
$> meson --prefix=/usr -Ddocumentation=false -Dlibwacom=false builddir/
@endcode
The ```prefix``` or other options can be changed later with the
```mesonconf``` command. For example:
@code
$> mesonconf builddir/ -Dprefix=/some/other/prefix
$> mesonconf builddir/ -Dprefix=/some/other/prefix -Ddocumentation=true
$> ninja -C builddir
$> sudo ninja -C builddir/ install
@endcode
Running ``mesonconf builddir/`` with no other arguments lists all
configurable options meson provides.
To rebuild from scratch, simply remove the build directory and run meson
again:
@code
$> rm -r builddir/
$> meson --prefix=....
@endcode
@subsection building_autotools Building with automake
libinput currently also provides the autotools build system, but this will
......
This diff is collapsed.
This diff is collapsed.
project('libinput', 'c', 'cpp',
version : '1.8.0',
version : '1.8.4',
license : 'MIT/Expat',
default_options : [ 'c_std=gnu99', 'warning_level=2' ],
meson_version : '>= 0.40.0')
......@@ -47,6 +47,10 @@ dep_libevdev = dependency('libevdev', version : '>= 0.4')
dep_lm = cc.find_library('m', required : false)
dep_rt = cc.find_library('rt', required : false)
# Include directories
includes_include = include_directories('include')
includes_src = include_directories('src')
############ libwacom configuration ############
have_libwacom = get_option('libwacom')
......@@ -62,6 +66,8 @@ if have_libwacom
name : 'libwacom_get_paired_device check',
dependencies : dep_libwacom)
config_h.set10('HAVE_LIBWACOM_GET_PAIRED_DEVICE', result)
else
dep_libwacom = declare_dependency()
endif
############ udev bits ############
......@@ -76,13 +82,13 @@ udev_hwdb_dir = join_paths(udev_dir, 'hwdb.d')
executable('libinput-device-group',
'udev/libinput-device-group.c',
dependencies : [dep_udev, dep_libwacom],
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install : true,
install_dir : udev_dir)
executable('libinput-model-quirks',
'udev/libinput-model-quirks.c',
dependencies : dep_udev,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install : true,
install_dir : udev_dir)
......@@ -129,7 +135,8 @@ src_libinput_util = [
]
libinput_util = static_library('libinput-util',
src_libinput_util,
dependencies : dep_udev)
dependencies : dep_udev,
include_directories : includes_include)
dep_libinput_util = declare_dependency(link_with : libinput_util)
############ libfilter.a ############
......@@ -200,7 +207,7 @@ mapfile = join_paths(meson.source_root(), 'src', 'libinput.sym')
version_flag = '-Wl,--version-script,@0@'.format(mapfile)
lib_libinput = shared_library('input',
src_libinput,
include_directories : include_directories('.'),
include_directories : [include_directories('.'), includes_include],
dependencies : deps_libinput,
version : libinput_so_version,
link_args : version_flag,
......@@ -352,7 +359,7 @@ tools_shared_sources = [ 'tools/shared.c',
deps_tools_shared = [ dep_libinput, dep_libevdev ]
lib_tools_shared = static_library('tools_shared',
tools_shared_sources,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
dependencies : deps_tools_shared)
dep_tools_shared = declare_dependency(link_with : lib_tools_shared,
dependencies : deps_tools_shared)
......@@ -365,7 +372,7 @@ libinput_debug_events_sources = [ 'tools/libinput-debug-events.c' ]
executable('libinput-debug-events',
libinput_debug_events_sources,
dependencies : deps_tools,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true
)
......@@ -380,7 +387,7 @@ libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ]
executable('libinput-list-devices',
libinput_list_devices_sources,
dependencies : deps_tools,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true,
)
......@@ -395,7 +402,7 @@ libinput_measure_sources = [ 'tools/libinput-measure.c' ]
executable('libinput-measure',
libinput_measure_sources,
dependencies : deps_tools,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true,
)
......@@ -410,7 +417,7 @@ libinput_measure_touchpad_tap_sources = [ 'tools/libinput-measure-touchpad-tap.c
executable('libinput-measure-touchpad-tap',
libinput_measure_touchpad_tap_sources,
dependencies : deps_tools,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true,
)
......@@ -422,7 +429,7 @@ configure_file(input : 'tools/libinput-measure-touchpad-tap.man',
)
if get_option('debug-gui')
dep_gtk = dependency('gtk+-3.0')
dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
dep_cairo = dependency('cairo')
dep_glib = dependency('glib-2.0')
......@@ -435,7 +442,7 @@ if get_option('debug-gui')
executable('libinput-debug-gui',
debug_gui_sources,
dependencies : deps_debug_gui,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true
)
......@@ -452,7 +459,7 @@ libinput_sources = [ 'tools/libinput-tool.c' ]
executable('libinput',
libinput_sources,
dependencies : deps_tools,
include_directories : include_directories ('src'),
include_directories : [includes_src, includes_include],
install : true
)
configure_file(input : 'tools/libinput.man',
......@@ -468,7 +475,7 @@ ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
executable('ptraccel-debug',
ptraccel_debug_sources,
dependencies : [ dep_libfilter, dep_libinput ],
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install : false
)
......@@ -505,6 +512,7 @@ if get_option('tests')
'test/litest-device-cyborg-rat-5.c',
'test/litest-device-elantech-touchpad.c',
'test/litest-device-generic-singletouch.c',
'test/litest-device-gpio-keys.c',
'test/litest-device-huion-pentablet.c',
'test/litest-device-keyboard.c',
'test/litest-device-keyboard-all-codes.c',
......@@ -548,6 +556,7 @@ if get_option('tests')
'test/litest-device-wacom-intuos5-pen.c',
'test/litest-device-wacom-isdv4-e6-pen.c',
'test/litest-device-wacom-isdv4-e6-finger.c',
'test/litest-device-wacom-mobilestudio-pro-pad.c',
'test/litest-device-waltop-tablet.c',
'test/litest-device-wheel-only.c',
'test/litest-device-xen-virtual-pointer.c',
......@@ -582,7 +591,7 @@ if get_option('tests')
join_paths(meson.build_root(), '80-libinput-device-groups.rules'))
lib_litest = static_library('litest',
lib_litest_sources,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
dependencies : deps_litest)
dep_litest = declare_dependency(link_with : lib_litest,
dependencies : deps_litest)
......@@ -602,7 +611,7 @@ if get_option('tests')
deps_litest_selftest = [dep_litest]
test_litest_selftest = executable('test-litest-selftest',
test_litest_selftest_sources,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
dependencies : deps_litest_selftest,
c_args : defs_litest_selftest,
install : false)
......@@ -635,7 +644,7 @@ if get_option('tests')
def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a)
libinput_test_runner = executable('libinput-test-suite-runner',
libinput_test_runner_sources,
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
dependencies : dep_litest,
c_args : [ def_LT_VERSION ],
install : false)
......@@ -646,25 +655,25 @@ if get_option('tests')
# build-test only
executable('test-build-pedantic',
'test/build-pedantic.c',
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
c_args : ['-std=c99', '-pedantic', '-Werror'],
install : false)
# build-test only
executable('test-build-std-gnuc90',
'test/build-pedantic.c',
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
c_args : ['-std=gnu90', '-Werror'],
install : false)
# test for linking with the minimal linker flags
executable('test-build-linker',
'test/build-pedantic.c',
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
dependencies : [ dep_libinput, dep_libinput_util ],
install : false)
# test including from C++
executable('test-build-cxx',
'test/build-cxx.cc',
include_directories : include_directories('src'),
include_directories : [includes_src, includes_include],
install : false)
valgrind_env = environment()
......
option('udev-dir',
type: 'string',
default: '',
value: '',
description: 'udev base directory [default=$prefix/lib/udev]')
option('libwacom',
type: 'boolean',
default: true,
value: true,
description: 'Use libwacom for tablet identification (default=true)')
option('debug-gui',
type: 'boolean',
default: true,
value: true,
description: 'Enable the "debug-gui" feature in the libinput tool [default=true]')
option('tests',
type: 'boolean',
default: true,
value: true,
description: 'Build the tests [default=true]')
option('documentation',
type: 'boolean',
default: true,
value: true,
description: 'Build the documentation [default=true]')
......@@ -33,7 +33,8 @@ libinput_la_SOURCES = \
udev-seat.h \
timer.c \
timer.h \
../include/linux/input.h
../include/linux/input.h \
../include/linux/input-event-codes.h
libinput_la_LIBADD = $(MTDEV_LIBS) \
$(LIBUDEV_LIBS) \
......
......@@ -78,13 +78,14 @@ lid_switch_keyboard_event(uint64_t time,
return;
if (dispatch->reliability == RELIABILITY_WRITE_OPEN) {
__attribute__((unused)) int rc;
int fd = libevdev_get_fd(dispatch->device->evdev);
struct input_event ev[2] = {
{{ 0, 0 }, EV_SW, SW_LID, 0 },
{{ 0, 0 }, EV_SYN, SYN_REPORT, 0 },
};
(void)write(fd, ev, sizeof(ev));
rc = write(fd, ev, sizeof(ev));
/* In case write() fails, we sync the lid state manually
* regardless. */
}
......@@ -104,6 +105,8 @@ lid_switch_toggle_keyboard_listener(struct lid_switch_dispatch *dispatch,
if (!dispatch->keyboard.keyboard)
return;
libinput_device_remove_event_listener(&dispatch->keyboard.listener);
if (is_closed) {
libinput_device_add_event_listener(
&dispatch->keyboard.keyboard->base,
......@@ -111,10 +114,7 @@ lid_switch_toggle_keyboard_listener(struct lid_switch_dispatch *dispatch,
lid_switch_keyboard_event,
dispatch);
} else {
libinput_device_remove_event_listener(
&dispatch->keyboard.listener);
libinput_device_init_event_listener(
&dispatch->keyboard.listener);
libinput_device_init_event_listener(&dispatch->keyboard.listener);
}
}
......@@ -130,11 +130,12 @@ lid_switch_process_switch(struct lid_switch_dispatch *dispatch,
case SW_LID:
is_closed = !!e->value;
if (dispatch->lid_is_closed == is_closed)
return;
lid_switch_toggle_keyboard_listener(dispatch,
is_closed);
if (dispatch->lid_is_closed == is_closed)
return;
dispatch->lid_is_closed = is_closed;
lid_switch_notify_toggle(dispatch, device, time);
......@@ -298,6 +299,7 @@ struct evdev_dispatch *
evdev_lid_switch_dispatch_create(struct evdev_device *lid_device)
{
struct lid_switch_dispatch *dispatch = zalloc(sizeof *dispatch);
int type;
if (dispatch == NULL)
return NULL;
......@@ -311,5 +313,12 @@ evdev_lid_switch_dispatch_create(struct evdev_device *lid_device)
dispatch->lid_is_closed = false;
for (type = EV_KEY; type < EV_CNT; type++) {
if (type == EV_SW)
continue;
libevdev_disable_event_type(lid_device->evdev, type);
}
return &dispatch->base;
}
......@@ -497,7 +497,7 @@ evdev_middlebutton_handle_event(struct evdev_device *device,
uint64_t time,
enum evdev_middlebutton_event event)
{
int rc;
int rc = 0;
enum evdev_middlebutton_state current;
current = device->middlebutton.state;
......@@ -545,6 +545,11 @@ evdev_middlebutton_handle_event(struct evdev_device *device,
time,
event);
break;
default:
evdev_log_bug_libinput(device,
"Invalid middle button state %d\n",
current);
break;
}
evdev_log_debug(device,
......
......@@ -334,6 +334,10 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL;
/* more fingers than slots, don't bother with pinch, always
* assume swipe */
} else if (tp->gesture.finger_count > tp->num_slots) {
return GESTURE_STATE_SWIPE;
}
/* for 3+ finger gestures, check if one finger is > 20mm
......@@ -356,7 +360,8 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time)
/* If both touches are moving in the same direction assume
* scroll or swipe */
if (tp_gesture_same_directions(dir1, dir2)) {
if (tp->gesture.finger_count > tp->num_slots ||
tp_gesture_same_directions(dir1, dir2)) {
if (tp->gesture.finger_count == 2) {
tp_gesture_set_scroll_buildup(tp);
return GESTURE_STATE_SCROLL;
......
......@@ -1426,6 +1426,31 @@ tp_resume(struct tp_dispatch *tp, struct evdev_device *device)
}
}
#define NO_EXCLUDED_DEVICE NULL
static void
tp_resume_conditional(struct tp_dispatch *tp,
struct evdev_device *device,
struct evdev_device *excluded_device)
{
if (tp->sendevents.current_mode == LIBINPUT_CONFIG_SEND_EVENTS_DISABLED)
return;
if (tp->sendevents.current_mode ==
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) {
struct libinput_device *dev;
list_for_each(dev, &device->base.seat->devices_list, link) {
struct evdev_device *d = evdev_device(dev);
if (d != excluded_device &&
(d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
return;
}
}
}
tp_resume(tp, device);
}
static void
tp_trackpoint_timeout(uint64_t now, void *data)
{
......@@ -1667,7 +1692,7 @@ tp_lid_switch_event(uint64_t time, struct libinput_event *event, void *data)
swev = libinput_event_get_switch_event(event);
switch (libinput_event_switch_get_switch_state(swev)) {
case LIBINPUT_SWITCH_STATE_OFF:
tp_resume(tp, tp->device);
tp_resume_conditional(tp, tp->device, NO_EXCLUDED_DEVICE);
evdev_log_debug(tp->device, "lid: resume touchpad\n");
break;
case LIBINPUT_SWITCH_STATE_ON:
......@@ -1722,7 +1747,6 @@ tp_interface_device_removed(struct evdev_device *device,
struct evdev_device *removed_device)
{
struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch;
struct libinput_device *dev;
if (removed_device == tp->buttons.trackpoint) {
/* Clear any pending releases for the trackpoint */
......@@ -1740,6 +1764,7 @@ tp_interface_device_removed(struct evdev_device *device,
libinput_device_remove_event_listener(
&tp->dwt.keyboard_listener);
tp->dwt.keyboard = NULL;
tp->dwt.keyboard_active = false;
}
if (removed_device == tp->lid_switch.lid_switch) {
......@@ -1748,19 +1773,9 @@ tp_interface_device_removed(struct evdev_device *device,
tp->lid_switch.lid_switch = NULL;
}
if (tp->sendevents.current_mode !=
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE)
return;
list_for_each(dev, &device->base.seat->devices_list, link) {
struct evdev_device *d = evdev_device(dev);
if (d != removed_device &&
(d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) {
return;
}
}
tp_resume(tp, device);
/* removed_device is still in the device list at this point, so we
* need to exclude it from the tp_resume_conditional */
tp_resume_conditional(tp, device, removed_device);
}
static inline void
......@@ -2278,12 +2293,12 @@ tp_init_palmdetect_edge(struct tp_dispatch *tp,
if (width < 70.0)
return;
/* palm edges are 5% of the width on each side */
mm.x = width * 0.05;
/* palm edges are 8% of the width on each side */
mm.x = min(8, width * 0.08);
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.left_edge = edges.x;
mm.x = width * 0.95;
mm.x = width - min(8, width * 0.08);
edges = evdev_device_mm_to_units(device, &mm);
tp->palm.right_edge = edges.x;
}
......
......@@ -790,7 +790,7 @@ get_key_type(uint16_t code)
return EVDEV_KEY_TYPE_KEY;
if (code >= BTN_DPAD_UP && code <= BTN_DPAD_RIGHT)
return EVDEV_KEY_TYPE_BUTTON;
if (code >= KEY_ALS_TOGGLE && code <= KEY_KBDINPUTASSIST_CANCEL)
if (code >= KEY_ALS_TOGGLE && code <= KEY_ONSCREEN_KEYBOARD)
return EVDEV_KEY_TYPE_KEY;
if (code >= BTN_TRIGGER_HAPPY && code <= BTN_TRIGGER_HAPPY40)
return EVDEV_KEY_TYPE_BUTTON;
......@@ -836,16 +836,16 @@ fallback_process_key(struct fallback_dispatch *dispatch,
type = get_key_type(e->code);
/* Ignore key release events from the kernel for keys that libinput
* never got a pressed event for. */
if (e->value == 0) {
switch (type) {
case EVDEV_KEY_TYPE_NONE:
break;
case EVDEV_KEY_TYPE_KEY:
case EVDEV_KEY_TYPE_BUTTON:
if (!hw_is_key_down(dispatch, e->code))
return;
}
* never got a pressed event for or key presses for keys that we
* think are still down */
switch (type) {
case EVDEV_KEY_TYPE_NONE:
break;
case EVDEV_KEY_TYPE_KEY:
case EVDEV_KEY_TYPE_BUTTON:
if ((e->value && hw_is_key_down(dispatch, e->code)) ||
(e->value == 0 && !hw_is_key_down(dispatch, e->code)))
return;
}
hw_set_key_down(dispatch, e->code, e->value);
......@@ -2565,6 +2565,20 @@ evdev_extract_abs_axes(struct evdev_device *device)
device->is_mt = 1;
}
static void
evdev_disable_accelerometer_axes(struct evdev_device *device)
{
struct libevdev *evdev = device->evdev;
libevdev_disable_event_code(evdev, EV_ABS, ABS_X);
libevdev_disable_event_code(evdev, EV_ABS, ABS_Y);
libevdev_disable_event_code(evdev, EV_ABS, ABS_Z);
libevdev_disable_event_code(evdev, EV_ABS, REL_X);
libevdev_disable_event_code(evdev, EV_ABS, REL_Y);
libevdev_disable_event_code(evdev, EV_ABS, REL_Z);
}
static struct evdev_dispatch *
evdev_configure_device(struct evdev_device *device)
{
......@@ -2596,10 +2610,14 @@ evdev_configure_device(struct evdev_device *device)
udev_tags & EVDEV_UDEV_TAG_TRACKBALL ? " Trackball" : "",
udev_tags & EVDEV_UDEV_TAG_SWITCH ? " Switch" : "");
if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) {
/* Ignore pure accelerometers, but accept devices that are
* accelerometers with other axes */
if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_ACCELEROMETER)) {
evdev_log_info(device,
"device is an accelerometer, ignoring\n");
return NULL;
} else if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) {
evdev_disable_accelerometer_axes(device);
}
/* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so
......
......@@ -52,6 +52,8 @@ list_insert(struct list *list, struct list *elm)
{
assert((list->next != NULL && list->prev != NULL) ||
!"list->next|prev is NULL, possibly missing list_init()");
assert(((elm->next == NULL && elm->prev == NULL) || list_empty(elm)) ||
!"elm->next|prev is not NULL, list node used twice?");
elm->prev = list;
elm->next = list->next;
......
......@@ -116,7 +116,7 @@ static void
libinput_timer_handler(void *data)
{
struct libinput *libinput = data;
struct libinput_timer *timer, *tmp;
struct libinput_timer *timer;
uint64_t now;
uint64_t discard;
int r;
......@@ -132,12 +132,26 @@ libinput_timer_handler(void *data)
if (now == 0)
return;
list_for_each_safe(timer, tmp, &libinput->timer.list, link) {
restart:
list_for_each(timer, &libinput->timer.list, link) {
if (timer->expire == 0)
continue;
if (timer->expire <= now) {
/* Clear the timer before calling timer_func,
as timer_func may re-arm it */
libinput_timer_cancel(timer);
timer->timer_func(now, timer->timer_func_data);
/*
* Restart the loop. We can't use
* list_for_each_safe() here because that only
* allows removing one (our) timer per timer_func.
* But the timer func may trigger another unrelated
* timer to be cancelled and removed, causing a
* segfault.
*/
goto restart;
}
}
}
......
......@@ -29,6 +29,7 @@ liblitest_la_SOURCES = \
litest-device-cyborg-rat-5.c \
litest-device-elantech-touchpad.c \
litest-device-generic-singletouch.c \
litest-device-gpio-keys.c \
litest-device-huion-pentablet.c \
litest-device-keyboard.c \
litest-device-keyboard-all-codes.c \
......@@ -72,6 +73,7 @@ liblitest_la_SOURCES = \
litest-device-wacom-intuos5-pen.c \
litest-device-wacom-isdv4-e6-pen.c \
litest-device-wacom-isdv4-e6-finger.c \
litest-device-wacom-mobilestudio-pro-pad.c \
litest-device-waltop-tablet.c \
litest-device-wheel-only.c \
litest-device-xen-virtual-pointer.c \
......
/*
* Copyright © 2017 Red Hat, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include "litest.h"
#include "litest-int.h"
static void
litest_gpio_keys_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_GPIO_KEYS);
litest_set_current_device(d);
}
static struct input_id input_id = {
.bustype = 0x19,
.vendor = 0x1,
.product = 0x1,
};
static int events[] = {
EV_SW, SW_LID,
EV_SW, SW_TABLET_MODE,
EV_KEY, KEY_POWER,
EV_KEY, KEY_VOLUMEUP,
EV_KEY, KEY_VOLUMEDOWN,
EV_KEY, KEY_POWER,
-1, -1,
};
static const char udev_rule[] =
"ACTION==\"remove\", GOTO=\"switch_end\"\n"
"KERNEL!=\"event*\", GOTO=\"switch_end\"\n"
"\n"
"ATTRS{name}==\"litest gpio-keys*\",\\\n"
" ENV{ID_INPUT_SWITCH}=\"1\",\\\n"
" ENV{LIBINPUT_ATTR_gpio_keys_RELIABILITY}=\"reliable\"\n"
"\n"
"LABEL=\"switch_end\"";
struct litest_test_device litest_gpio_keys_device = {
.type = LITEST_GPIO_KEYS,
.features = LITEST_SWITCH,
.shortname = "gpio keys",
.setup = litest_gpio_keys_setup,
.interface = NULL,
.name = "gpio-keys",
.id = &input_id,
.events = events,
.absinfo = NULL,
.udev_rule = udev_rule,
};
......@@ -25,12 +25,13 @@
#include "litest.h"
#include "litest-int.h"
#include "libinput-util.h"
static void all_codes_create(struct litest_device *d);
static void litest_keyboard_all_codes_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_KEYBOARD);
struct litest_device *d = litest_create_device(LITEST_KEYBOARD_ALL_CODES);
litest_set_current_device(d);
}
......@@ -61,6 +62,11 @@ all_codes_create(struct litest_device *d)
int code, idx;
for (idx = 0, code = 0; code < KEY_MAX; code++) {
const char *name = libevdev_event_code_get_name(EV_KEY, code);
if (name && strneq(name, "BTN_", 4))
continue;
events[idx++] = EV_KEY;
events[idx++] = code;
}
......
/*
* Copyright © 2017 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include "litest.h"
#include "litest-int.h"
static void litest_wacom_mobilestudio_pad_setup(void)
{
struct litest_device *d = litest_create_device(LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD);
litest_set_current_device(d);
}
static struct input_event down[] = {
{ .type = -1, .code = -1 },
};
static struct input_event move[] = {
{ .type = -1, .code = -1 },
};
static struct input_event ring_start[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_ABS, .code = ABS_MISC, .value = 15 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct input_event ring_change[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct input_event ring_end[] = {
{ .type = EV_ABS, .code = ABS_WHEEL, .value = 0 },
{ .type = EV_ABS, .code = ABS_MISC, .value = 0 },
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
{ .type = -1, .code = -1 },
} ;
static struct litest_device_interface interface = {
.touch_down_events = down,
.touch_move_events = move,
.pad_ring_start_events = ring_start,
.pad_ring_change_events = ring_change,
.pad_ring_end_events = ring_end,
};
static struct input_absinfo absinfo[] = {
{ ABS_X, -2048, 2048, 0, 0, 0 },
{ ABS_Y, -2048, 2048, 0, 0, 0 },
{ ABS_Z, -2048, 2048, 0, 0, 0 },
{ ABS_WHEEL, 0, 35, 0, 0, 0 },
{ ABS_MISC, 0, 0, 0, 0, 0 },
{ .value = -1 },
};
static struct input_id input_id = {
.bustype = 0x3,
.vendor = 0x56a,
.product = 0x34e,
.version = 0x110,
};
static int events[] = {
EV_KEY, BTN_0,
EV_KEY, BTN_1,
EV_KEY, BTN_2,
EV_KEY, BTN_3,
EV_KEY, BTN_4,
EV_KEY, BTN_5,
EV_KEY, BTN_6,
EV_KEY, BTN_7,
EV_KEY, BTN_8,
EV_KEY, BTN_SOUTH,
EV_KEY, BTN_EAST,
EV_KEY, BTN_C,
EV_KEY, BTN_STYLUS,
INPUT_PROP_MAX, INPUT_PROP_ACCELEROMETER,
-1, -1,
};
static const char udev_rule[] =
"ACTION==\"remove\", GOTO=\"pad_end\"\n"
"KERNEL!=\"event*\", GOTO=\"pad_end\"\n"
"\n"
"ATTRS{name}==\"litest Wacom MobileStudio Pro 16 Pad*\",\\\n"
" ENV{ID_INPUT_TABLET}=\"1\",\\\n"
" ENV{ID_INPUT_TABLET_PAD}=\"1\"\\\n"
"\n"
"LABEL=\"pad_end\"";
struct litest_test_device litest_wacom_mobilestudio_13hdt_pad_device = {
.type = LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD,
.features = LITEST_TABLET_PAD | LITEST_RING,
.shortname = "wacom-mobilestudio-pro16-pad",
.setup = litest_wacom_mobilestudio_pad_setup,
.interface = &interface,
.name = "Wacom MobileStudio Pro 16 Pad",
.id = &input_id,
.events = events,
.absinfo = absinfo,
.udev_rule = udev_rule,
};
......@@ -173,8 +173,6 @@ litest_backtrace(void)
char procname[256];
Dl_info dlinfo;
/* filename and i are unused ifdef LITEST_SHUTUP */
const char *filename __attribute__((unused));
int i __attribute__((unused)) = 0;
pip.unwind_info = NULL;
ret = unw_getcontext(&context);
......@@ -199,6 +197,8 @@ litest_backtrace(void)
char file[PATH_MAX];
int line;
bool have_lineno = false;
const char *filename = "?";
int i = 0;
ret = unw_get_proc_info(&cursor, &pip);
if (ret) {
......@@ -226,8 +226,6 @@ litest_backtrace(void)
(pip.start_ip + off),
file,
&line);
} else {
filename = "?";
}
if (have_lineno) {
......@@ -416,6 +414,8 @@ extern struct litest_test_device litest_mouse_wheel_tilt_device;
extern struct litest_test_device litest_lid_switch_device;
extern struct litest_test_device litest_lid_switch_surface3_device;
extern struct litest_test_device litest_appletouch_device;
extern struct litest_test_device litest_gpio_keys_device;
extern struct litest_test_device litest_wacom_mobilestudio_13hdt_pad_device;
struct litest_test_device* devices[] = {
&litest_synaptics_clickpad_device,
......@@ -481,6 +481,8 @@ struct litest_test_device* devices[] = {
&litest_lid_switch_device,
&litest_lid_switch_surface3_device,
&litest_appletouch_device,
&litest_gpio_keys_device,
&litest_wacom_mobilestudio_13hdt_pad_device,
NULL,
};
......@@ -1474,8 +1476,9 @@ litest_delete_device(struct litest_device *d)
litest_assert_int_eq(d->skip_ev_syn, 0);
libinput_device_unref(d->libinput_device);
libinput_path_remove_device(d->libinput_device);
libinput_device_unref(d->libinput_device);
if (d->owns_context)
libinput_unref(d->libinput);
close(libevdev_get_fd(d->evdev));
......
......@@ -232,6 +232,8 @@ enum litest_device_type {
LITEST_LID_SWITCH,
LITEST_LID_SWITCH_SURFACE3,
LITEST_APPLETOUCH,
LITEST_GPIO_KEYS,
LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD,
};
enum litest_device_feature {
......
......@@ -754,110 +754,6 @@ START_TEST(gestures_pinch_3fg)
}
END_TEST
START_TEST(gestures_pinch_3fg_btntool)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
struct libinput_event_gesture *gevent;
double dx, dy;
int cardinal = _i; /* ranged test */
double dir_x, dir_y;
int i;
double scale, oldscale;
double angle;
int cardinals[8][2] = {
{ 0, 30 },
{ 30, 30 },
{ 30, 0 },
{ 30, -30 },
{ 0, -30 },
{ -30, -30 },
{ -30, 0 },
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) > 2 ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];
litest_drain_events(li);
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
for (i = 0; i < 8; i++) {
litest_push_event_frame(dev);
if (dir_x > 0.0)
dir_x -= 2;
else if (dir_x < 0.0)
dir_x += 2;
if (dir_y > 0.0)
dir_y -= 2;
else if (dir_y < 0.0)
dir_y += 2;
litest_touch_move(dev,
0,
50 + dir_x,
50 + dir_y);
litest_touch_move(dev,
1,
50 - dir_x,
50 - dir_y);
litest_pop_event_frame(dev);
libinput_dispatch(li);
}
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
3);
dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0);
ck_assert(dy == 0.0);
ck_assert(scale == 1.0);
libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) {
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
3);
oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.0);
libinput_event_destroy(event);
libinput_dispatch(li);
}
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
libinput_dispatch(li);
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END,
3);
ck_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event);
}
END_TEST
START_TEST(gestures_pinch_4fg)
{
struct litest_device *dev = litest_current_device();
......@@ -969,111 +865,6 @@ START_TEST(gestures_pinch_4fg)
}
END_TEST
START_TEST(gestures_pinch_4fg_btntool)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct libinput_event *event;
struct libinput_event_gesture *gevent;
double dx, dy;
int cardinal = _i; /* ranged test */
double dir_x, dir_y;
int i;
double scale, oldscale;
double angle;
int cardinals[8][2] = {
{ 0, 30 },
{ 30, 30 },
{ 30, 0 },
{ 30, -30 },
{ 0, -30 },
{ -30, -30 },
{ -30, 0 },
{ -30, 30 },
};
if (libevdev_get_num_slots(dev->evdev) > 2 ||
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) ||
!libinput_device_has_capability(dev->libinput_device,
LIBINPUT_DEVICE_CAP_GESTURE))
return;
dir_x = cardinals[cardinal][0];
dir_y = cardinals[cardinal][1];
litest_drain_events(li);
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
for (i = 0; i < 8; i++) {
litest_push_event_frame(dev);
if (dir_x > 0.0)
dir_x -= 3;
else if (dir_x < 0.0)
dir_x += 3;
if (dir_y > 0.0)
dir_y -= 3;
else if (dir_y < 0.0)
dir_y += 3;
litest_touch_move(dev,
0,
50 + dir_x,
50 + dir_y);
litest_touch_move(dev,
1,
50 - dir_x,
50 - dir_y);
litest_pop_event_frame(dev);
libinput_dispatch(li);
}
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
4);
dx = libinput_event_gesture_get_dx(gevent);
dy = libinput_event_gesture_get_dy(gevent);
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(dx == 0.0);
ck_assert(dy == 0.0);
ck_assert(scale == 1.0);
libinput_event_destroy(event);
while ((event = libinput_get_event(li)) != NULL) {
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
4);
oldscale = scale;
scale = libinput_event_gesture_get_scale(gevent);
ck_assert(scale < oldscale);
angle = libinput_event_gesture_get_angle_delta(gevent);
ck_assert_double_le(fabs(angle), 1.5);
libinput_event_destroy(event);
libinput_dispatch(li);
}
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
libinput_dispatch(li);
event = libinput_get_event(li);
gevent = litest_is_gesture_event(event,
LIBINPUT_EVENT_GESTURE_PINCH_END,
4);
ck_assert(!libinput_event_gesture_get_cancelled(gevent));
libinput_event_destroy(event);
}
END_TEST
START_TEST(gestures_spread)
{
struct litest_device *dev = litest_current_device();
......@@ -1282,9 +1073,7 @@ litest_setup_tests_gestures(void)
litest_add_ranged("gestures:swipe", gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
litest_add_ranged("gestures:pinch", gestures_pinch_vertical_positon, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &fingers);
......
......@@ -342,35 +342,111 @@ START_TEST(lid_disable_touchpad_already_open)
}
END_TEST
START_TEST(lid_open_on_key)
START_TEST(switch_dont_resume_disabled_touchpad)
{
struct litest_device *sw = litest_current_device();
struct litest_device *keyboard;
struct litest_device *touchpad;
struct libinput *li = sw->libinput;
struct libinput_event *event;
keyboard = litest_add_device(li, LITEST_KEYBOARD);
touchpad = lid_init_paired_touchpad(li);
litest_disable_tap(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
litest_drain_events(li);
/* switch is on - no events */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
/* switch is off but but tp is still disabled */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
litest_delete_device(touchpad);
}
END_TEST
START_TEST(switch_dont_resume_disabled_touchpad_external_mouse)
{
struct litest_device *sw = litest_current_device();
struct litest_device *touchpad, *mouse;
struct libinput *li = sw->libinput;
touchpad = lid_init_paired_touchpad(li);
mouse = litest_add_device(li, LITEST_MOUSE);
litest_disable_tap(touchpad->libinput_device);
libinput_device_config_send_events_set_mode(touchpad->libinput_device,
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE);
litest_drain_events(li);
litest_event(keyboard, EV_KEY, KEY_A, 1);
litest_event(keyboard, EV_SYN, SYN_REPORT, 0);
litest_event(keyboard, EV_KEY, KEY_A, 0);
litest_event(keyboard, EV_SYN, SYN_REPORT, 0);
libinput_dispatch(li);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
event = libinput_get_event(li);
litest_is_switch_event(event,
LIBINPUT_SWITCH_LID,
LIBINPUT_SWITCH_STATE_OFF);
/* switch is on - no events */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_ON);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);
/* switch is off but but tp is still disabled */
litest_lid_action(sw, LIBINPUT_SWITCH_STATE_OFF);
litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE);
litest_touch_down(touchpad, 0, 50, 50);
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1);
litest_touch_up(touchpad, 0);
litest_assert_empty_queue(li);