summaryrefslogtreecommitdiff
path: root/libevdev/libevdev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-08-27 13:33:37 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-09-10 11:25:09 +1000
commitab2f20bfd6ad632b1ab5c41a0aac54d8bf2e0bc3 (patch)
tree3d638f2b951faa74bb6bc4c4dd917e10df86c605 /libevdev/libevdev.c
parent14ac764ec86452ca607403f314b0f8355d80290c (diff)
downloadlibevdev-ab2f20bfd6ad632b1ab5c41a0aac54d8bf2e0bc3.tar.gz
Revamp the API once again
Another look at the current API showed some inconsistencies, rectified in this commit: libevdev_kernel_*: modify the underlying kernel device libevdev_event_type_*: something with an event type libevdev_event_code_*: something with an event code libevdev_event_*: struct input_event-related functions (i.e. not device-related) libevdev_property_*: something with a property libevdev_*: anything applying to a device Hopefully that's the last API change. Current symbols deprecated and aliased. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Diffstat (limited to 'libevdev/libevdev.c')
-rw-r--r--libevdev/libevdev.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index aa5cbd6..70680d6 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -1244,26 +1244,41 @@ libevdev_grab(struct libevdev *dev, enum libevdev_grab_mode grab)
return rc < 0 ? -errno : 0;
}
+/* DEPRECATED */
LIBEVDEV_EXPORT int
libevdev_is_event_type(const struct input_event *ev, unsigned int type)
+ALIAS(libevdev_event_is_type);
+
+LIBEVDEV_EXPORT int
+libevdev_event_is_type(const struct input_event *ev, unsigned int type)
{
return type < EV_CNT && ev->type == type;
}
+/* DEPRECATED */
LIBEVDEV_EXPORT int
libevdev_is_event_code(const struct input_event *ev, unsigned int type, unsigned int code)
+ALIAS(libevdev_event_is_code);
+
+LIBEVDEV_EXPORT int
+libevdev_event_is_code(const struct input_event *ev, unsigned int type, unsigned int code)
{
int max;
- if (!libevdev_is_event_type(ev, type))
+ if (!libevdev_event_is_type(ev, type))
return 0;
- max = libevdev_get_event_type_max(type);
+ max = libevdev_event_type_get_max(type);
return (max > -1 && code <= (unsigned int)max && ev->code == code);
}
+/* DEPRECATED */
LIBEVDEV_EXPORT const char*
libevdev_get_event_type_name(unsigned int type)
+ALIAS(libevdev_event_type_get_name);
+
+LIBEVDEV_EXPORT const char*
+libevdev_event_type_get_name(unsigned int type)
{
if (type > EV_MAX)
return NULL;
@@ -1271,10 +1286,15 @@ libevdev_get_event_type_name(unsigned int type)
return ev_map[type];
}
+/* DEPRECATED */
LIBEVDEV_EXPORT const char*
libevdev_get_event_code_name(unsigned int type, unsigned int code)
+ALIAS(libevdev_event_code_get_name);
+
+LIBEVDEV_EXPORT const char*
+libevdev_event_code_get_name(unsigned int type, unsigned int code)
{
- int max = libevdev_get_event_type_max(type);
+ int max = libevdev_event_type_get_max(type);
if (max == -1 || code > (unsigned int)max)
return NULL;
@@ -1282,8 +1302,18 @@ libevdev_get_event_code_name(unsigned int type, unsigned int code)
return event_type_map[type][code];
}
+/* DEPRECATED */
+LIBEVDEV_EXPORT const char*
+libevdev_get_input_prop_name(unsigned int prop)
+ALIAS(libevdev_property_get_name);
+
+/* DEPRECATED */
LIBEVDEV_EXPORT const char*
libevdev_get_property_name(unsigned int prop)
+ALIAS(libevdev_property_get_name);
+
+LIBEVDEV_EXPORT const char*
+libevdev_property_get_name(unsigned int prop)
{
if (prop > INPUT_PROP_MAX)
return NULL;
@@ -1291,8 +1321,13 @@ libevdev_get_property_name(unsigned int prop)
return input_prop_map[prop];
}
+/* DEPRECATED */
LIBEVDEV_EXPORT int
libevdev_get_event_type_max(unsigned int type)
+ALIAS(libevdev_event_type_get_max);
+
+LIBEVDEV_EXPORT int
+libevdev_event_type_get_max(unsigned int type)
{
if (type > EV_MAX)
return -1;