summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-08-11 12:40:45 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-08-12 08:33:02 +1000
commit0cd54c59879063240c88f10b721470d29dbe4659 (patch)
treedeca92d8338f1e19dcaec5e7721f9a05f16dc8a0 /src
parent3dd0ece9c0f4167a98f5f9c96caaa9650da74de9 (diff)
touchpad: enable natural scrolling for edge scrolling
Instead of going straight to pointer_notify_axis, go through evdev_notify_axis() which flips the scroll direction around for us. https://bugs.freedesktop.org/show_bug.cgi?id=91597 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad-edge-scroll.c20
-rw-r--r--src/evdev.c2
-rw-r--r--src/evdev.h7
3 files changed, 18 insertions, 11 deletions
diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
index 4902808..eda62e4 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -342,7 +342,7 @@ tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time)
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;
@@ -369,7 +369,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
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,
@@ -395,7 +395,7 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
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;
@@ -416,11 +416,11 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
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);
@@ -432,14 +432,14 @@ tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time)
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,
diff --git a/src/evdev.c b/src/evdev.c
index 53ebf9d..225c3ac 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -612,7 +612,7 @@ evdev_process_absolute_motion(struct evdev_device *device,
}
}
-static void
+void
evdev_notify_axis(struct evdev_device *device,
uint64_t time,
uint32_t axes,
diff --git a/src/evdev.h b/src/evdev.h
index 65c5a41..c951671 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -381,6 +381,13 @@ 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,
enum libinput_pointer_axis_source source,