mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-07 14:18:31 +02:00
0.9.0
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlTLBSIACgkQ4jt+cLRn8L+4NgCgmgMNoZnmHfNJooSdrRQxzs2t 8c0An1jHFRAO+9/47m2l2tAzXV2RBaf6 =b46e -----END PGP SIGNATURE----- Merge tag '0.9.0' into tablet-support 0.9.0 Conflicts: test/litest.h
This commit is contained in:
commit
633d01d146
11 changed files with 492 additions and 26 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
AC_PREREQ([2.64])
|
AC_PREREQ([2.64])
|
||||||
|
|
||||||
m4_define([libinput_major_version], [0])
|
m4_define([libinput_major_version], [0])
|
||||||
m4_define([libinput_minor_version], [8])
|
m4_define([libinput_minor_version], [9])
|
||||||
m4_define([libinput_micro_version], [0])
|
m4_define([libinput_micro_version], [0])
|
||||||
m4_define([libinput_version],
|
m4_define([libinput_version],
|
||||||
[libinput_major_version.libinput_minor_version.libinput_micro_version])
|
[libinput_major_version.libinput_minor_version.libinput_micro_version])
|
||||||
|
|
@ -30,7 +30,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
||||||
# - If binary compatibility has been broken (eg removed or changed interfaces)
|
# - If binary compatibility has been broken (eg removed or changed interfaces)
|
||||||
# change to C+1:0:0
|
# change to C+1:0:0
|
||||||
# - If the interface is the same as the previous version, change to C:R+1:A
|
# - If the interface is the same as the previous version, change to C:R+1:A
|
||||||
LIBINPUT_LT_VERSION=7:0:0
|
LIBINPUT_LT_VERSION=8:0:1
|
||||||
AC_SUBST(LIBINPUT_LT_VERSION)
|
AC_SUBST(LIBINPUT_LT_VERSION)
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
|
||||||
|
|
@ -349,6 +349,41 @@ tp_process_fake_touch(struct tp_dispatch *tp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tp_process_trackpoint_button(struct tp_dispatch *tp,
|
||||||
|
const struct input_event *e,
|
||||||
|
uint64_t time)
|
||||||
|
{
|
||||||
|
struct evdev_dispatch *dispatch;
|
||||||
|
struct input_event event;
|
||||||
|
|
||||||
|
if (!tp->buttons.trackpoint ||
|
||||||
|
(tp->device->tags & EVDEV_TAG_TOUCHPAD_TRACKPOINT) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dispatch = tp->buttons.trackpoint->dispatch;
|
||||||
|
|
||||||
|
event = *e;
|
||||||
|
|
||||||
|
switch (event.code) {
|
||||||
|
case BTN_0:
|
||||||
|
event.code = BTN_LEFT;
|
||||||
|
break;
|
||||||
|
case BTN_1:
|
||||||
|
event.code = BTN_RIGHT;
|
||||||
|
break;
|
||||||
|
case BTN_2:
|
||||||
|
event.code = BTN_MIDDLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch->interface->process(dispatch,
|
||||||
|
tp->buttons.trackpoint,
|
||||||
|
&event, time);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tp_process_key(struct tp_dispatch *tp,
|
tp_process_key(struct tp_dispatch *tp,
|
||||||
const struct input_event *e,
|
const struct input_event *e,
|
||||||
|
|
@ -367,6 +402,11 @@ tp_process_key(struct tp_dispatch *tp,
|
||||||
case BTN_TOOL_QUADTAP:
|
case BTN_TOOL_QUADTAP:
|
||||||
tp_process_fake_touch(tp, e, time);
|
tp_process_fake_touch(tp, e, time);
|
||||||
break;
|
break;
|
||||||
|
case BTN_0:
|
||||||
|
case BTN_1:
|
||||||
|
case BTN_2:
|
||||||
|
tp_process_trackpoint_button(tp, e, time);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1063,6 +1103,16 @@ tp_tag_device(struct evdev_device *device,
|
||||||
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||||
} else if (bustype != BUS_BLUETOOTH)
|
} else if (bustype != BUS_BLUETOOTH)
|
||||||
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||||
|
|
||||||
|
if (udev_device_get_property_value(udev_device,
|
||||||
|
"TOUCHPAD_HAS_TRACKPOINT_BUTTONS"))
|
||||||
|
device->tags |= EVDEV_TAG_TOUCHPAD_TRACKPOINT;
|
||||||
|
|
||||||
|
/* Magic version tag: used by the litest device. Should never be set
|
||||||
|
* in real life but allows us to test for these features without
|
||||||
|
* requiring custom udev rules during make check */
|
||||||
|
if (libevdev_get_id_version(device->evdev) == 0xfffa)
|
||||||
|
device->tags |= EVDEV_TAG_TOUCHPAD_TRACKPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct evdev_dispatch_interface tp_interface = {
|
static struct evdev_dispatch_interface tp_interface = {
|
||||||
|
|
|
||||||
25
src/evdev.c
25
src/evdev.c
|
|
@ -1324,7 +1324,7 @@ evdev_configure_device(struct evdev_device *device)
|
||||||
struct libevdev *evdev = device->evdev;
|
struct libevdev *evdev = device->evdev;
|
||||||
const struct input_absinfo *absinfo;
|
const struct input_absinfo *absinfo;
|
||||||
int has_abs, has_rel, has_mt;
|
int has_abs, has_rel, has_mt;
|
||||||
int has_button, has_keyboard, has_touch;
|
int has_button, has_keyboard, has_touch, has_joystick_button;
|
||||||
struct mt_slot *slots;
|
struct mt_slot *slots;
|
||||||
int num_slots;
|
int num_slots;
|
||||||
int active_slot;
|
int active_slot;
|
||||||
|
|
@ -1336,17 +1336,24 @@ evdev_configure_device(struct evdev_device *device)
|
||||||
has_abs = 0;
|
has_abs = 0;
|
||||||
has_mt = 0;
|
has_mt = 0;
|
||||||
has_button = 0;
|
has_button = 0;
|
||||||
|
has_joystick_button = 0;
|
||||||
has_keyboard = 0;
|
has_keyboard = 0;
|
||||||
has_touch = 0;
|
has_touch = 0;
|
||||||
|
|
||||||
for (i = BTN_JOYSTICK; i < BTN_DIGI; i++) {
|
for (i = BTN_JOYSTICK; i <= BTN_PINKIE; i++)
|
||||||
if (libevdev_has_event_code(evdev, EV_KEY, i)) {
|
if (libevdev_has_event_code(evdev, EV_KEY, i))
|
||||||
log_info(libinput,
|
has_joystick_button = 1;
|
||||||
"input device '%s', %s is a joystick, ignoring\n",
|
|
||||||
device->devname, devnode);
|
for (i = BTN_GAMEPAD; i <= BTN_TR2; i++)
|
||||||
return -1;
|
if (libevdev_has_event_code(evdev, EV_KEY, i))
|
||||||
}
|
has_joystick_button = 1;
|
||||||
}
|
|
||||||
|
if (has_joystick_button) {
|
||||||
|
log_info(libinput,
|
||||||
|
"input device '%s', %s is a joystick, ignoring\n",
|
||||||
|
device->devname, devnode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (libevdev_has_event_type(evdev, EV_ABS)) {
|
if (libevdev_has_event_type(evdev, EV_ABS)) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ enum evdev_device_tags {
|
||||||
EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0),
|
EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0),
|
||||||
EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1),
|
EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1),
|
||||||
EVDEV_TAG_TRACKPOINT = (1 << 2),
|
EVDEV_TAG_TRACKPOINT = (1 << 2),
|
||||||
|
EVDEV_TAG_TOUCHPAD_TRACKPOINT = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mt_slot {
|
struct mt_slot {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ global:
|
||||||
libinput_event_pointer_get_absolute_x_transformed;
|
libinput_event_pointer_get_absolute_x_transformed;
|
||||||
libinput_event_pointer_get_absolute_y;
|
libinput_event_pointer_get_absolute_y;
|
||||||
libinput_event_pointer_get_absolute_y_transformed;
|
libinput_event_pointer_get_absolute_y_transformed;
|
||||||
libinput_event_pointer_get_axis;
|
|
||||||
libinput_event_pointer_get_axis_source;
|
libinput_event_pointer_get_axis_source;
|
||||||
libinput_event_pointer_get_axis_value;
|
libinput_event_pointer_get_axis_value;
|
||||||
libinput_event_pointer_get_axis_value_discrete;
|
libinput_event_pointer_get_axis_value_discrete;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ liblitest_la_SOURCES = \
|
||||||
litest-synaptics-hover.c \
|
litest-synaptics-hover.c \
|
||||||
litest-synaptics-st.c \
|
litest-synaptics-st.c \
|
||||||
litest-synaptics-t440.c \
|
litest-synaptics-t440.c \
|
||||||
|
litest-synaptics-x1-carbon-3rd.c \
|
||||||
litest-trackpoint.c \
|
litest-trackpoint.c \
|
||||||
litest-wacom-bamboo-tablet.c \
|
litest-wacom-bamboo-tablet.c \
|
||||||
litest-wacom-cintiq-tablet.c \
|
litest-wacom-cintiq-tablet.c \
|
||||||
|
|
|
||||||
111
test/litest-synaptics-x1-carbon-3rd.c
Normal file
111
test/litest-synaptics-x1-carbon-3rd.c
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2015 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
|
||||||
|
|
||||||
|
#include "litest.h"
|
||||||
|
#include "litest-int.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
litest_synaptics_carbon3rd_setup(void)
|
||||||
|
{
|
||||||
|
struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_set_current_device(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct input_event down[] = {
|
||||||
|
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_SYN, .code = SYN_REPORT, .value = 0 },
|
||||||
|
{ .type = -1, .code = -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct input_event move[] = {
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN },
|
||||||
|
{ .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,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct input_id input_id = {
|
||||||
|
.bustype = 0x11,
|
||||||
|
.vendor = 0x2,
|
||||||
|
.product = 0x7,
|
||||||
|
.version = 0xfffa, /* Magic value, used to detect this test device */
|
||||||
|
};
|
||||||
|
|
||||||
|
static int events[] = {
|
||||||
|
EV_KEY, BTN_LEFT,
|
||||||
|
EV_KEY, BTN_TOOL_FINGER,
|
||||||
|
EV_KEY, BTN_TOOL_QUINTTAP,
|
||||||
|
EV_KEY, BTN_TOUCH,
|
||||||
|
EV_KEY, BTN_TOOL_DOUBLETAP,
|
||||||
|
EV_KEY, BTN_TOOL_TRIPLETAP,
|
||||||
|
EV_KEY, BTN_TOOL_QUADTAP,
|
||||||
|
EV_KEY, BTN_0,
|
||||||
|
EV_KEY, BTN_1,
|
||||||
|
EV_KEY, BTN_2,
|
||||||
|
INPUT_PROP_MAX, INPUT_PROP_POINTER,
|
||||||
|
INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
|
||||||
|
-1, -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct input_absinfo absinfo[] = {
|
||||||
|
{ ABS_X, 1266, 5676, 0, 0, 45 },
|
||||||
|
{ ABS_Y, 1096, 4758, 0, 0, 68 },
|
||||||
|
{ ABS_PRESSURE, 0, 255, 0, 0, 0 },
|
||||||
|
{ ABS_TOOL_WIDTH, 0, 15, 0, 0, 0 },
|
||||||
|
{ ABS_MT_SLOT, 0, 1, 0, 0, 0 },
|
||||||
|
{ ABS_MT_POSITION_X, 1266, 5676, 0, 0, 45 },
|
||||||
|
{ ABS_MT_POSITION_Y, 1096, 4758, 0, 0, 68 },
|
||||||
|
{ ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 },
|
||||||
|
{ ABS_MT_PRESSURE, 0, 255, 0, 0, 0 },
|
||||||
|
{ .value = -1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct litest_test_device litest_synaptics_carbon3rd_device = {
|
||||||
|
.type = LITEST_SYNAPTICS_TRACKPOINT_BUTTONS,
|
||||||
|
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
|
||||||
|
.shortname = "synaptics carbon3rd",
|
||||||
|
.setup = litest_synaptics_carbon3rd_setup,
|
||||||
|
.interface = &interface,
|
||||||
|
|
||||||
|
.name = "SynPS/2 Synaptics TouchPad",
|
||||||
|
.id = &input_id,
|
||||||
|
.events = events,
|
||||||
|
.absinfo = absinfo,
|
||||||
|
};
|
||||||
|
|
@ -95,6 +95,7 @@ extern struct litest_test_device litest_qemu_tablet_device;
|
||||||
extern struct litest_test_device litest_xen_virtual_pointer_device;
|
extern struct litest_test_device litest_xen_virtual_pointer_device;
|
||||||
extern struct litest_test_device litest_vmware_virtmouse_device;
|
extern struct litest_test_device litest_vmware_virtmouse_device;
|
||||||
extern struct litest_test_device litest_synaptics_hover_device;
|
extern struct litest_test_device litest_synaptics_hover_device;
|
||||||
|
extern struct litest_test_device litest_synaptics_carbon3rd_device;
|
||||||
|
|
||||||
struct litest_test_device* devices[] = {
|
struct litest_test_device* devices[] = {
|
||||||
&litest_synaptics_clickpad_device,
|
&litest_synaptics_clickpad_device,
|
||||||
|
|
@ -115,6 +116,7 @@ struct litest_test_device* devices[] = {
|
||||||
&litest_xen_virtual_pointer_device,
|
&litest_xen_virtual_pointer_device,
|
||||||
&litest_vmware_virtmouse_device,
|
&litest_vmware_virtmouse_device,
|
||||||
&litest_synaptics_hover_device,
|
&litest_synaptics_hover_device,
|
||||||
|
&litest_synaptics_carbon3rd_device,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1157,6 +1159,7 @@ litest_create_uinput_device_from_description(const char *name,
|
||||||
libevdev_set_id_bustype(dev, id->bustype);
|
libevdev_set_id_bustype(dev, id->bustype);
|
||||||
libevdev_set_id_vendor(dev, id->vendor);
|
libevdev_set_id_vendor(dev, id->vendor);
|
||||||
libevdev_set_id_product(dev, id->product);
|
libevdev_set_id_product(dev, id->product);
|
||||||
|
libevdev_set_id_version(dev, id->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
abs = abs_info;
|
abs = abs_info;
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,11 @@ enum litest_device_type {
|
||||||
LITEST_XEN_VIRTUAL_POINTER = -14,
|
LITEST_XEN_VIRTUAL_POINTER = -14,
|
||||||
LITEST_VMWARE_VIRTMOUSE = -15,
|
LITEST_VMWARE_VIRTMOUSE = -15,
|
||||||
LITEST_SYNAPTICS_HOVER_SEMI_MT = -16,
|
LITEST_SYNAPTICS_HOVER_SEMI_MT = -16,
|
||||||
LITEST_WACOM_BAMBOO = -17,
|
LITEST_SYNAPTICS_TRACKPOINT_BUTTONS = -17,
|
||||||
LITEST_WACOM_CINTIQ = -18,
|
LITEST_WACOM_BAMBOO = -18,
|
||||||
LITEST_WACOM_INTUOS = -19,
|
LITEST_WACOM_CINTIQ = -19,
|
||||||
LITEST_WACOM_ISDV4 = -20,
|
LITEST_WACOM_INTUOS = -20,
|
||||||
|
LITEST_WACOM_ISDV4 = -21,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum litest_device_feature {
|
enum litest_device_feature {
|
||||||
|
|
|
||||||
291
test/touchpad.c
291
test/touchpad.c
|
|
@ -2959,6 +2959,290 @@ START_TEST(touchpad_hover_2fg_1fg_down)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
static void
|
||||||
|
assert_btnevent_from_device(struct litest_device *device,
|
||||||
|
unsigned int button,
|
||||||
|
enum libinput_button_state state)
|
||||||
|
{
|
||||||
|
struct libinput *li = device->libinput;
|
||||||
|
struct libinput_event *e;
|
||||||
|
struct libinput_event_pointer *pev;
|
||||||
|
|
||||||
|
libinput_dispatch(li);
|
||||||
|
e = libinput_get_event(li);
|
||||||
|
ck_assert_notnull(e);
|
||||||
|
ck_assert_int_eq(libinput_event_get_type(e),
|
||||||
|
LIBINPUT_EVENT_POINTER_BUTTON);
|
||||||
|
pev = libinput_event_get_pointer_event(e);
|
||||||
|
|
||||||
|
ck_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device);
|
||||||
|
ck_assert_int_eq(libinput_event_pointer_get_button(pev),
|
||||||
|
button);
|
||||||
|
ck_assert_int_eq(libinput_event_pointer_get_button_state(pev),
|
||||||
|
state);
|
||||||
|
libinput_event_destroy(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_buttons)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct litest_device *trackpoint;
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
|
||||||
|
const struct buttons {
|
||||||
|
unsigned int device_value;
|
||||||
|
unsigned int real_value;
|
||||||
|
} buttons[] = {
|
||||||
|
{ BTN_0, BTN_LEFT },
|
||||||
|
{ BTN_1, BTN_RIGHT },
|
||||||
|
{ BTN_2, BTN_MIDDLE },
|
||||||
|
};
|
||||||
|
const struct buttons *b;
|
||||||
|
|
||||||
|
trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
libinput_device_config_scroll_set_method(trackpoint->libinput_device,
|
||||||
|
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
ARRAY_FOR_EACH(buttons, b) {
|
||||||
|
litest_button_click(touchpad, b->device_value, true);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
b->real_value,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
|
||||||
|
litest_button_click(touchpad, b->device_value, false);
|
||||||
|
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
b->real_value,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
}
|
||||||
|
|
||||||
|
litest_delete_device(trackpoint);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_mb_scroll)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct litest_device *trackpoint;
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
|
||||||
|
trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
litest_button_click(touchpad, BTN_2, true); /* middle */
|
||||||
|
libinput_dispatch(li);
|
||||||
|
litest_timeout_buttonscroll();
|
||||||
|
libinput_dispatch(li);
|
||||||
|
litest_event(trackpoint, EV_REL, REL_Y, -2);
|
||||||
|
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_event(trackpoint, EV_REL, REL_Y, -2);
|
||||||
|
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_event(trackpoint, EV_REL, REL_Y, -2);
|
||||||
|
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_event(trackpoint, EV_REL, REL_Y, -2);
|
||||||
|
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_button_click(touchpad, BTN_2, false);
|
||||||
|
|
||||||
|
litest_assert_only_typed_events(li,
|
||||||
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
|
||||||
|
litest_delete_device(trackpoint);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_mb_click)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct litest_device *trackpoint;
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
enum libinput_config_status status;
|
||||||
|
|
||||||
|
trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
status = libinput_device_config_scroll_set_method(
|
||||||
|
trackpoint->libinput_device,
|
||||||
|
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
|
||||||
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
litest_button_click(touchpad, BTN_2, true); /* middle */
|
||||||
|
litest_button_click(touchpad, BTN_2, false);
|
||||||
|
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_MIDDLE,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_MIDDLE,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
litest_delete_device(trackpoint);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_buttons_softbuttons)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct litest_device *trackpoint;
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
|
||||||
|
trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(touchpad, 0, 95, 90);
|
||||||
|
litest_button_click(touchpad, BTN_LEFT, true);
|
||||||
|
litest_button_click(touchpad, BTN_1, true);
|
||||||
|
litest_button_click(touchpad, BTN_LEFT, false);
|
||||||
|
litest_touch_up(touchpad, 0);
|
||||||
|
litest_button_click(touchpad, BTN_1, false);
|
||||||
|
|
||||||
|
assert_btnevent_from_device(touchpad,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
assert_btnevent_from_device(touchpad,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
|
||||||
|
litest_touch_down(touchpad, 0, 95, 90);
|
||||||
|
litest_button_click(touchpad, BTN_LEFT, true);
|
||||||
|
litest_button_click(touchpad, BTN_1, true);
|
||||||
|
litest_button_click(touchpad, BTN_1, false);
|
||||||
|
litest_button_click(touchpad, BTN_LEFT, false);
|
||||||
|
litest_touch_up(touchpad, 0);
|
||||||
|
|
||||||
|
assert_btnevent_from_device(touchpad,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
assert_btnevent_from_device(touchpad,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
|
||||||
|
litest_delete_device(trackpoint);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_buttons_2fg_scroll)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct litest_device *trackpoint;
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
struct libinput_event *e;
|
||||||
|
struct libinput_event_pointer *pev;
|
||||||
|
double val;
|
||||||
|
|
||||||
|
trackpoint = litest_add_device(li,
|
||||||
|
LITEST_TRACKPOINT);
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(touchpad, 0, 40, 70);
|
||||||
|
litest_touch_down(touchpad, 1, 60, 70);
|
||||||
|
litest_touch_move_to(touchpad, 0, 40, 70, 40, 30, 10, 0);
|
||||||
|
litest_touch_move_to(touchpad, 1, 60, 70, 60, 30, 10, 0);
|
||||||
|
|
||||||
|
libinput_dispatch(li);
|
||||||
|
litest_wait_for_event(li);
|
||||||
|
|
||||||
|
/* Make sure we get scroll events but _not_ the scroll release */
|
||||||
|
while ((e = libinput_get_event(li))) {
|
||||||
|
ck_assert_int_eq(libinput_event_get_type(e),
|
||||||
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
pev = libinput_event_get_pointer_event(e);
|
||||||
|
val = libinput_event_pointer_get_axis_value(pev,
|
||||||
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||||
|
ck_assert(val != 0.0);
|
||||||
|
libinput_event_destroy(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
litest_button_click(touchpad, BTN_1, true);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
|
||||||
|
litest_touch_move_to(touchpad, 0, 40, 30, 40, 70, 10, 0);
|
||||||
|
litest_touch_move_to(touchpad, 1, 60, 30, 60, 70, 10, 0);
|
||||||
|
|
||||||
|
litest_assert_only_typed_events(li,
|
||||||
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
|
||||||
|
while ((e = libinput_get_event(li))) {
|
||||||
|
ck_assert_int_eq(libinput_event_get_type(e),
|
||||||
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
pev = libinput_event_get_pointer_event(e);
|
||||||
|
val = libinput_event_pointer_get_axis_value(pev,
|
||||||
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||||
|
ck_assert(val != 0.0);
|
||||||
|
libinput_event_destroy(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
litest_button_click(touchpad, BTN_1, false);
|
||||||
|
assert_btnevent_from_device(trackpoint,
|
||||||
|
BTN_RIGHT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
|
||||||
|
/* the movement lags behind the touch movement, so the first couple
|
||||||
|
events can be downwards even though we started scrolling up. do a
|
||||||
|
short scroll up, drain those events, then we can use
|
||||||
|
litest_assert_scroll() which tests for the trailing 0/0 scroll
|
||||||
|
for us.
|
||||||
|
*/
|
||||||
|
litest_touch_move_to(touchpad, 0, 40, 70, 40, 60, 10, 0);
|
||||||
|
litest_touch_move_to(touchpad, 1, 60, 70, 60, 60, 10, 0);
|
||||||
|
litest_assert_only_typed_events(li,
|
||||||
|
LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
litest_touch_move_to(touchpad, 0, 40, 60, 40, 30, 10, 0);
|
||||||
|
litest_touch_move_to(touchpad, 1, 60, 60, 60, 30, 10, 0);
|
||||||
|
|
||||||
|
litest_touch_up(touchpad, 0);
|
||||||
|
litest_touch_up(touchpad, 1);
|
||||||
|
|
||||||
|
libinput_dispatch(li);
|
||||||
|
|
||||||
|
litest_assert_scroll(li,
|
||||||
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
litest_delete_device(trackpoint);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_trackpoint_no_trackpoint)
|
||||||
|
{
|
||||||
|
struct litest_device *touchpad = litest_current_device();
|
||||||
|
struct libinput *li = touchpad->libinput;
|
||||||
|
|
||||||
|
litest_drain_events(li);
|
||||||
|
litest_button_click(touchpad, BTN_0, true); /* left */
|
||||||
|
litest_button_click(touchpad, BTN_0, false);
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
|
||||||
|
litest_button_click(touchpad, BTN_1, true); /* right */
|
||||||
|
litest_button_click(touchpad, BTN_1, false);
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
|
||||||
|
litest_button_click(touchpad, BTN_2, true); /* middle */
|
||||||
|
litest_button_click(touchpad, BTN_2, false);
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
|
|
@ -3067,5 +3351,12 @@ int main(int argc, char **argv) {
|
||||||
litest_add_for_device("touchpad:hover", touchpad_hover_2fg_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT);
|
litest_add_for_device("touchpad:hover", touchpad_hover_2fg_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT);
|
||||||
litest_add_for_device("touchpad:hover", touchpad_hover_2fg_1fg_down, LITEST_SYNAPTICS_HOVER_SEMI_MT);
|
litest_add_for_device("touchpad:hover", touchpad_hover_2fg_1fg_down, LITEST_SYNAPTICS_HOVER_SEMI_MT);
|
||||||
|
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_click, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_softbuttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_no_trackpoint, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
|
||||||
return litest_run(argc, argv);
|
return litest_run(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -358,19 +358,21 @@ static void
|
||||||
handle_event_axis(struct libinput_event *ev, struct window *w)
|
handle_event_axis(struct libinput_event *ev, struct window *w)
|
||||||
{
|
{
|
||||||
struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
|
struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
|
||||||
double v, h;
|
double value;
|
||||||
|
|
||||||
v = libinput_event_pointer_get_axis_value(p,
|
if (libinput_event_pointer_has_axis(p,
|
||||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) {
|
||||||
h = libinput_event_pointer_get_axis_value(p,
|
value = libinput_event_pointer_get_axis_value(p,
|
||||||
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL);
|
||||||
|
w->vy += (int)value;
|
||||||
if (v != 0.0) {
|
|
||||||
w->vy += (int)v;
|
|
||||||
w->vy = clip(w->vy, 0, w->height);
|
w->vy = clip(w->vy, 0, w->height);
|
||||||
}
|
}
|
||||||
if (h != 0.0) {
|
|
||||||
w->hx += (int)v;
|
if (libinput_event_pointer_has_axis(p,
|
||||||
|
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) {
|
||||||
|
value = libinput_event_pointer_get_axis_value(p,
|
||||||
|
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL);
|
||||||
|
w->hx += (int)value;
|
||||||
w->hx = clip(w->hx, 0, w->width);
|
w->hx = clip(w->hx, 0, w->width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue