...
 
Commits (13)
......@@ -2,7 +2,7 @@ AC_PREREQ([2.64])
m4_define([libinput_major_version], [1])
m4_define([libinput_minor_version], [2])
m4_define([libinput_micro_version], [2])
m4_define([libinput_micro_version], [4])
m4_define([libinput_version],
[libinput_major_version.libinput_minor_version.libinput_micro_version])
......@@ -31,7 +31,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
# b) If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
LIBINPUT_LT_VERSION=17:4:7
LIBINPUT_LT_VERSION=17:6:7
AC_SUBST(LIBINPUT_LT_VERSION)
AM_SILENT_RULES([yes])
......
......@@ -70,7 +70,7 @@ digraph top_button_routing
touchpad -> libinput_tp [color="red4"]
events_tp [label="other touchpad events"];
events_topbutton [label="top sofware button events"];
events_topbutton [label="top software button events"];
libinput_tp -> events_tp [arrowhead="none"]
libinput_ts -> events_topbutton [color="red4"]
......
......@@ -14,7 +14,8 @@ Most tablets provide two types of devices. The pysical tablet often provides
a number of buttons and a touch ring or strip. Interaction on the drawing
surface of the tablet requires a tool, usually in the shape of a stylus.
The libinput interface exposed by devices with the @ref
LIBINPUT_DEVICE_CAP_TABLET_TOOL applies only to events generated by tools.
LIBINPUT_DEVICE_CAP_TABLET_TOOL capability applies only to events generated
by tools.
Touch events on the tablet integrated into a screen itself are exposed
through the @ref LIBINPUT_DEVICE_CAP_TOUCH capability. Touch events on a
......
......@@ -963,6 +963,7 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
uint32_t current, old, button, is_top;
enum libinput_button_state state;
enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 };
bool want_left_handed = true;
current = tp->buttons.state;
old = tp->buttons.old_state;
......@@ -1008,14 +1009,22 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
return 0;
}
if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT)))
button = evdev_to_left_handed(tp->device, BTN_MIDDLE);
else if (area & RIGHT)
button = evdev_to_left_handed(tp->device, BTN_RIGHT);
else if (area & LEFT)
button = evdev_to_left_handed(tp->device, BTN_LEFT);
else /* main or no area (for clickfinger) is always BTN_LEFT */
if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT))) {
button = BTN_MIDDLE;
} else if (area & RIGHT) {
button = BTN_RIGHT;
} else if (area & LEFT) {
button = BTN_LEFT;
} else { /* main or no area (for clickfinger) is always BTN_LEFT */
button = BTN_LEFT;
want_left_handed = false;
}
if (is_top)
want_left_handed = false;
if (want_left_handed)
button = evdev_to_left_handed(tp->device, button);
tp->buttons.active = button;
tp->buttons.active_is_topbutton = is_top;
......
......@@ -500,7 +500,8 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
switch (tp->gesture.finger_count) {
case 1:
tp_gesture_post_pointer_motion(tp, time);
if (tp->queued & TOUCHPAD_EVENT_MOTION)
tp_gesture_post_pointer_motion(tp, time);
break;
case 2:
case 3:
......
......@@ -904,10 +904,7 @@ tp_need_motion_history_reset(struct tp_dispatch *tp, uint64_t time)
if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) {
if (tp->queued & TOUCHPAD_EVENT_MOTION) {
if (tp->quirks.nonmotion_event_count > 10) {
struct tp_touch *t;
tp_for_each_touch(tp, t)
t->dirty = false;
tp->queued &= ~TOUCHPAD_EVENT_MOTION;
rc = true;
}
tp->quirks.nonmotion_event_count = 0;
......@@ -1155,7 +1152,7 @@ tp_suspend(struct tp_dispatch *tp, struct evdev_device *device)
if (tp->buttons.has_topbuttons) {
evdev_notify_suspended_device(device);
/* Enlarge topbutton area while suspended */
tp_init_top_softbuttons(tp, device, 1.5);
tp_init_top_softbuttons(tp, device, 3.0);
} else {
evdev_device_suspend(device);
}
......
......@@ -112,6 +112,36 @@ tablet_device_has_axis(struct tablet_dispatch *tablet,
return has_axis;
}
static inline bool
tablet_filter_axis_fuzz(const struct tablet_dispatch *tablet,
const struct evdev_device *device,
const struct input_event *e,
enum libinput_tablet_tool_axis axis)
{
int delta, fuzz;
int current, previous;
previous = tablet->prev_value[axis];
current = e->value;
delta = previous - current;
fuzz = libevdev_get_abs_fuzz(device->evdev, e->code);
/* ABS_DISTANCE doesn't have have fuzz set and causes continuous
* updates for the cursor/lens tools. Add a minimum fuzz of 2, same
* as the xf86-input-wacom driver
*/
switch (e->code) {
case ABS_DISTANCE:
fuzz = max(2, fuzz);
break;
default:
break;
}
return abs(delta) <= fuzz;
}
static void
tablet_process_absolute(struct tablet_dispatch *tablet,
struct evdev_device *device,
......@@ -137,6 +167,11 @@ tablet_process_absolute(struct tablet_dispatch *tablet,
break;
}
tablet->prev_value[axis] = tablet->current_value[axis];
if (tablet_filter_axis_fuzz(tablet, device, e, axis))
break;
tablet->current_value[axis] = e->value;
set_bit(tablet->changed_axes, axis);
tablet_set_status(tablet, TABLET_AXES_UPDATED);
break;
......@@ -201,7 +236,7 @@ normalize_dist_slider(const struct input_absinfo *absinfo)
double range = absinfo->maximum - absinfo->minimum;
double value = (absinfo->value - absinfo->minimum) / range;
return value;
return value * 2 - 1;
}
static inline double
......@@ -516,7 +551,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
axes.tilt.x = 0;
axes.tilt.y = 0;
/* tilt is already coverted to left-handed, so mouse
/* tilt is already converted to left-handed, so mouse
* rotation is converted to left-handed automatically */
} else {
axes.rotation = tablet_handle_artpen_rotation(tablet, device);
......
......@@ -55,6 +55,8 @@ struct tablet_dispatch {
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
struct tablet_axes axes;
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
int current_value[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
int prev_value[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
/* Only used for tablets that don't report serial numbers */
struct list tool_list;
......
......@@ -1306,7 +1306,7 @@ fallback_dispatch_create(struct libinput_device *device)
evdev_init_sendevents(evdev_device, dispatch);
/* BTN_MIDDLE is set on mice even when it's not present. So
* we can only use the absense of BTN_MIDDLE to mean something, i.e.
* we can only use the absence of BTN_MIDDLE to mean something, i.e.
* we enable it by default on anything that only has L&R.
* If we have L&R and no middle, we don't expose it as config
* option */
......
......@@ -690,7 +690,7 @@ touchpad_lenovo_x230_accel_profile(struct motion_filter *filter,
* trial-and-error. No other meaning should be interpreted.
* The calculation is a compressed form of
* pointer_accel_profile_linear(), look at the git history of that
* function for an explaination of what the min/max/etc. does.
* function for an explanation of what the min/max/etc. does.
*/
speed_in *= X230_MAGIC_SLOWDOWN / X230_TP_MAGIC_LOW_RES_FACTOR;
......
......@@ -3105,7 +3105,7 @@ libinput_device_config_accel_get_default_profile(struct libinput_device *device)
if (!libinput_device_config_accel_is_available(device))
return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE;
return device->config.accel->get_profile(device);
return device->config.accel->get_default_profile(device);
}
LIBINPUT_EXPORT enum libinput_config_status
......
......@@ -541,6 +541,8 @@ struct libinput_event_touch *
libinput_event_get_touch_event(struct libinput_event *event);
/**
* @ingroup event
*
* Return the gesture event that is this input event. If the event type does
* not match the gesture event types, this function returns NULL.
*
......@@ -973,7 +975,7 @@ enum libinput_pointer_axis_source
libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event);
/**
* @ingroup pointer
* @ingroup event_pointer
*
* Return the axis value in discrete steps for a given axis event. How a
* value translates into a discrete step depends on the source.
......@@ -1338,7 +1340,7 @@ libinput_event_gesture_get_scale(struct libinput_event_gesture *event);
*
* The angle delta is defined as the change in angle of the line formed by
* the 2 fingers of a pinch gesture. Clockwise rotation is represented
* by a postive delta, counter-clockwise by a negative delta. If e.g. the
* by a positive delta, counter-clockwise by a negative delta. If e.g. the
* fingers are on the 12 and 6 location of a clock face plate and they move
* to the 1 resp. 7 location in a single event then the angle delta is
* 30 degrees.
......@@ -2306,7 +2308,7 @@ libinput_get_event(struct libinput *libinput);
*
* @param libinput A previously initialized libinput context
* @return The event type of the next available event or @ref
* LIBINPUT_EVENT_NONE if no event is availble.
* LIBINPUT_EVENT_NONE if no event is available.
*/
enum libinput_event_type
libinput_next_event_type(struct libinput *libinput);
......@@ -3588,7 +3590,7 @@ enum libinput_config_accel_profile {
*
* @param device The device to configure
*
* @return A bitmask of all configurable modes availble on this device.
* @return A bitmask of all configurable modes available on this device.
*/
uint32_t
libinput_device_config_accel_get_profiles(struct libinput_device *device);
......@@ -4232,7 +4234,7 @@ enum libinput_config_dwt_state {
* @ingroup config
*
* Check if this device supports configurable disable-while-typing feature.
* This feature is usally available on built-in touchpads and disables the
* This feature is usually available on built-in touchpads and disables the
* touchpad while typing. See @ref disable-while-typing for details.
*
* @param device The device to configure
......
......@@ -2057,7 +2057,7 @@ litest_create_uinput(const char *name,
const struct input_absinfo default_abs = {
.value = 0,
.minimum = 0,
.maximum = 0xffff,
.maximum = 100,
.fuzz = 0,
.flat = 0,
.resolution = 100
......
......@@ -2532,7 +2532,7 @@ START_TEST(airbrush_tool)
}
END_TEST
START_TEST(airbrush_wheel)
START_TEST(airbrush_slider)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
......@@ -2541,6 +2541,7 @@ START_TEST(airbrush_wheel)
const struct input_absinfo *abs;
double val;
double scale;
double expected;
int v;
if (!libevdev_has_event_code(dev->evdev,
......@@ -2574,7 +2575,10 @@ START_TEST(airbrush_wheel)
ck_assert(libinput_event_tablet_tool_slider_has_changed(tev));
val = libinput_event_tablet_tool_get_slider_position(tev);
ck_assert_int_eq(val, (v - abs->minimum)/scale);
expected = ((v - abs->minimum)/scale) * 2 - 1;
ck_assert_double_eq(val, expected);
ck_assert_double_ge(val, -1.0);
ck_assert_double_le(val, 1.0);
libinput_event_destroy(event);
litest_assert_empty_queue(li);
}
......@@ -3655,7 +3659,7 @@ litest_setup_tests(void)
litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET, LITEST_ANY);
litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET, LITEST_WHEEL);
litest_add("tablet:airbrush", airbrush_tool, LITEST_TABLET, LITEST_ANY);
litest_add("tablet:airbrush", airbrush_wheel, LITEST_TABLET, LITEST_ANY);
litest_add("tablet:airbrush", airbrush_slider, LITEST_TABLET, LITEST_ANY);
litest_add("tablet:artpen", artpen_tool, LITEST_TABLET, LITEST_ANY);
litest_add("tablet:artpen", artpen_rotation, LITEST_TABLET, LITEST_ANY);
......
......@@ -150,6 +150,135 @@ START_TEST(trackpoint_scroll_source)
}
END_TEST
START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint)
{
struct litest_device *touchpad = litest_current_device();
struct litest_device *trackpoint;
struct libinput *li = touchpad->libinput;
enum libinput_config_status status;
struct libinput_event *event;
struct libinput_device *device;
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad right-handed, trackpoint left-handed */
status = libinput_device_config_left_handed_set(
trackpoint->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5);
libinput_dispatch(li);
litest_button_click(touchpad, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event,
BTN_RIGHT,
LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_button_click(touchpad, BTN_LEFT, false);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event,
BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_delete_device(trackpoint);
}
END_TEST
START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad)
{
struct litest_device *touchpad = litest_current_device();
struct litest_device *trackpoint;
struct libinput *li = touchpad->libinput;
enum libinput_config_status status;
struct libinput_event *event;
struct libinput_device *device;
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad left-handed, trackpoint right-handed */
status = libinput_device_config_left_handed_set(
touchpad->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5);
libinput_dispatch(li);
litest_button_click(touchpad, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_button_click(touchpad, BTN_LEFT, false);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_delete_device(trackpoint);
}
END_TEST
START_TEST(trackpoint_topsoftbuttons_left_handed_both)
{
struct litest_device *touchpad = litest_current_device();
struct litest_device *trackpoint;
struct libinput *li = touchpad->libinput;
enum libinput_config_status status;
struct libinput_event *event;
struct libinput_device *device;
trackpoint = litest_add_device(li, LITEST_TRACKPOINT);
litest_drain_events(li);
/* touchpad left-handed, trackpoint left-handed */
status = libinput_device_config_left_handed_set(
touchpad->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
status = libinput_device_config_left_handed_set(
trackpoint->libinput_device, 1);
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
litest_touch_down(touchpad, 0, 5, 5);
libinput_dispatch(li);
litest_button_click(touchpad, BTN_LEFT, true);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event,
BTN_RIGHT,
LIBINPUT_BUTTON_STATE_PRESSED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_button_click(touchpad, BTN_LEFT, false);
libinput_dispatch(li);
event = libinput_get_event(li);
litest_is_button_event(event,
BTN_RIGHT,
LIBINPUT_BUTTON_STATE_RELEASED);
device = libinput_event_get_device(event);
ck_assert(device == trackpoint->libinput_device);
libinput_event_destroy(event);
litest_delete_device(trackpoint);
}
END_TEST
void
litest_setup_tests(void)
{
......@@ -157,4 +286,7 @@ litest_setup_tests(void)
litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:scroll", trackpoint_scroll, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:scroll", trackpoint_scroll_source, LITEST_POINTINGSTICK, LITEST_ANY);
litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_trackpoint, LITEST_TOPBUTTONPAD, LITEST_ANY);
litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_touchpad, LITEST_TOPBUTTONPAD, LITEST_ANY);
litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY);
}
......@@ -62,22 +62,22 @@ libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*
# The various chromebooks, info from modinfo chromeos_laptop, touchpad names
# extrapolated from the chromiumos touchad-tests repo
# https://chromium.googlesource.com/chromiumos/platform/touchpad-tests
libinput:name:Cypress APA Trackpad (cyapa):dmi:*pnFalco:pvr*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pnFalco:pvr*
libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*Mario*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Butterfly*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Peppy*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Butterfly*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Peppy*
libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*ZGB*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Parrot*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Leon*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Falco*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Wolf*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*GOOGLE*:pn*Link*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Parrot*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Leon*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Falco*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Wolf*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*svn*GOOGLE*:pn*Link*
libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*Alex*
libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*SAMSUNG*:pn*Lumpy*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*svn*SAMSUNG*:pn*Lumpy*
libinput:name:Atmel maXTouch Touchpad:dmi:*svn*GOOGLE*:pn*Samus*
LIBINPUT_MODEL_CHROMEBOOK=1
libinput:name:Cypress APA Trackpad (cyapa):dmi:*
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*
LIBINPUT_MODEL_CYAPA=1
##########################################
......