Compare commits

...

8 commits
main ... 1.2.3

Author SHA1 Message Date
Peter Hutterer
b3d41a8233 configure.ac: libinput 1.2.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-12 06:56:29 +10:00
Peter Hutterer
ccc761d059 tablet: fix the airbrush slider range
Supposed to be [-1, 1] but we only generated [0, 1]

Reported-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Carlos Garnacho <carlosg@gnome.org>
(cherry picked from commit 25a9f394fc)
2016-04-12 06:49:36 +10:00
Jonas Ådahl
364e0bb131 libinput: Actually return the default accel profile
We just returned the current profile instead of the default one. Fix
that.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ee6501d12f)
2016-04-12 06:49:35 +10:00
Peter Hutterer
1845e549f4 doc: minor fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f44de7cc4f)
2016-04-12 06:49:35 +10:00
Eric Engestrom
ca3cc403de Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7a81ba9cc2)
2016-04-06 14:23:24 +10:00
Peter Hutterer
2253cf69cb touchpad: only post motion events if we have motion
Because our delta calculation factors in previous events on touchpads (to
reduce jitter) we may get a nonzero delta if we have an event that doesn't
actually change x or y.

Drop the t->dirty workaround introduced in a608d9d, an event that virtually
disappears can mess up our state machines.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit bc17185f42)
2016-04-06 12:51:38 +10:00
Peter Hutterer
915cd9d999 touchpad: fix left-handed top software trackpoint buttons
The previous code would swap the top software buttons depending on the
touchpad's left-handed setting, not the trackpoint setting. Changing both
devices to left-handed resulted in a double-swap, i.e. the trackpoint was
always right-handed.

https://bugs.freedesktop.org/show_bug.cgi?id=94733

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 1ecf6d7a60)
2016-04-06 12:50:56 +10:00
Peter Hutterer
2de6df3bb7 Fix two doxygen groupings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 455498e9d7)
2016-04-06 12:50:53 +10:00
13 changed files with 175 additions and 29 deletions

View file

@ -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], [3])
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:5:7
AC_SUBST(LIBINPUT_LT_VERSION)
AM_SILENT_RULES([yes])

View file

@ -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"]

View file

@ -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

View file

@ -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;

View file

@ -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:

View file

@ -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;

View file

@ -201,7 +201,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 +516,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);

View file

@ -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 */

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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);
}