Merge branch 'master' into tablet-support
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Aug 2015 04:24:16 +0000 (14:24 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 26 Aug 2015 04:24:16 +0000 (14:24 +1000)
12 files changed:
1  2 
configure.ac
doc/Makefile.am
src/evdev-mt-touchpad.c
src/evdev.c
src/evdev.h
src/libinput-private.h
src/libinput-util.h
src/libinput.c
src/libinput.h
test/device.c
test/litest-int.h
test/litest.c

diff --cc configure.ac
Simple merge
diff --cc doc/Makefile.am
Simple merge
Simple merge
diff --cc src/evdev.c
Simple merge
diff --cc src/evdev.h
Simple merge
Simple merge
Simple merge
diff --cc src/libinput.c
Simple merge
diff --cc src/libinput.h
Simple merge
diff --cc test/device.c
@@@ -1030,22 -1030,156 +1030,172 @@@ START_TEST(device_udev_tag_synaptics_se
  }
  END_TEST
  
 +START_TEST(device_udev_tag_wacom_tablet)
 +{
 +      struct litest_device *dev = litest_current_device();
 +      struct libinput_device *device = dev->libinput_device;
 +      struct udev_device *d;
 +      const char *prop;
 +
 +      d = libinput_device_get_udev_device(device);
 +      prop = udev_device_get_property_value(d,
 +                                            "ID_INPUT_TABLET");
 +
 +      ck_assert_notnull(prop);
 +      udev_device_unref(d);
 +}
 +END_TEST
 +
+ START_TEST(device_nonpointer_rel)
+ {
+       struct libevdev_uinput *uinput;
+       struct libinput *li;
+       struct libinput_device *device;
+       int i;
+       uinput = litest_create_uinput_device("test device",
+                                            NULL,
+                                            EV_KEY, KEY_A,
+                                            EV_KEY, KEY_B,
+                                            EV_REL, REL_X,
+                                            EV_REL, REL_Y,
+                                            -1);
+       li = litest_create_context();
+       device = libinput_path_add_device(li,
+                                         libevdev_uinput_get_devnode(uinput));
+       ck_assert(device != NULL);
+       litest_disable_log_handler(li);
+       for (i = 0; i < 100; i++) {
+               libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
+               libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1);
+               libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0);
+               libinput_dispatch(li);
+       }
+       litest_restore_log_handler(li);
+       libinput_unref(li);
+       libevdev_uinput_destroy(uinput);
+ }
+ END_TEST
+ START_TEST(device_touchpad_rel)
+ {
+       struct libevdev_uinput *uinput;
+       struct libinput *li;
+       struct libinput_device *device;
+       const struct input_absinfo abs[] = {
+               { ABS_X, 0, 10, 0, 0, 10 },
+               { ABS_Y, 0, 10, 0, 0, 10 },
+               { ABS_MT_SLOT, 0, 2, 0, 0, 0 },
+               { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 },
+               { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 },
+               { ABS_MT_POSITION_Y, 0, 10, 0, 0, 10 },
+               { -1, -1, -1, -1, -1, -1 }
+       };
+       int i;
+       uinput = litest_create_uinput_abs_device("test device",
+                                                NULL, abs,
+                                                EV_KEY, BTN_TOOL_FINGER,
+                                                EV_KEY, BTN_TOUCH,
+                                                EV_REL, REL_X,
+                                                EV_REL, REL_Y,
+                                                -1);
+       li = litest_create_context();
+       device = libinput_path_add_device(li,
+                                         libevdev_uinput_get_devnode(uinput));
+       ck_assert(device != NULL);
+       for (i = 0; i < 100; i++) {
+               libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
+               libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1);
+               libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0);
+               libinput_dispatch(li);
+       }
+       libinput_unref(li);
+       libevdev_uinput_destroy(uinput);
+ }
+ END_TEST
+ START_TEST(device_touch_rel)
+ {
+       struct libevdev_uinput *uinput;
+       struct libinput *li;
+       struct libinput_device *device;
+       const struct input_absinfo abs[] = {
+               { ABS_X, 0, 10, 0, 0, 10 },
+               { ABS_Y, 0, 10, 0, 0, 10 },
+               { ABS_MT_SLOT, 0, 2, 0, 0, 0 },
+               { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 },
+               { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 },
+               { ABS_MT_POSITION_Y, 0, 10, 0, 0, 10 },
+               { -1, -1, -1, -1, -1, -1 }
+       };
+       int i;
+       uinput = litest_create_uinput_abs_device("test device",
+                                                NULL, abs,
+                                                EV_KEY, BTN_TOUCH,
+                                                EV_REL, REL_X,
+                                                EV_REL, REL_Y,
+                                                -1);
+       li = litest_create_context();
+       device = libinput_path_add_device(li,
+                                         libevdev_uinput_get_devnode(uinput));
+       ck_assert(device != NULL);
+       litest_disable_log_handler(li);
+       for (i = 0; i < 100; i++) {
+               libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
+               libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1);
+               libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0);
+               libinput_dispatch(li);
+       }
+       litest_restore_log_handler(li);
+       libinput_unref(li);
+       libevdev_uinput_destroy(uinput);
+ }
+ END_TEST
+ START_TEST(device_abs_rel)
+ {
+       struct libevdev_uinput *uinput;
+       struct libinput *li;
+       struct libinput_device *device;
+       const struct input_absinfo abs[] = {
+               { ABS_X, 0, 10, 0, 0, 10 },
+               { ABS_Y, 0, 10, 0, 0, 10 },
+               { -1, -1, -1, -1, -1, -1 }
+       };
+       int i;
+       uinput = litest_create_uinput_abs_device("test device",
+                                                NULL, abs,
+                                                EV_KEY, BTN_TOUCH,
+                                                EV_KEY, BTN_LEFT,
+                                                EV_REL, REL_X,
+                                                EV_REL, REL_Y,
+                                                -1);
+       li = litest_create_context();
+       device = libinput_path_add_device(li,
+                                         libevdev_uinput_get_devnode(uinput));
+       ck_assert(device != NULL);
+       for (i = 0; i < 100; i++) {
+               libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1);
+               libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1);
+               libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0);
+               libinput_dispatch(li);
+       }
+       libinput_unref(li);
+       libevdev_uinput_destroy(uinput);
+ }
+ END_TEST
  void
  litest_setup_tests(void)
  {
        litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY);
        litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY);
        litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY);
 +      litest_add("device:udev tags", device_udev_tag_wacom_tablet, LITEST_TABLET, LITEST_ANY);
+       litest_add_no_device("device:invalid rel events", device_nonpointer_rel);
+       litest_add_no_device("device:invalid rel events", device_touchpad_rel);
+       litest_add_no_device("device:invalid rel events", device_touch_rel);
+       litest_add_no_device("device:invalid rel events", device_abs_rel);
  }
@@@ -97,16 -97,8 +97,16 @@@ struct litest_device_interface 
        struct input_event *touch_move_events;
        struct input_event *touch_up_events;
  
-       int min[2];
-       int max[2];
 +      /**
 +       * Tablet events, LITEST_AUTO_ASSIGN is allowed on event values for
 +       * ABS_X, ABS_Y, ABS_DISTANCE and ABS_PRESSURE.
 +       */
 +      struct input_event *tablet_proximity_in_events;
 +      struct input_event *tablet_proximity_out_events;
 +      struct input_event *tablet_motion_events;
 +
+       int min[2]; /* x/y axis minimum */
+       int max[2]; /* x/y axis maximum */
  };
  
  void litest_set_current_device(struct litest_device *device);
diff --cc test/litest.c
Simple merge