[PATCH libinput 1/7] filter: Add motion filter destruction helper

Jonas Ådahl jadahl at gmail.com
Mon May 26 14:27:24 PDT 2014


Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 src/evdev-mt-touchpad.c | 3 +--
 src/filter.c            | 9 +++++++++
 src/filter.h            | 3 +++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 89cebd5..751132c 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -606,8 +606,7 @@ tp_destroy(struct evdev_dispatch *dispatch)
 	tp_destroy_tap(tp);
 	tp_destroy_buttons(tp);
 
-	if (tp->filter)
-		tp->filter->interface->destroy(tp->filter);
+	motion_filter_destroy(tp->filter);
 	free(tp->touches);
 	free(tp);
 }
diff --git a/src/filter.c b/src/filter.c
index 2c23da1..22c3ed8 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -331,3 +331,12 @@ create_pointer_accelator_filter(accel_profile_func_t profile)
 
 	return &filter->base;
 }
+
+void
+motion_filter_destroy(struct motion_filter *filter)
+{
+	if (!filter)
+		return;
+
+	filter->interface->destroy(filter);
+}
diff --git a/src/filter.h b/src/filter.h
index 0ef3d03..ada4f93 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -59,4 +59,7 @@ typedef double (*accel_profile_func_t)(struct motion_filter *filter,
 struct motion_filter *
 create_pointer_accelator_filter(accel_profile_func_t filter);
 
+void
+motion_filter_destroy(struct motion_filter *filter);
+
 #endif /* FILTER_H */
-- 
1.9.1



More information about the wayland-devel mailing list