Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/evdev-mt-touchpad-buttons.c     |  8 ++++----
 src/evdev-mt-touchpad-edge-scroll.c | 12 ++++++------
 src/evdev-mt-touchpad-tap.c         | 10 +++++-----
 src/evdev-mt-touchpad.c             |  8 ++++----
 src/evdev-mt-touchpad.h             |  6 ++++++
 5 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 43e983b..09ea6d7 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -392,7 +392,7 @@ tp_button_handle_event(struct tp_dispatch *tp,
                       enum button_event event,
                       uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
        enum button_state current = t->button.state;
 
        switch(t->button.state) {
@@ -478,7 +478,7 @@ tp_process_button(struct tp_dispatch *tp,
                  const struct input_event *e,
                  uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
        uint32_t mask = 1 << (e->code - BTN_LEFT);
 
        /* Ignore other buttons on clickpads */
@@ -680,7 +680,7 @@ int
 tp_init_buttons(struct tp_dispatch *tp,
                struct evdev_device *device)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
        struct tp_touch *t;
        int width, height;
        double diagonal;
@@ -731,7 +731,7 @@ tp_init_buttons(struct tp_dispatch *tp,
        tp_for_each_touch(tp, t) {
                t->button.state = BUTTON_STATE_NONE;
                libinput_timer_init(&t->button.timer,
-                                   tp->device->base.seat->libinput,
+                                   tp_libinput_context(tp),
                                    tp_button_handle_timeout, t);
        }
 
diff --git a/src/evdev-mt-touchpad-edge-scroll.c 
b/src/evdev-mt-touchpad-edge-scroll.c
index 369fded..9bf3f0c 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -121,7 +121,7 @@ tp_edge_scroll_handle_none(struct tp_dispatch *tp,
                           struct tp_touch *t,
                           enum scroll_event event)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case SCROLL_EVENT_TOUCH:
@@ -149,7 +149,7 @@ tp_edge_scroll_handle_edge_new(struct tp_dispatch *tp,
                               struct tp_touch *t,
                               enum scroll_event event)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case SCROLL_EVENT_TOUCH:
@@ -178,7 +178,7 @@ tp_edge_scroll_handle_edge(struct tp_dispatch *tp,
                           struct tp_touch *t,
                           enum scroll_event event)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case SCROLL_EVENT_TOUCH:
@@ -209,7 +209,7 @@ tp_edge_scroll_handle_area(struct tp_dispatch *tp,
                           struct tp_touch *t,
                           enum scroll_event event)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case SCROLL_EVENT_TOUCH:
@@ -232,7 +232,7 @@ tp_edge_scroll_handle_event(struct tp_dispatch *tp,
                            struct tp_touch *t,
                            enum scroll_event event)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
        enum tp_edge_scroll_touch_state current = t->scroll.edge_state;
 
        switch (current) {
@@ -301,7 +301,7 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct 
evdev_device *device)
        tp_for_each_touch(tp, t) {
                t->scroll.direction = -1;
                libinput_timer_init(&t->scroll.timer,
-                                   device->base.seat->libinput,
+                                   tp_libinput_context(tp),
                                    tp_edge_scroll_handle_timeout, t);
        }
 
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index fb8c9e4..bb7c894 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -147,7 +147,7 @@ tp_tap_idle_handle_event(struct tp_dispatch *tp,
                         struct tp_touch *t,
                         enum tap_event event, uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case TAP_EVENT_TOUCH:
@@ -223,7 +223,7 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp,
                           struct tp_touch *t,
                           enum tap_event event, uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case TAP_EVENT_MOTION:
@@ -483,7 +483,7 @@ tp_tap_multitap_handle_event(struct tp_dispatch *tp,
                              struct tp_touch *t,
                              enum tap_event event, uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
 
        switch (event) {
        case TAP_EVENT_RELEASE:
@@ -576,7 +576,7 @@ tp_tap_handle_event(struct tp_dispatch *tp,
                    enum tap_event event,
                    uint64_t time)
 {
-       struct libinput *libinput = tp->device->base.seat->libinput;
+       struct libinput *libinput = tp_libinput_context(tp);
        enum tp_tap_state current;
 
        current = tp->tap.state;
@@ -857,7 +857,7 @@ tp_init_tap(struct tp_dispatch *tp)
        tp->tap.enabled = tp_tap_default(tp->device);
 
        libinput_timer_init(&tp->tap.timer,
-                           tp->device->base.seat->libinput,
+                           tp_libinput_context(tp),
                            tp_tap_handle_timeout, tp);
 
        return 0;
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 6bd8d1d..1ea3bce 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -810,7 +810,7 @@ tp_release_fake_touches(struct tp_dispatch *tp)
 static void
 tp_clear_state(struct tp_dispatch *tp)
 {
-       uint64_t now = libinput_now(tp->device->base.seat->libinput);
+       uint64_t now = libinput_now(tp_libinput_context(tp));
        struct tp_touch *t;
 
        /* Unroll the touchpad state.
@@ -1251,7 +1251,7 @@ tp_scroll_config_scroll_method_set_method(struct 
libinput_device *device,
 {
        struct evdev_device *evdev = (struct evdev_device*)device;
        struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
-       uint64_t time = libinput_now(device->seat->libinput);
+       uint64_t time = libinput_now(tp_libinput_context(tp));
 
        if (method == tp->scroll.method)
                return LIBINPUT_CONFIG_STATUS_SUCCESS;
@@ -1352,11 +1352,11 @@ tp_init_sendevents(struct tp_dispatch *tp,
                   struct evdev_device *device)
 {
        libinput_timer_init(&tp->sendevents.trackpoint_timer,
-                           tp->device->base.seat->libinput,
+                           tp_libinput_context(tp),
                            tp_trackpoint_timeout, tp);
 
        libinput_timer_init(&tp->dwt.keyboard_timer,
-                           tp->device->base.seat->libinput,
+                           tp_libinput_context(tp),
                            tp_keyboard_timeout, tp);
        return 0;
 }
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index f6c5aff..1b644e0 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -295,6 +295,12 @@ struct tp_dispatch {
 #define tp_for_each_touch(_tp, _t) \
        for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = 
&(_tp)->touches[_i]); _i++)
 
+static inline struct libinput*
+tp_libinput_context(struct tp_dispatch *tp)
+{
+       return tp->device->base.seat->libinput;
+}
+
 static inline struct normalized_coords
 tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta)
 {
-- 
2.4.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to