int
tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
{
- struct libinput_device *device = &tp->device->base;
+ struct evdev_device *device = tp->device;
struct tp_touch *t;
enum libinput_pointer_axis axis;
double *delta;
case EDGE_NONE:
if (t->scroll.direction != -1) {
/* Send stop scroll event */
- pointer_notify_axis(device, time,
+ evdev_notify_axis(device, time,
AS_MASK(t->scroll.direction),
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
&zero,
switch (t->scroll.edge_state) {
case EDGE_SCROLL_TOUCH_STATE_NONE:
case EDGE_SCROLL_TOUCH_STATE_AREA:
- log_bug_libinput(device->seat->libinput,
+ log_bug_libinput(tp_libinput_context(tp),
"unexpected scroll state %d\n",
t->scroll.edge_state);
break;
if (*delta == 0.0)
continue;
- pointer_notify_axis(device, time,
- AS_MASK(axis),
- LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
- &normalized,
- &zero_discrete);
+ evdev_notify_axis(device, time,
+ AS_MASK(axis),
+ LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
+ &normalized,
+ &zero_discrete);
t->scroll.direction = axis;
tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_POSTED);
void
tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time)
{
- struct libinput_device *device = &tp->device->base;
+ struct evdev_device *device = tp->device;
struct tp_touch *t;
const struct normalized_coords zero = { 0.0, 0.0 };
const struct discrete_coords zero_discrete = { 0.0, 0.0 };
tp_for_each_touch(tp, t) {
if (t->scroll.direction != -1) {
- pointer_notify_axis(device, time,
+ evdev_notify_axis(device, time,
AS_MASK(t->scroll.direction),
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
&zero,
}
}
-static void
+void
evdev_notify_axis(struct evdev_device *device,
uint64_t time,
uint32_t axes,
void
evdev_init_natural_scroll(struct evdev_device *device);
+void
+evdev_notify_axis(struct evdev_device *device,
+ uint64_t time,
+ uint32_t axes,
+ enum libinput_pointer_axis_source source,
+ const struct normalized_coords *delta_in,
+ const struct discrete_coords *discrete_in);
void
evdev_post_scroll(struct evdev_device *device,
uint64_t time,
}
END_TEST
+START_TEST(touchpad_scroll_natural_edge)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+
+ litest_enable_edge_scroll(dev);
+ litest_drain_events(li);
+
+ libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1);
+
+ litest_touch_down(dev, 0, 99, 20);
+ litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0);
+ litest_touch_up(dev, 0);
+
+ libinput_dispatch(li);
+ litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -4);
+ litest_assert_empty_queue(li);
+
+ litest_touch_down(dev, 0, 99, 80);
+ litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10, 0);
+ litest_touch_up(dev, 0);
+
+ libinput_dispatch(li);
+ litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4);
+ litest_assert_empty_queue(li);
+
+}
+END_TEST
+
START_TEST(touchpad_edge_scroll)
{
struct litest_device *dev = litest_current_device();
litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_scroll_natural_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
+ litest_add("touchpad:scroll", touchpad_scroll_natural_edge, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("touchpad:scroll", touchpad_scroll_defaults, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_edge_scroll, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_ANY);