From 5720e92a20369e49cb25b221988187dc62ee757b Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 3 Aug 2012 14:39:01 +0300 Subject: [PATCH] evdev: make evdev_led_update independent from struct evdev_seat in preparation of removing evdev_seat Signed-off-by: Pekka Paalanen --- src/evdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 3ea50e51..bd14f146 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -32,7 +32,7 @@ #include "launcher-util.h" static void -evdev_led_update(struct weston_seat *seat_base, enum weston_led leds) +evdev_led_update(struct wl_list *evdev_devices, enum weston_led leds) { static const struct { enum weston_led weston; @@ -42,7 +42,6 @@ evdev_led_update(struct weston_seat *seat_base, enum weston_led leds) { LED_CAPS_LOCK, LED_CAPSL }, { LED_SCROLL_LOCK, LED_SCROLLL }, }; - struct evdev_seat *seat = (struct evdev_seat *) seat_base; struct evdev_input_device *device; struct input_event ev[ARRAY_LENGTH(map)]; unsigned int i; @@ -54,12 +53,20 @@ evdev_led_update(struct weston_seat *seat_base, enum weston_led leds) ev[i].value = !!(leds & map[i].weston); } - wl_list_for_each(device, &seat->devices_list, link) { + wl_list_for_each(device, evdev_devices, link) { if (device->caps & EVDEV_KEYBOARD) write(device->fd, ev, sizeof ev); } } +static void +drm_led_update(struct weston_seat *seat_base, enum weston_led leds) +{ + struct evdev_seat *seat = (struct evdev_seat *) seat_base; + + evdev_led_update(&seat->devices_list, leds); +} + static inline void evdev_process_key(struct evdev_input_device *device, struct input_event *e, int time) @@ -753,7 +760,7 @@ evdev_input_create(struct weston_compositor *c, struct udev *udev, memset(seat, 0, sizeof *seat); weston_seat_init(&seat->base, c); - seat->base.led_update = evdev_led_update; + seat->base.led_update = drm_led_update; wl_list_init(&seat->devices_list); seat->seat_id = strdup(seat_id);