summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-11-11 09:02:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-11-18 07:00:29 +1000
commita6aad69a97c68fa96e0a836e735b1a7f319b92df (patch)
tree23be0498322dc4615b6e4d098f22a869f64ebc81
parent6fa5f30129ea770bcc5e50b0785a993a8254a418 (diff)
Split type_name detection out into a helper function
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/xf86libinput.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index a4d9bd5..250e115 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1481,6 +1481,26 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
}
}
+static const char*
+xf86libinput_get_type_name(struct libinput_device *device)
+{
+ const char *type_name;
+
+ /* now pick an actual type */
+ if (libinput_device_config_tap_get_finger_count(device) > 0)
+ type_name = XI_TOUCHPAD;
+ else if (libinput_device_has_capability(device,
+ LIBINPUT_DEVICE_CAP_TOUCH))
+ type_name = XI_TOUCHSCREEN;
+ else if (libinput_device_has_capability(device,
+ LIBINPUT_DEVICE_CAP_POINTER))
+ type_name = XI_MOUSE;
+ else
+ type_name = XI_KEYBOARD;
+
+ return type_name;
+}
+
static int
xf86libinput_pre_init(InputDriverPtr drv,
InputInfoPtr pInfo,
@@ -1556,17 +1576,7 @@ xf86libinput_pre_init(InputDriverPtr drv,
xf86libinput_parse_options(pInfo, driver_data, device);
- /* now pick an actual type */
- if (libinput_device_config_tap_get_finger_count(device) > 0)
- pInfo->type_name = XI_TOUCHPAD;
- else if (libinput_device_has_capability(device,
- LIBINPUT_DEVICE_CAP_TOUCH))
- pInfo->type_name = XI_TOUCHSCREEN;
- else if (libinput_device_has_capability(device,
- LIBINPUT_DEVICE_CAP_POINTER))
- pInfo->type_name = XI_MOUSE;
- else
- pInfo->type_name = XI_KEYBOARD;
+ pInfo->type_name = xf86libinput_get_type_name(device);
return Success;
fail: