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 <ppaalanen@gmail.com>
Pekka Paalanen 12 years ago committed by Kristian Høgsberg
parent b9d38f4552
commit 3eb4761317
  1. 10
      src/compositor-android.c
  2. 16
      src/compositor-drm.c
  3. 14
      src/evdev-touchpad.c
  4. 42
      src/evdev.c
  5. 15
      src/evdev.h

@ -247,7 +247,7 @@ static void
android_led_update(struct weston_seat *seat_base, enum weston_led leds) android_led_update(struct weston_seat *seat_base, enum weston_led leds)
{ {
struct android_seat *seat = to_android_seat(seat_base); 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) wl_list_for_each(device, &seat->devices_list, link)
evdev_led_update(device, leds); evdev_led_update(device, leds);
@ -256,7 +256,7 @@ android_led_update(struct weston_seat *seat_base, enum weston_led leds)
static void static void
android_seat_open_device(struct android_seat *seat, const char *devnode) android_seat_open_device(struct android_seat *seat, const char *devnode)
{ {
struct evdev_input_device *device; struct evdev_device *device;
int fd; int fd;
/* XXX: check the Android excluded list */ /* XXX: check the Android excluded list */
@ -268,7 +268,7 @@ android_seat_open_device(struct android_seat *seat, const char *devnode)
return; return;
} }
device = evdev_input_device_create(&seat->base, devnode, fd); device = evdev_device_create(&seat->base, devnode, fd);
if (!device) { if (!device) {
close(fd); close(fd);
return; return;
@ -317,10 +317,10 @@ android_seat_scan_devices(struct android_seat *seat, const char *dirpath)
static void static void
android_seat_destroy(struct android_seat *seat) 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) 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) if (seat->base.seat.keyboard)
notify_keyboard_focus_out(&seat->base.seat); notify_keyboard_focus_out(&seat->base.seat);

@ -1802,7 +1802,7 @@ static void
device_added(struct udev_device *udev_device, struct drm_seat *master) device_added(struct udev_device *udev_device, struct drm_seat *master)
{ {
struct weston_compositor *c; struct weston_compositor *c;
struct evdev_input_device *device; struct evdev_device *device;
const char *devnode; const char *devnode;
const char *device_seat; const char *device_seat;
int fd; int fd;
@ -1818,7 +1818,7 @@ device_added(struct udev_device *udev_device, struct drm_seat *master)
devnode = udev_device_get_devnode(udev_device); devnode = udev_device_get_devnode(udev_device);
/* Use non-blocking mode so that we can loop on read on /* 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. */ * read. mtdev_get() also expects this. */
fd = weston_launcher_open(c, devnode, O_RDWR | O_NONBLOCK); fd = weston_launcher_open(c, devnode, O_RDWR | O_NONBLOCK);
if (fd < 0) { if (fd < 0) {
@ -1826,7 +1826,7 @@ device_added(struct udev_device *udev_device, struct drm_seat *master)
return; return;
} }
device = evdev_input_device_create(&master->base, devnode, fd); device = evdev_device_create(&master->base, devnode, fd);
if (!device) { if (!device) {
close(fd); close(fd);
weston_log("not using input device '%s'.\n", devnode); 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 drm_seat *seat = data;
struct udev_device *udev_device; struct udev_device *udev_device;
struct evdev_input_device *device, *next; struct evdev_device *device, *next;
const char *action; const char *action;
const char *devnode; const char *devnode;
@ -1906,7 +1906,7 @@ evdev_udev_handler(int fd, uint32_t mask, void *data)
if (!strcmp(device->devnode, devnode)) { if (!strcmp(device->devnode, devnode)) {
weston_log("input device %s, %s removed\n", weston_log("input device %s, %s removed\n",
device->devname, device->devnode); device->devname, device->devnode);
evdev_input_device_destroy(device); evdev_device_destroy(device);
break; break;
} }
} }
@ -1971,7 +1971,7 @@ static void
drm_led_update(struct weston_seat *seat_base, enum weston_led leds) drm_led_update(struct weston_seat *seat_base, enum weston_led leds)
{ {
struct drm_seat *seat = (struct drm_seat *) seat_base; 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) wl_list_for_each(device, &seat->devices_list, link)
evdev_led_update(device, leds); evdev_led_update(device, leds);
@ -2008,10 +2008,10 @@ static void
evdev_remove_devices(struct weston_seat *seat_base) evdev_remove_devices(struct weston_seat *seat_base)
{ {
struct drm_seat *seat = (struct drm_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) 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) if (seat->base.seat.keyboard)
notify_keyboard_focus_out(&seat->base.seat); notify_keyboard_focus_out(&seat->base.seat);

@ -83,7 +83,7 @@ enum touchpad_fingers_state {
struct touchpad_dispatch { struct touchpad_dispatch {
struct evdev_dispatch base; struct evdev_dispatch base;
struct evdev_input_device *device; struct evdev_device *device;
enum touchpad_model model; enum touchpad_model model;
enum touchpad_state state; enum touchpad_state state;
@ -126,7 +126,7 @@ struct touchpad_dispatch {
}; };
static enum touchpad_model static enum touchpad_model
get_touchpad_model(struct evdev_input_device *device) get_touchpad_model(struct evdev_device *device)
{ {
struct input_id id; struct input_id id;
unsigned int i; unsigned int i;
@ -190,7 +190,7 @@ touchpad_profile(struct weston_motion_filter *filter,
static void static void
configure_touchpad(struct touchpad_dispatch *touchpad, configure_touchpad(struct touchpad_dispatch *touchpad,
struct evdev_input_device *device) struct evdev_device *device)
{ {
struct weston_motion_filter *accel; struct weston_motion_filter *accel;
@ -380,7 +380,7 @@ touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time)
static inline void static inline void
process_absolute(struct touchpad_dispatch *touchpad, process_absolute(struct touchpad_dispatch *touchpad,
struct evdev_input_device *device, struct evdev_device *device,
struct input_event *e) struct input_event *e)
{ {
switch (e->code) { switch (e->code) {
@ -416,7 +416,7 @@ process_absolute(struct touchpad_dispatch *touchpad,
static inline void static inline void
process_key(struct touchpad_dispatch *touchpad, process_key(struct touchpad_dispatch *touchpad,
struct evdev_input_device *device, struct evdev_device *device,
struct input_event *e, struct input_event *e,
uint32_t time) uint32_t time)
{ {
@ -476,7 +476,7 @@ process_key(struct touchpad_dispatch *touchpad,
static void static void
touchpad_process(struct evdev_dispatch *dispatch, touchpad_process(struct evdev_dispatch *dispatch,
struct evdev_input_device *device, struct evdev_device *device,
struct input_event *e, struct input_event *e,
uint32_t time) uint32_t time)
{ {
@ -519,7 +519,7 @@ struct evdev_dispatch_interface touchpad_interface = {
}; };
struct evdev_dispatch * struct evdev_dispatch *
evdev_touchpad_create(struct evdev_input_device *device) evdev_touchpad_create(struct evdev_device *device)
{ {
struct touchpad_dispatch *touchpad; struct touchpad_dispatch *touchpad;

@ -31,7 +31,7 @@
#include "evdev.h" #include "evdev.h"
void 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 { static const struct {
enum weston_led weston; enum weston_led weston;
@ -59,8 +59,7 @@ evdev_led_update(struct evdev_input_device *device, enum weston_led leds)
} }
static inline void static inline void
evdev_process_key(struct evdev_input_device *device, evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
struct input_event *e, int time)
{ {
if (e->value == 2) if (e->value == 2)
return; return;
@ -91,8 +90,7 @@ evdev_process_key(struct evdev_input_device *device,
} }
static void static void
evdev_process_touch(struct evdev_input_device *device, evdev_process_touch(struct evdev_device *device, struct input_event *e)
struct input_event *e)
{ {
const int screen_width = device->output->current->width; const int screen_width = device->output->current->width;
const int screen_height = device->output->current->height; const int screen_height = device->output->current->height;
@ -125,7 +123,7 @@ evdev_process_touch(struct evdev_input_device *device,
} }
static inline void static inline void
evdev_process_absolute_motion(struct evdev_input_device *device, evdev_process_absolute_motion(struct evdev_device *device,
struct input_event *e) struct input_event *e)
{ {
const int screen_width = device->output->current->width; const int screen_width = device->output->current->width;
@ -150,7 +148,7 @@ evdev_process_absolute_motion(struct evdev_input_device *device,
} }
static inline void 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) struct input_event *e, uint32_t time)
{ {
switch (e->code) { switch (e->code) {
@ -178,8 +176,7 @@ evdev_process_relative(struct evdev_input_device *device,
} }
static inline void static inline void
evdev_process_absolute(struct evdev_input_device *device, evdev_process_absolute(struct evdev_device *device, struct input_event *e)
struct input_event *e)
{ {
if (device->is_mt) { if (device->is_mt) {
evdev_process_touch(device, e); evdev_process_touch(device, e);
@ -212,7 +209,7 @@ is_motion_event(struct input_event *e)
} }
static void 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; struct weston_seat *master = device->seat;
@ -260,7 +257,7 @@ evdev_flush_motion(struct evdev_input_device *device, uint32_t time)
static void static void
fallback_process(struct evdev_dispatch *dispatch, fallback_process(struct evdev_dispatch *dispatch,
struct evdev_input_device *device, struct evdev_device *device,
struct input_event *event, struct input_event *event,
uint32_t time) uint32_t time)
{ {
@ -301,7 +298,7 @@ fallback_dispatch_create(void)
} }
static 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 input_event *ev, int count)
{ {
struct evdev_dispatch *dispatch = device->dispatch; struct evdev_dispatch *dispatch = device->dispatch;
@ -328,10 +325,10 @@ evdev_process_events(struct evdev_input_device *device,
} }
static int 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 weston_compositor *ec;
struct evdev_input_device *device = data; struct evdev_device *device = data;
struct input_event ev[32]; struct input_event ev[32];
int len; int len;
@ -351,7 +348,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
len = read(fd, &ev, sizeof ev); len = read(fd, &ev, sizeof ev);
if (len < 0 || len % sizeof ev[0] != 0) { 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; return 1;
} }
@ -363,7 +360,7 @@ evdev_input_device_data(int fd, uint32_t mask, void *data)
} }
static int static int
evdev_configure_device(struct evdev_input_device *device) evdev_configure_device(struct evdev_device *device)
{ {
struct input_absinfo absinfo; struct input_absinfo absinfo;
unsigned long ev_bits[NBITS(EV_MAX)]; unsigned long ev_bits[NBITS(EV_MAX)];
@ -472,11 +469,10 @@ evdev_configure_device(struct evdev_input_device *device)
return 0; return 0;
} }
struct evdev_input_device * struct evdev_device *
evdev_input_device_create(struct weston_seat *seat, evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
const char *path, int device_fd)
{ {
struct evdev_input_device *device; struct evdev_device *device;
struct weston_compositor *ec; struct weston_compositor *ec;
char devname[256] = "unknown"; 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, device->source = wl_event_loop_add_fd(ec->input_loop, device->fd,
WL_EVENT_READABLE, WL_EVENT_READABLE,
evdev_input_device_data, device); evdev_device_data, device);
if (device->source == NULL) if (device->source == NULL)
goto err2; goto err2;
@ -536,7 +532,7 @@ err1:
} }
void void
evdev_input_device_destroy(struct evdev_input_device *device) evdev_device_destroy(struct evdev_device *device)
{ {
struct evdev_dispatch *dispatch; struct evdev_dispatch *dispatch;
@ -558,7 +554,7 @@ void
evdev_notify_keyboard_focus(struct weston_seat *seat, evdev_notify_keyboard_focus(struct weston_seat *seat,
struct wl_list *evdev_devices) struct wl_list *evdev_devices)
{ {
struct evdev_input_device *device; struct evdev_device *device;
struct wl_array keys; struct wl_array keys;
unsigned int i, set; unsigned int i, set;
char evdev_keys[(KEY_CNT + 7) / 8]; char evdev_keys[(KEY_CNT + 7) / 8];

@ -44,7 +44,7 @@ enum evdev_device_capability {
EVDEV_TOUCH = (1 << 4), EVDEV_TOUCH = (1 << 4),
}; };
struct evdev_input_device { struct evdev_device {
struct weston_seat *seat; struct weston_seat *seat;
struct wl_list link; struct wl_list link;
struct wl_event_source *source; struct wl_event_source *source;
@ -90,7 +90,7 @@ struct evdev_dispatch;
struct evdev_dispatch_interface { struct evdev_dispatch_interface {
/* Process an evdev input event. */ /* Process an evdev input event. */
void (*process)(struct evdev_dispatch *dispatch, void (*process)(struct evdev_dispatch *dispatch,
struct evdev_input_device *device, struct evdev_device *device,
struct input_event *event, struct input_event *event,
uint32_t time); uint32_t time);
@ -103,17 +103,16 @@ struct evdev_dispatch {
}; };
struct evdev_dispatch * struct evdev_dispatch *
evdev_touchpad_create(struct evdev_input_device *device); evdev_touchpad_create(struct evdev_device *device);
void 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 * struct evdev_device *
evdev_input_device_create(struct weston_seat *seat, evdev_device_create(struct weston_seat *seat, const char *path, int device_fd);
const char *path, int device_fd);
void void
evdev_input_device_destroy(struct evdev_input_device *device); evdev_device_destroy(struct evdev_device *device);
void void
evdev_notify_keyboard_focus(struct weston_seat *seat, evdev_notify_keyboard_focus(struct weston_seat *seat,

Loading…
Cancel
Save