libinput: litest shall only emit auto assign events when replaced
authorAndreas Pokorny <andreas.pokorny@canonical.com>
Thu, 20 Aug 2015 11:43:40 +0000 (13:43 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Aug 2015 04:46:49 +0000 (14:46 +1000)
With this change auto assign events will be skipped if no replacement value
is provided. This behavior is practical when emitting mt events, as those
only contain the axis values that changed.

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/litest.c

index 6b28ee0be941b1819c226752441329964b7211e0..29e764b4cd6fca4c4b50de197c1aebfc824cc423 100644 (file)
@@ -1294,7 +1294,6 @@ litest_auto_assign_value(struct litest_device *d,
                value = touching ? 0 : 1;
                break;
        default:
-               value = -1;
                if (!axis_replacement_value(axes, ev->code, &value) &&
                    d->interface->get_axis_default)
                        d->interface->get_axis_default(d, ev->code, &value);
@@ -1344,8 +1343,8 @@ litest_slot_start(struct litest_device *d,
                                                     y,
                                                     axes,
                                                     touching);
-
-               litest_event(d, ev->type, ev->code, value);
+               if (value != LITEST_AUTO_ASSIGN)
+                       litest_event(d, ev->type, ev->code, value);
                ev++;
        }
 }
@@ -1430,7 +1429,8 @@ litest_slot_move(struct litest_device *d,
                                                     y,
                                                     axes,
                                                     touching);
-               litest_event(d, ev->type, ev->code, value);
+               if (value != LITEST_AUTO_ASSIGN)
+                       litest_event(d, ev->type, ev->code, value);
                ev++;
        }
 }