[PATCH v4 libinput 3/3] touchpad: add wobbling detection

2018-02-28 Thread Peter Hutterer
From: Konstantin Kharlamov 

The details are explained in comment in the code. That aside, I shall
mention the check is so light, that it shouldn't influence CPU
performance even a bit, and can blindly be kept always enabled.

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

v2: rename the function, change comment style, and add calculation of
x_diff (the one that was used is an absolute coordinate).

FWIW, the algorithm don't care that now added "prev_x" is unintialized,
because that happening means the time threshold won't get satisfied
either. It's not like I can't default-init it — it's just that asking
oneself a question "what default value should it have" results in "none".

v3:
* style fixes (empty line after a block, declaration at top)
* s/x_diff/dx
* s/x_motion_in_threashold/x_motion_history
* compare with r_l_r instead of &
* store whole point instead of just x
* move x_motion_history and prev_coords into tp_touch
* move everything around tp_detect_wobbling() call into the function,
use goto for that purpose.
* per request: add a comparison for when previous coordinates don't
actually have the prev. coordinates yet.
* increased timeout from 20ms to 40ms just in case — it's still out of
human ability anyway, and in fact can be increased even further
* ignore Y-only changes, again just in case — it could happen that Y and
X events would be sent separately, and break the heuristic.

v4:
* some more style fixes

Signed-off-by: Konstantin Kharlamov 
Signed-off-by: Peter Hutterer 
---
Changes to v3:
- more style fixes
- ajudsted for patch 1/3

 src/evdev-mt-touchpad.c | 58 -
 src/evdev-mt-touchpad.h |  2 ++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 0c3e6a2b..cec4ba34 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -135,6 +135,61 @@ tp_motion_history_push(struct tp_touch *t)
t->history.index = motion_index;
 }
 
+/* Idea: if we got a tuple of *very* quick moves like {Left, Right,
+ * Left}, or {Right, Left, Right}, it means touchpad jitters since no
+ * human can move like that within thresholds.
+ *
+ * We encode left moves as zeroes, and right as ones. We also drop
+ * the array to all zeroes when contraints are not satisfied. Then we
+ * search for the pattern {1,0,1}. It can't match {Left, Right, Left},
+ * but it does match {Left, Right, Left, Right}, so it's okay.
+ *
+ * This only looks at x changes, y changes are ignored.
+ */
+static inline void
+tp_detect_wobbling(struct tp_dispatch *tp,
+  struct tp_touch *t,
+  uint64_t time)
+{
+   int dx, dy;
+   uint64_t dtime;
+
+   if (!(tp->queued & TOUCHPAD_EVENT_MOTION) || tp->hysteresis.enabled)
+   return;
+
+   if (t->last_point.x == 0) { /* first invocation */
+   dx = 0;
+   dy = 0;
+   } else {
+   dx = t->last_point.x - t->point.x;
+   dy = t->last_point.y - t->point.y;
+   }
+
+   dtime = time - tp->hysteresis.last_motion_time;
+
+   tp->hysteresis.last_motion_time = time;
+   t->last_point = t->point;
+
+   if (dx == 0 && dy != 0) /* ignore y-only changes */
+   return;
+
+   if (dtime > ms2us(40)) {
+   t->hysteresis.x_motion_history = 0;
+   return;
+   }
+
+   t->hysteresis.x_motion_history <<= 1;
+   if (dx > 0) { /* right move */
+   static const char r_l_r = 0x5; /* {Right, Left, Right} */
+
+   t->hysteresis.x_motion_history |= 0x1;
+   if (t->hysteresis.x_motion_history == r_l_r) {
+   tp->hysteresis.enabled = true;
+   evdev_log_debug(tp->device, "hysteresis enabled\n");
+   }
+   }
+}
+
 static inline void
 tp_motion_hysteresis(struct tp_dispatch *tp,
 struct tp_touch *t)
@@ -265,6 +320,7 @@ tp_new_touch(struct tp_dispatch *tp, struct tp_touch *t, 
uint64_t time)
t->time = time;
t->speed.last_speed = 0;
t->speed.exceeded_count = 0;
+   t->hysteresis.x_motion_history = 0;
tp->queued |= TOUCHPAD_EVENT_MOTION;
 }
 
@@ -1443,7 +1499,7 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
 
tp_thumb_detect(tp, t, time);
tp_palm_detect(tp, t, time);
-
+   tp_detect_wobbling(tp, t, time);
tp_motion_hysteresis(tp, t);
tp_motion_history_push(t);
 
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 3ce893d2..1fd8f1e3 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -149,6 +149,7 @@ struct tp_touch {
bool has_ended; /* TRACKING_ID == -1 */
bool dirty;
struct device_coords point;
+   struct device_coords last_point;

[PATCH v4 libinput 1/3] touchpad: move the hysteresis into its own substruct

2018-02-28 Thread Peter Hutterer
Prep work for the wobbling detection patch

Signed-off-by: Peter Hutterer 
---
New in this series

 src/evdev-mt-touchpad.c | 10 +-
 src/evdev-mt-touchpad.h |  4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 2a6cdcef..75344661 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -162,16 +162,16 @@ tp_motion_hysteresis(struct tp_dispatch *tp,
return;
 
if (t->history.count == 0) {
-   t->hysteresis_center = t->point;
+   t->hysteresis.center = t->point;
} else {
x = evdev_hysteresis(x,
-t->hysteresis_center.x,
+t->hysteresis.center.x,
 tp->hysteresis.margin.x);
y = evdev_hysteresis(y,
-t->hysteresis_center.y,
+t->hysteresis.center.y,
 tp->hysteresis.margin.y);
-   t->hysteresis_center.x = x;
-   t->hysteresis_center.y = y;
+   t->hysteresis.center.x = x;
+   t->hysteresis.center.y = y;
t->point.x = x;
t->point.y = y;
}
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index afd0983d..3ce893d2 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -175,7 +175,9 @@ struct tp_touch {
unsigned int count;
} history;
 
-   struct device_coords hysteresis_center;
+   struct {
+   struct device_coords center;
+   } hysteresis;
 
/* A pinned touchpoint is the one that pressed the physical button
 * on a clickpad. After the release, it won't move until the center
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v4 libinput 2/3] touchpad: remove the code for disabling hysteresis

2018-02-28 Thread Peter Hutterer
From: Konstantin Kharlamov 

Signed-off-by: Konstantin Kharlamov 
Signed-off-by: Peter Hutterer 
---
Changes to v3:
- rebased for patch 1/3

 src/evdev-mt-touchpad.c | 21 +
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 75344661..0c3e6a2b 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -135,22 +135,6 @@ tp_motion_history_push(struct tp_touch *t)
t->history.index = motion_index;
 }
 
-static inline void
-tp_maybe_disable_hysteresis(struct tp_dispatch *tp, uint64_t time)
-{
-   /* If the finger is down for 80ms without seeing motion events,
-  the firmware filters and we don't need a software hysteresis */
-   if (tp->nfingers_down >= 1 &&
-   time - tp->hysteresis.last_motion_time > ms2us(80)) {
-   tp->hysteresis.enabled = false;
-   evdev_log_debug(tp->device, "hysteresis disabled\n");
-   return;
-   }
-
-   if (tp->queued & TOUCHPAD_EVENT_MOTION)
-   tp->hysteresis.last_motion_time = time;
-}
-
 static inline void
 tp_motion_hysteresis(struct tp_dispatch *tp,
 struct tp_touch *t)
@@ -1583,9 +1567,6 @@ static void
 tp_handle_state(struct tp_dispatch *tp,
uint64_t time)
 {
-   if (tp->hysteresis.enabled)
-   tp_maybe_disable_hysteresis(tp, time);
-
tp_process_state(tp, time);
tp_post_events(tp, time);
tp_post_process_state(tp, time);
@@ -3016,7 +2997,7 @@ tp_init_hysteresis(struct tp_dispatch *tp)
res_y = tp->device->abs.absinfo_y->resolution;
tp->hysteresis.margin.x = res_x/2;
tp->hysteresis.margin.y = res_y/2;
-   tp->hysteresis.enabled = true;
+   tp->hysteresis.enabled = false;
 }
 
 static void
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 1/5] test: don't run the MT pressure test on devices without MT pressure

2018-02-28 Thread Peter Hutterer
This test worked because on devices that don't use pressure the touches were
reset when BTN_TOUCH when to 0, triggering the 'ignore fake fingers when no
real fingers are down' behavior. But this is a different code path than the
pressure handling, so let's separate those tests.

Signed-off-by: Peter Hutterer 
---
 test/test-touchpad-tap.c | 63 +---
 1 file changed, 60 insertions(+), 3 deletions(-)

diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index a57677c2..948be965 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1591,13 +1591,19 @@ START_TEST(touchpad_3fg_tap_quickrelease)
 }
 END_TEST
 
-START_TEST(touchpad_3fg_tap_hover_btntool)
+START_TEST(touchpad_3fg_tap_pressure_btntool)
 {
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
 
-   if (libevdev_get_abs_maximum(dev->evdev,
-ABS_MT_SLOT) >= 2)
+   if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2)
+   return;
+
+   /* libinput doesn't export when it uses pressure detection, so we
+* need to reconstruct this here. Specifically, semi-mt devices are
+* non-mt in libinput, so if they have ABS_PRESSURE, they'll use it.
+*/
+   if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE))
return;
 
litest_enable_tap(dev->libinput_device);
@@ -1617,6 +1623,56 @@ START_TEST(touchpad_3fg_tap_hover_btntool)
 * third touch  */
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 3);
litest_event(dev, EV_ABS, ABS_PRESSURE, 3);
+   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);
+
+   litest_push_event_frame(dev);
+   litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
+   litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
+   litest_pop_event_frame(dev);
+   litest_assert_empty_queue(li);
+
+   litest_touch_up(dev, 0);
+   litest_touch_up(dev, 1);
+}
+END_TEST
+
+START_TEST(touchpad_3fg_tap_hover_btntool)
+{
+   struct litest_device *dev = litest_current_device();
+   struct libinput *li = dev->libinput;
+
+   if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2)
+   return;
+
+   /* libinput doesn't export when it uses pressure detection, so we
+* need to reconstruct this here. Specifically, semi-mt devices are
+* non-mt in libinput, so if they have ABS_PRESSURE, they'll use it.
+*/
+   if (libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE))
+   return;
+
+   if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT) &&
+   libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
+   return;
+
+   litest_enable_tap(dev->libinput_device);
+   litest_enable_edge_scroll(dev);
+
+   litest_drain_events(li);
+
+   litest_touch_down(dev, 0, 50, 50);
+   litest_touch_down(dev, 1, 70, 50);
+   libinput_dispatch(li);
+
+   litest_touch_move_to(dev, 0, 50, 50, 50, 70, 10, 0);
+   litest_touch_move_to(dev, 1, 70, 50, 50, 70, 10, 0);
+   litest_drain_events(li);
+
+   /* drop below the pressure threshold in the same frame as starting a
+* third touch  */
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
@@ -3317,6 +3373,7 @@ litest_setup_tests_touchpad_tap(void)
litest_add("tap-3fg:3fg", touchpad_3fg_tap_tap_again, LITEST_TOUCHPAD, 
LITEST_SINGLE_TOUCH);
litest_add("tap-3fg:3fg", touchpad_3fg_tap_quickrelease, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("tap-3fg:3fg", touchpad_3fg_tap_hover_btntool, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+   litest_add("tap-3fg:3fg", touchpad_3fg_tap_pressure_btntool, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add_for_device("tap-3fg:3fg", 
touchpad_3fg_tap_btntool_pointerjump, LITEST_SYNAPTICS_TOPBUTTONPAD);
litest_add("tap-4fg:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, 
LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
litest_add("tap-4fg:4fg", touchpad_4fg_tap_quickrelease, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 5/5] touchpad: add a TOUCH_MAYBE_END state

2018-02-28 Thread Peter Hutterer
This state is used by the pre-processing of the touch states to indicate that
the touch point has ended and is changed to TOUCH_END as soon as that
pre-processing is finished.

Sometimes we have to resurrect a touch point that has physically or logically
ended but needs to be kept around to keep the BTN_TOOL_* fake finger count
happy. Particularly on Synaptics touchpads, where a BTN_TOOL_TRIPLETAP can
cause a touch point to end (i.e. 1 touch down + TRIPLETAP) but that touch
restarts in the next sequence. We had a quirk for this in place already, but
if we end the touch and then re-instate it with tp_begin_touch(), we may lose
some information about thumb/palm/etc. states that touch already had. As a
result, the state machines can get confused and a touch that was previously
ignored as thumb suddenly isn't one anymore and triggers assertions.

The specific sequence in bug 10528 is:
* touch T1 down
* touch T2 down, detected as speed-based thumb, tap state machine ignores
  it
* frame F: TRIPLETAP down, touch T2 up
* frame F+1: touch T2 down in next frame, but without the thumb bit
* frame F+n: touch T2 ends, tap state machine gets confused because
  that touch should not trigger a release

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

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad-edge-scroll.c |  8 
 src/evdev-mt-touchpad.c | 93 +
 src/evdev-mt-touchpad.h |  9 ++--
 test/test-touchpad.c| 67 ++
 4 files changed, 154 insertions(+), 23 deletions(-)

diff --git a/src/evdev-mt-touchpad-edge-scroll.c 
b/src/evdev-mt-touchpad-edge-scroll.c
index a29d9aff..b218415f 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -366,6 +366,14 @@ tp_edge_scroll_handle_state(struct tp_dispatch *tp, 
uint64_t time)
case TOUCH_UPDATE:
tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_MOTION);
break;
+   case TOUCH_MAYBE_END:
+   /* This shouldn't happen we transfer to TOUCH_END
+* before processing state */
+   evdev_log_debug(tp->device,
+   "touch %d: unexpected state %d\n",
+   t->index,
+   t->state);
+   /* fallthrough */
case TOUCH_END:
tp_edge_scroll_handle_event(tp, t, 
SCROLL_EVENT_RELEASE);
break;
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index f9bec925..2c460829 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -302,22 +302,66 @@ tp_begin_touch(struct tp_dispatch *tp, struct tp_touch 
*t, uint64_t time)
 }
 
 /**
- * End a touch, even if the touch sequence is still active.
+ * Schedule a touch to be ended, based on either the events or some
+ * attributes of the touch (size, pressure). In some cases we need to
+ * resurrect a touch that has ended, so this doesn't actually end the touch
+ * yet. All the TOUCH_MAYBE_END touches get properly ended once the device
+ * state has been processed once and we know how many zombie touches we
+ * need.
  */
 static inline void
-tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
+tp_maybe_end_touch(struct tp_dispatch *tp,
+  struct tp_touch *t,
+  uint64_t time)
 {
switch (t->state) {
-   case TOUCH_HOVERING:
-   t->state = TOUCH_NONE;
-   /* fallthough */
case TOUCH_NONE:
+   case TOUCH_MAYBE_END:
+   case TOUCH_HOVERING:
+   return;
case TOUCH_END:
+   evdev_log_bug_libinput(tp->device,
+  "touch %d: already in TOUCH_END\n",
+  t->index);
return;
case TOUCH_BEGIN:
case TOUCH_UPDATE:
break;
+   }
 
+   t->dirty = true;
+   t->state = TOUCH_MAYBE_END;
+
+   assert(tp->nfingers_down >= 1);
+   tp->nfingers_down--;
+}
+
+/**
+ * Inverse to tp_maybe_end_touch(), restores a touch back to its previous
+ * state.
+ */
+static inline void
+tp_recover_ended_touch(struct tp_dispatch *tp,
+  struct tp_touch *t)
+{
+   t->dirty = true;
+   t->state = TOUCH_UPDATE;
+   tp->nfingers_down++;
+}
+
+/**
+ * End a touch, even if the touch sequence is still active.
+ * Use tp_maybe_end_touch() instead.
+ */
+static inline void
+tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
+{
+   if (t->state != TOUCH_MAYBE_END) {
+   evdev_log_bug_libinput(tp->device,
+  "touch %d should be MAYBE_END, is %d\n",
+  t->index,
+ 

[PATCH libinput 2/5] test: don't run the 2fg pressure test on single-touch touchpads

2018-02-28 Thread Peter Hutterer
Only the appletouch has pressure and thus executed that code path

Signed-off-by: Peter Hutterer 
---
 test/test-touchpad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-touchpad.c b/test/test-touchpad.c
index 836640b7..bf342b95 100644
--- a/test/test-touchpad.c
+++ b/test/test-touchpad.c
@@ -5805,7 +5805,7 @@ litest_setup_tests_touchpad(void)
litest_add("touchpad:pressure", touchpad_pressure_2fg_st, 
LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY);
litest_add("touchpad:pressure", touchpad_pressure_tap, LITEST_TOUCHPAD, 
LITEST_ANY);
litest_add("touchpad:pressure", touchpad_pressure_tap_2fg, 
LITEST_TOUCHPAD, LITEST_ANY);
-   litest_add("touchpad:pressure", touchpad_pressure_tap_2fg_1fg_light, 
LITEST_TOUCHPAD, LITEST_ANY);
+   litest_add("touchpad:pressure", touchpad_pressure_tap_2fg_1fg_light, 
LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
 
litest_add("touchpad:touch-size", touchpad_touch_size, 
LITEST_APPLE_CLICKPAD, LITEST_ANY);
litest_add("touchpad:touch-size", touchpad_touch_size_2fg, 
LITEST_APPLE_CLICKPAD, LITEST_ANY);
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 4/5] touchpad: don't end below-threshold pressure touches if nfake_fingers > nslots

2018-02-28 Thread Peter Hutterer
If we have more BTN_TOOL_*TAP fingers down than we have slots, ignore any
below-threshold pressure changes on the slots. When a touchpad only detects
two touches, guessing whether the third touch has sufficient pressure is
unreliable. Instead, always assume that all touches have sufficient pressure
when we exceed the slot number.

Exception: if all real fingers are below the pressure threshold, the fake
fingers are ignored too.

Related to https://bugs.freedesktop.org/show_bug.cgi?id=105258

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad.c  |  4 +++-
 test/test-touchpad-tap.c | 11 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index eaa9215a..f9bec925 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1103,7 +1103,9 @@ tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time)
tp_motion_history_reset(t);
tp_begin_touch(tp, t, time);
}
-   } else {
+   /* don't unhover for pressure if we have too many
+* fake fingers down, see comment below */
+   } else if (nfake_touches <= tp->num_slots) {
if (t->pressure < tp->pressure.low) {
evdev_log_debug(tp->device,
"pressure: end touch 
%d\n",
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index 948be965..aa1ea0f5 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1632,10 +1632,19 @@ START_TEST(touchpad_3fg_tap_pressure_btntool)
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
litest_pop_event_frame(dev);
-   litest_assert_empty_queue(li);
 
litest_touch_up(dev, 0);
litest_touch_up(dev, 1);
+   libinput_dispatch(li);
+   litest_timeout_tap();
+   libinput_dispatch(li);
+
+   litest_assert_button_event(li,
+  BTN_MIDDLE,
+  LIBINPUT_BUTTON_STATE_PRESSED);
+   litest_assert_button_event(li,
+  BTN_MIDDLE,
+  LIBINPUT_BUTTON_STATE_RELEASED);
 }
 END_TEST
 
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput] tools: add the git version in the libinput-record output

2018-02-28 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 meson.build   | 5 +
 src/libinput-git-version.h.in | 3 +++
 tools/libinput-record.c   | 2 ++
 3 files changed, 10 insertions(+)
 create mode 100644 src/libinput-git-version.h.in

diff --git a/meson.build b/meson.build
index 60caf997..c5c7dcca 100644
--- a/meson.build
+++ b/meson.build
@@ -231,6 +231,11 @@ pkgconfig.generate(
libraries : lib_libinput
 )
 
+vcs_tag(['git', 'describe'],
+   'unknown',
+   input : 'src/libinput-git-version.h.in',
+   output :'libinput-git-version.h')
+
 # Restore the SELinux context for the libinput.so.a.b.c on install
 # meson bug https://github.com/mesonbuild/meson/issues/1967
 meson.add_install_script('src/libinput-restore-selinux-context.sh',
diff --git a/src/libinput-git-version.h.in b/src/libinput-git-version.h.in
new file mode 100644
index ..c2d68af9
--- /dev/null
+++ b/src/libinput-git-version.h.in
@@ -0,0 +1,3 @@
+#pragma once
+
+#define LIBINPUT_GIT_VERSION "@VCS_TAG@"
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index 73336957..32031fad 100644
--- a/tools/libinput-record.c
+++ b/tools/libinput-record.c
@@ -38,6 +38,7 @@
 
 #include "libinput-util.h"
 #include "libinput-version.h"
+#include "libinput-git-version.h"
 
 static const int FILE_VERSION_NUMBER = 1;
 
@@ -278,6 +279,7 @@ print_libinput_header(struct record_context *ctx)
iprintf(ctx, "libinput:\n");
indent_push(ctx);
iprintf(ctx, "version: \"%s\"\n", LIBINPUT_VERSION);
+   iprintf(ctx, "git: \"%s\"\n", LIBINPUT_GIT_VERSION);
if (ctx->timeout > 0)
iprintf(ctx, "autorestart: %d\n", ctx->timeout);
indent_pop(ctx);
-- 
2.14.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH wayland v2 2/4] wayland-egl: fail the symbol check if lib is missing

2018-02-28 Thread Emil Velikov
From: Emil Velikov 

Based on a similar patch (in Mesa) by Eric Engestrom.

v2: Rebase on top of $NM patch.

Reviewed-by: Eric Engestrom 
Signed-off-by: Emil Velikov 
---
 egl/wayland-egl-symbols-check | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/egl/wayland-egl-symbols-check b/egl/wayland-egl-symbols-check
index e247cf3..4b8b5e4 100755
--- a/egl/wayland-egl-symbols-check
+++ b/egl/wayland-egl-symbols-check
@@ -1,6 +1,14 @@
 #!/bin/sh
+set -eu
 
-FUNCS=$($NM -D --defined-only ${1-.libs/libwayland-egl.so} | grep -o "T .*" | 
cut -c 3- | while read func; do
+LIB=${1-.libs/libwayland-egl.so}
+
+if [ ! -f "$LIB" ]; then
+   echo "The test binary \"$LIB\" does no exist"
+   exit 1
+fi
+
+FUNCS=$($NM -D --defined-only $LIB | grep -o "T .*" | cut -c 3- | while read 
func; do
 ( grep -q "^$func$" || echo $func )  

[PATCH wayland v2 3/4] wayland-egl: enhance the symbol test

2018-02-28 Thread Emil Velikov
From: Emil Velikov 

The current test had a few fall-outs:
 - it was checking only for T (.text) symbols
 - did not consider symbol removal

Fix that by fetching all the symbols and doing a bidirectional check -
for added and removed symbols. Error out with informative message for
each case.

v2: Rebase on top of $NM patch.

Signed-off-by: Emil Velikov 
---
 egl/wayland-egl-symbols-check | 36 
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/egl/wayland-egl-symbols-check b/egl/wayland-egl-symbols-check
index 4b8b5e4..364cce9 100755
--- a/egl/wayland-egl-symbols-check
+++ b/egl/wayland-egl-symbols-check
@@ -8,17 +8,37 @@ if [ ! -f "$LIB" ]; then
exit 1
 fi
 
-FUNCS=$($NM -D --defined-only $LIB | grep -o "T .*" | cut -c 3- | while read 
func; do
-( grep -q "^$func$" || echo $func )  

[PATCH wayland v2 4/4] wayland-egl: bump the version number to 18.1.0

2018-02-28 Thread Emil Velikov
From: Emil Velikov 

Seems like I was overoptimistic with my earlier assumption, namely:

"... 17.3.x should be the last version that ships the library."

Mesa 18.0.0 and its wayland-egl is about to be released any time soon,
so bump the number since it must no be smaller. As soon as we get
a wayland release I'll drop the Mesa copy but for now.

Signed-off-by: Emil Velikov 
---
 egl/wayland-egl.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/egl/wayland-egl.pc.in b/egl/wayland-egl.pc.in
index 943442e..2e2d4c4 100644
--- a/egl/wayland-egl.pc.in
+++ b/egl/wayland-egl.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
 
 Name: wayland-egl
 Description: Frontend wayland-egl library
-Version: 17.4.0
+Version: 18.1.0
 Requires: wayland-client
 Libs: -L${libdir} -lwayland-egl
 Cflags: -I${includedir}
-- 
2.16.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH wayland v2 1/4] Revert "wayland-egl-symbols-check: pass the DSO name via the build system"

2018-02-28 Thread Emil Velikov
This reverts commit 85cb5ed64aa8246f4da93fc5b76dfc34096bf803.

It seems like we've misread the existing code - the DSO name can be
propagated via the build-system. The one available in the script was a
simple fall-back.

v2: Rebase on top of $NM patch.

Cc: Daniel Stone 
---
 Makefile.am   | 1 -
 egl/wayland-egl-symbols-check | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2731ee7..d5b3d79 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -196,7 +196,6 @@ AM_TESTS_ENVIRONMENT =  
\
export WAYLAND_SCANNER='$(top_builddir)/wayland-scanner'\
TEST_DATA_DIR='$(top_srcdir)/tests/data'\
TEST_OUTPUT_DIR='$(top_builddir)/tests/output'  \
-   WAYLAND_EGL_LIB='$(top_builddir)/egl/.libs/libwayland-egl.so'   \
SED=$(SED)  \
;
 
diff --git a/egl/wayland-egl-symbols-check b/egl/wayland-egl-symbols-check
index 6ad28f3..e247cf3 100755
--- a/egl/wayland-egl-symbols-check
+++ b/egl/wayland-egl-symbols-check
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-FUNCS=$($NM -D --defined-only ${WAYLAND_EGL_LIB} | grep -o "T .*" | cut -c 3- 
| while read func; do
+FUNCS=$($NM -D --defined-only ${1-.libs/libwayland-egl.so} | grep -o "T .*" | 
cut -c 3- | while read func; do
 ( grep -q "^$func$" || echo $func )