From 3eb4761317f543c6273dba4ccc524f29a0b5b30d Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 6 Aug 2012 14:57:08 +0300 Subject: [PATCH] evdev: rename evdev_input_device to evdev_device As said by krh: "Maybe we should also just call it an evdev_device instead, shorter [and] not really ambiguous." [krh: if my typo filled irc is going in a commit message, I'm at least going to insert the missing words.] Signed-off-by: Pekka Paalanen --- src/compositor-android.c | 10 +++++----- src/compositor-drm.c | 16 +++++++-------- src/evdev-touchpad.c | 14 +++++++------- src/evdev.c | 42 ++++++++++++++++++---------------------- src/evdev.h | 15 +++++++------- 5 files changed, 46 insertions(+), 51 deletions(-) diff --git a/src/compositor-android.c b/src/compositor-android.c index 71b38cf1..5233923f 100644 --- a/src/compositor-android.c +++ b/src/compositor-android.c @@ -247,7 +247,7 @@ static void android_led_update(struct weston_seat *seat_base, enum weston_led leds) { struct android_seat *seat = to_android_seat(seat_base); - struct evdev_input_device *device; + struct evdev_device *device; wl_list_for_each(device, &seat->devices_list, link) evdev_led_update(device, leds); @@ -256,7 +256,7 @@ android_led_update(struct weston_seat *seat_base, enum weston_led leds) static void android_seat_open_device(struct android_seat *seat, const char *devnode) { - struct evdev_input_device *device; + struct evdev_device *device; int fd; /* XXX: check the Android excluded list */ @@ -268,7 +268,7 @@ android_seat_open_device(struct android_seat *seat, const char *devnode) return; } - device = evdev_input_device_create(&seat->base, devnode, fd); + device = evdev_device_create(&seat->base, devnode, fd); if (!device) { close(fd); return; @@ -317,10 +317,10 @@ android_seat_scan_devices(struct android_seat *seat, const char *dirpath) static void android_seat_destroy(struct android_seat *seat) { - struct evdev_input_device *device, *next; + struct evdev_device *device, *next; wl_list_for_each_safe(device, next, &seat->devices_list, link) - evdev_input_device_destroy(device); + evdev_device_destroy(device); if (seat->base.seat.keyboard) notify_keyboard_focus_out(&seat->base.seat); diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 4f350f0c..cde6d5d5 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -1802,7 +1802,7 @@ static void device_added(struct udev_device *udev_device, struct drm_seat *master) { struct weston_compositor *c; - struct evdev_input_device *device; + struct evdev_device *device; const char *devnode; const char *device_seat; int fd; @@ -1818,7 +1818,7 @@ device_added(struct udev_device *udev_device, struct drm_seat *master) devnode = udev_device_get_devnode(udev_device); /* Use non-blocking mode so that we can loop on read on - * evdev_input_device_data() until all events on the fd are + * evdev_device_data() until all events on the fd are * read. mtdev_get() also expects this. */ fd = weston_launcher_open(c, devnode, O_RDWR | O_NONBLOCK); if (fd < 0) { @@ -1826,7 +1826,7 @@ device_added(struct udev_device *udev_device, struct drm_seat *master) return; } - device = evdev_input_device_create(&master->base, devnode, fd); + device = evdev_device_create(&master->base, devnode, fd); if (!device) { close(fd); weston_log("not using input device '%s'.\n", devnode); @@ -1882,7 +1882,7 @@ evdev_udev_handler(int fd, uint32_t mask, void *data) { struct drm_seat *seat = data; struct udev_device *udev_device; - struct evdev_input_device *device, *next; + struct evdev_device *device, *next; const char *action; const char *devnode; @@ -1906,7 +1906,7 @@ evdev_udev_handler(int fd, uint32_t mask, void *data) if (!strcmp(device->devnode, devnode)) { weston_log("input device %s, %s removed\n", device->devname, device->devnode); - evdev_input_device_destroy(device); + evdev_device_destroy(device); break; } } @@ -1971,7 +1971,7 @@ static void drm_led_update(struct weston_seat *seat_base, enum weston_led leds) { struct drm_seat *seat = (struct drm_seat *) seat_base; - struct evdev_input_device *device; + struct evdev_device *device; wl_list_for_each(device, &seat->devices_list, link) evdev_led_update(device, leds); @@ -2008,10 +2008,10 @@ static void evdev_remove_devices(struct weston_seat *seat_base) { struct drm_seat *seat = (struct drm_seat *) seat_base; - struct evdev_input_device *device, *next; + struct evdev_device *device, *next; wl_list_for_each_safe(device, next, &seat->devices_list, link) - evdev_input_device_destroy(device); + evdev_device_destroy(device); if (seat->base.seat.keyboard) notify_keyboard_focus_out(&seat->base.seat); diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index f613fb90..16478b8b 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -83,7 +83,7 @@ enum touchpad_fingers_state { struct touchpad_dispatch { struct evdev_dispatch base; - struct evdev_input_device *device; + struct evdev_device *device; enum touchpad_model model; enum touchpad_state state; @@ -126,7 +126,7 @@ struct touchpad_dispatch { }; static enum touchpad_model -get_touchpad_model(struct evdev_input_device *device) +get_touchpad_model(struct evdev_device *device) { struct input_id id; unsigned int i; @@ -190,7 +190,7 @@ touchpad_profile(struct weston_motion_filter *filter, static void configure_touchpad(struct touchpad_dispatch *touchpad, - struct evdev_input_device *device) + struct evdev_device *device) { struct weston_motion_filter *accel; @@ -380,7 +380,7 @@ touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time) static inline void process_absolute(struct touchpad_dispatch *touchpad, - struct evdev_input_device *device, + struct evdev_device *device, struct input_event *e) { switch (e->code) { @@ -416,7 +416,7 @@ process_absolute(struct touchpad_dispatch *touchpad, static inline void process_key(struct touchpad_dispatch *touchpad, - struct evdev_input_device *device, + struct evdev_device *device, struct input_event *e, uint32_t time) { @@ -476,7 +476,7 @@ process_key(struct touchpad_dispatch *touchpad, static void touchpad_process(struct evdev_dispatch *dispatch, - struct evdev_input_device *device, + struct evdev_device *device, struct input_event *e, uint32_t time) { @@ -519,7 +519,7 @@ struct evdev_dispatch_interface touchpad_interface = { }; struct evdev_dispatch * -evdev_touchpad_create(struct evdev_input_device *device) +evdev_touchpad_create(struct evdev_device *device) { struct touchpad_dispatch *touchpad; diff --git a/src/evdev.c b/src/evdev.c index dba33bab..3c7b2f47 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -31,7 +31,7 @@ #include "evdev.h" void -evdev_led_update(struct evdev_input_device *device, enum weston_led leds) +evdev_led_update(struct evdev_device *device, enum weston_led leds) { static const struct { enum weston_led weston; @@ -59,8 +59,7 @@ evdev_led_update(struct evdev_input_device *device, enum weston_led leds) } static inline void -evdev_process_key(struct evdev_input_device *device, - struct input_event *e, int time) +evdev_process_key(struct evdev_device *device, struct input_event *e, int time) { if (e->value == 2) return; @@ -91,8 +90,7 @@ evdev_process_key(struct evdev_input_device *device, } static void -evdev_process_touch(struct evdev_input_device *device, - struct input_event *e) +evdev_process_touch(struct evdev_device *device, struct input_event *e) { const int screen_width = device->output->current->width; const int screen_height = device->output->current->height; @@ -125,7 +123,7 @@ evdev_process_touch(struct evdev_input_device *device, } static inline void -evdev_process_absolute_motion(struct evdev_input_device *device, +evdev_process_absolute_motion(struct evdev_device *device, struct input_event *e) { const int screen_width = device->output->current->width; @@ -150,7 +148,7 @@ evdev_process_absolute_motion(struct evdev_input_device *device, } static inline void -evdev_process_relative(struct evdev_input_device *device, +evdev_process_relative(struct evdev_device *device, struct input_event *e, uint32_t time) { switch (e->code) { @@ -178,8 +176,7 @@ evdev_process_relative(struct evdev_input_device *device, } static inline void -evdev_process_absolute(struct evdev_input_device *device, - struct input_event *e) +evdev_process_absolute(struct evdev_device *device, struct input_event *e) { if (device->is_mt) { evdev_process_touch(device, e); @@ -212,7 +209,7 @@ is_motion_event(struct input_event *e) } static void -evdev_flush_motion(struct evdev_input_device *device, uint32_t time) +evdev_flush_motion(struct evdev_device *device, uint32_t time) { struct weston_seat *master = device->seat; @@ -260,7 +257,7 @@ evdev_flush_motion(struct evdev_input_device *device, uint32_t time) static void fallback_process(struct evdev_dispatch *dispatch, - struct evdev_input_device *device, + struct evdev_device *device, struct input_event *event, uint32_t time) { @@ -301,7 +298,7 @@ fallback_dispatch_create(void) } static void -evdev_process_events(struct evdev_input_device *device, +evdev_process_events(struct evdev_device *device, struct input_event *ev, int count) { struct evdev_dispatch *dispatch = device->dispatch; @@ -328,10 +325,10 @@ evdev_process_events(struct evdev_input_device *device, } static int -evdev_input_device_data(int fd, uint32_t mask, void *data) +evdev_device_data(int fd, uint32_t mask, void *data) { struct weston_compositor *ec; - struct evdev_input_device *device = data; + struct evdev_device *device = data; struct input_event ev[32]; int len; @@ -351,7 +348,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data) len = read(fd, &ev, sizeof ev); if (len < 0 || len % sizeof ev[0] != 0) { - /* FIXME: call evdev_input_device_destroy when errno is ENODEV. */ + /* FIXME: call evdev_device_destroy when errno is ENODEV. */ return 1; } @@ -363,7 +360,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data) } static int -evdev_configure_device(struct evdev_input_device *device) +evdev_configure_device(struct evdev_device *device) { struct input_absinfo absinfo; unsigned long ev_bits[NBITS(EV_MAX)]; @@ -472,11 +469,10 @@ evdev_configure_device(struct evdev_input_device *device) return 0; } -struct evdev_input_device * -evdev_input_device_create(struct weston_seat *seat, - const char *path, int device_fd) +struct evdev_device * +evdev_device_create(struct weston_seat *seat, const char *path, int device_fd) { - struct evdev_input_device *device; + struct evdev_device *device; struct weston_compositor *ec; char devname[256] = "unknown"; @@ -520,7 +516,7 @@ evdev_input_device_create(struct weston_seat *seat, device->source = wl_event_loop_add_fd(ec->input_loop, device->fd, WL_EVENT_READABLE, - evdev_input_device_data, device); + evdev_device_data, device); if (device->source == NULL) goto err2; @@ -536,7 +532,7 @@ err1: } void -evdev_input_device_destroy(struct evdev_input_device *device) +evdev_device_destroy(struct evdev_device *device) { struct evdev_dispatch *dispatch; @@ -558,7 +554,7 @@ void evdev_notify_keyboard_focus(struct weston_seat *seat, struct wl_list *evdev_devices) { - struct evdev_input_device *device; + struct evdev_device *device; struct wl_array keys; unsigned int i, set; char evdev_keys[(KEY_CNT + 7) / 8]; diff --git a/src/evdev.h b/src/evdev.h index 003b3626..85c4739b 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -44,7 +44,7 @@ enum evdev_device_capability { EVDEV_TOUCH = (1 << 4), }; -struct evdev_input_device { +struct evdev_device { struct weston_seat *seat; struct wl_list link; struct wl_event_source *source; @@ -90,7 +90,7 @@ struct evdev_dispatch; struct evdev_dispatch_interface { /* Process an evdev input event. */ void (*process)(struct evdev_dispatch *dispatch, - struct evdev_input_device *device, + struct evdev_device *device, struct input_event *event, uint32_t time); @@ -103,17 +103,16 @@ struct evdev_dispatch { }; struct evdev_dispatch * -evdev_touchpad_create(struct evdev_input_device *device); +evdev_touchpad_create(struct evdev_device *device); void -evdev_led_update(struct evdev_input_device *device, enum weston_led leds); +evdev_led_update(struct evdev_device *device, enum weston_led leds); -struct evdev_input_device * -evdev_input_device_create(struct weston_seat *seat, - const char *path, int device_fd); +struct evdev_device * +evdev_device_create(struct weston_seat *seat, const char *path, int device_fd); void -evdev_input_device_destroy(struct evdev_input_device *device); +evdev_device_destroy(struct evdev_device *device); void evdev_notify_keyboard_focus(struct weston_seat *seat,