[PATCH libinput 3/6] evdev: move calibration/sendevents config init into helpers

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 18 23:26:44 PST 2014


no functional changes

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c | 41 +++++++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index a539792..89c6802 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -943,6 +943,31 @@ evdev_init_button_scroll(struct evdev_device *device,
 	return 0;
 }
 
+static void
+evdev_init_calibration(struct evdev_device *device,
+		       struct evdev_dispatch *dispatch)
+{
+	device->base.config.calibration = &dispatch->calibration;
+
+	dispatch->calibration.has_matrix = evdev_calibration_has_matrix;
+	dispatch->calibration.set_matrix = evdev_calibration_set_matrix;
+	dispatch->calibration.get_matrix = evdev_calibration_get_matrix;
+	dispatch->calibration.get_default_matrix = evdev_calibration_get_default_matrix;
+}
+
+static void
+evdev_init_sendevents(struct evdev_device *device,
+		      struct evdev_dispatch *dispatch)
+{
+	device->base.config.sendevents = &dispatch->sendevents.config;
+
+	dispatch->sendevents.current_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
+	dispatch->sendevents.config.get_modes = evdev_sendevents_get_modes;
+	dispatch->sendevents.config.set_mode = evdev_sendevents_set_mode;
+	dispatch->sendevents.config.get_mode = evdev_sendevents_get_mode;
+	dispatch->sendevents.config.get_default_mode = evdev_sendevents_get_default_mode;
+}
+
 static struct evdev_dispatch *
 fallback_dispatch_create(struct libinput_device *device)
 {
@@ -968,20 +993,8 @@ fallback_dispatch_create(struct libinput_device *device)
 		return NULL;
 	}
 
-	device->config.calibration = &dispatch->calibration;
-
-	dispatch->calibration.has_matrix = evdev_calibration_has_matrix;
-	dispatch->calibration.set_matrix = evdev_calibration_set_matrix;
-	dispatch->calibration.get_matrix = evdev_calibration_get_matrix;
-	dispatch->calibration.get_default_matrix = evdev_calibration_get_default_matrix;
-
-	device->config.sendevents = &dispatch->sendevents.config;
-
-	dispatch->sendevents.current_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
-	dispatch->sendevents.config.get_modes = evdev_sendevents_get_modes;
-	dispatch->sendevents.config.set_mode = evdev_sendevents_set_mode;
-	dispatch->sendevents.config.get_mode = evdev_sendevents_get_mode;
-	dispatch->sendevents.config.get_default_mode = evdev_sendevents_get_default_mode;
+	evdev_init_calibration(evdev_device, dispatch);
+	evdev_init_sendevents(evdev_device, dispatch);
 
 	return dispatch;
 }
-- 
2.1.0



More information about the wayland-devel mailing list