diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-11-18 10:49:47 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-11-20 08:16:02 +1000 |
commit | 8630a8e0c28de32dde34d01a97b703ed3840a285 (patch) | |
tree | b3cc34709a543a75b347067518788783e5fc0859 | |
parent | b7c324ba32922c1b6279b0240993a0099685cc60 (diff) | |
download | libinput-8630a8e0c28de32dde34d01a97b703ed3840a285.tar.gz |
evdev: move calibration/sendevents config init into helpers
no functional changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | src/evdev.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/evdev.c b/src/evdev.c index a5397929..89c68028 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; } |