Improve namespacing of event types
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 19 Dec 2013 02:04:24 +0000 (12:04 +1000)
committerJonas Ådahl <jadahl@gmail.com>
Tue, 21 Jan 2014 21:50:59 +0000 (22:50 +0100)
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 <peter.hutterer@who-t.net>
src/libinput.c
src/libinput.h
test/path.c
test/udev.c

index 65bfa74..afe7afc 100644 (file)
@@ -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);
 }
 
index d6c7597..1ecf8bb 100644 (file)
@@ -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,
 
index c5923f8..12787f6 100644 (file)
@@ -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;
                }
 
index 9e16b82..f61dd24 100644 (file)
@@ -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: