From 54db6527aee36c1137c2d8eaa66a4b02374d61ae Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 19 Dec 2013 12:04:24 +1000 Subject: [PATCH] Improve namespacing of event types Now that the target of an event isn't exposed to the caller anymore, the namespacing can be associated with a more intuitive one. Signed-off-by: Peter Hutterer --- src/libinput.c | 8 ++++---- src/libinput.h | 4 ++-- test/path.c | 4 ++-- test/udev.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libinput.c b/src/libinput.c index 65bfa741..afe7afca 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -387,8 +387,8 @@ libinput_event_get_class(struct libinput_event *event) case LIBINPUT_EVENT_NONE: return LIBINPUT_EVENT_CLASS_NONE; - case LIBINPUT_EVENT_ADDED_DEVICE: - case LIBINPUT_EVENT_REMOVED_DEVICE: + case LIBINPUT_EVENT_DEVICE_ADDED: + case LIBINPUT_EVENT_DEVICE_REMOVED: return LIBINPUT_EVENT_CLASS_BASE; case LIBINPUT_EVENT_KEYBOARD_KEY: @@ -604,7 +604,7 @@ notify_added_device(struct libinput_device *device) }; post_base_event(device, - LIBINPUT_EVENT_ADDED_DEVICE, + LIBINPUT_EVENT_DEVICE_ADDED, &added_device_event->base); } @@ -622,7 +622,7 @@ notify_removed_device(struct libinput_device *device) }; post_base_event(device, - LIBINPUT_EVENT_REMOVED_DEVICE, + LIBINPUT_EVENT_DEVICE_REMOVED, &removed_device_event->base); } diff --git a/src/libinput.h b/src/libinput.h index d6c75972..1ecf8bb5 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -124,8 +124,8 @@ enum libinput_touch_type { */ enum libinput_event_type { LIBINPUT_EVENT_NONE = 0, - LIBINPUT_EVENT_ADDED_DEVICE, - LIBINPUT_EVENT_REMOVED_DEVICE, + LIBINPUT_EVENT_DEVICE_ADDED, + LIBINPUT_EVENT_DEVICE_REMOVED, LIBINPUT_EVENT_KEYBOARD_KEY = 300, diff --git a/test/path.c b/test/path.c index c5923f8e..12787f6a 100644 --- a/test/path.c +++ b/test/path.c @@ -145,7 +145,7 @@ START_TEST(path_added_seat) ck_assert(event != NULL); type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_ADDED_DEVICE); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); device = libinput_event_get_device(event); seat = libinput_device_get_seat(device); @@ -171,7 +171,7 @@ START_TEST(path_added_device) enum libinput_event_type type; type = libinput_event_get_type(event); - if (type == LIBINPUT_EVENT_ADDED_DEVICE) { + if (type == LIBINPUT_EVENT_DEVICE_ADDED) { break; } diff --git a/test/udev.c b/test/udev.c index 9e16b826..f61dd247 100644 --- a/test/udev.c +++ b/test/udev.c @@ -153,7 +153,7 @@ START_TEST(udev_added_seat_default) while (!default_seat_found && (event = libinput_get_event(li))) { type = libinput_event_get_type(event); - if (type != LIBINPUT_EVENT_ADDED_DEVICE) { + if (type != LIBINPUT_EVENT_DEVICE_ADDED) { libinput_event_destroy(event); continue; } @@ -243,10 +243,10 @@ process_events_count_devices(struct libinput *li, int *device_count) while ((event = libinput_get_event(li))) { switch (libinput_event_get_type(event)) { - case LIBINPUT_EVENT_ADDED_DEVICE: + case LIBINPUT_EVENT_DEVICE_ADDED: (*device_count)++; break; - case LIBINPUT_EVENT_REMOVED_DEVICE: + case LIBINPUT_EVENT_DEVICE_REMOVED: (*device_count)--; break; default: