evdev: do not pass a list to evdev_led_update()
evdev_led_update() does not really need the whole list of device at once, it can be called one device at a time. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
f1fc10a488
commit
b9d38f4552
@@ -247,8 +247,10 @@ 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;
|
||||||
|
|
||||||
evdev_led_update(&seat->devices_list, leds);
|
wl_list_for_each(device, &seat->devices_list, link)
|
||||||
|
evdev_led_update(device, leds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -1971,8 +1971,10 @@ 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;
|
||||||
|
|
||||||
evdev_led_update(&seat->devices_list, leds);
|
wl_list_for_each(device, &seat->devices_list, link)
|
||||||
|
evdev_led_update(device, leds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+4
-5
@@ -31,7 +31,7 @@
|
|||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_led_update(struct wl_list *evdev_devices, enum weston_led leds)
|
evdev_led_update(struct evdev_input_device *device, enum weston_led leds)
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
enum weston_led weston;
|
enum weston_led weston;
|
||||||
@@ -41,10 +41,12 @@ evdev_led_update(struct wl_list *evdev_devices, enum weston_led leds)
|
|||||||
{ LED_CAPS_LOCK, LED_CAPSL },
|
{ LED_CAPS_LOCK, LED_CAPSL },
|
||||||
{ LED_SCROLL_LOCK, LED_SCROLLL },
|
{ LED_SCROLL_LOCK, LED_SCROLLL },
|
||||||
};
|
};
|
||||||
struct evdev_input_device *device;
|
|
||||||
struct input_event ev[ARRAY_LENGTH(map)];
|
struct input_event ev[ARRAY_LENGTH(map)];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if (!device->caps & EVDEV_KEYBOARD)
|
||||||
|
return;
|
||||||
|
|
||||||
memset(ev, 0, sizeof(ev));
|
memset(ev, 0, sizeof(ev));
|
||||||
for (i = 0; i < ARRAY_LENGTH(map); i++) {
|
for (i = 0; i < ARRAY_LENGTH(map); i++) {
|
||||||
ev[i].type = EV_LED;
|
ev[i].type = EV_LED;
|
||||||
@@ -52,11 +54,8 @@ evdev_led_update(struct wl_list *evdev_devices, enum weston_led leds)
|
|||||||
ev[i].value = !!(leds & map[i].weston);
|
ev[i].value = !!(leds & map[i].weston);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(device, evdev_devices, link) {
|
|
||||||
if (device->caps & EVDEV_KEYBOARD)
|
|
||||||
i = write(device->fd, ev, sizeof ev);
|
i = write(device->fd, ev, sizeof ev);
|
||||||
(void)i; /* no, we really don't care about the return value */
|
(void)i; /* no, we really don't care about the return value */
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|||||||
+1
-1
@@ -106,7 +106,7 @@ struct evdev_dispatch *
|
|||||||
evdev_touchpad_create(struct evdev_input_device *device);
|
evdev_touchpad_create(struct evdev_input_device *device);
|
||||||
|
|
||||||
void
|
void
|
||||||
evdev_led_update(struct wl_list *evdev_devices, enum weston_led leds);
|
evdev_led_update(struct evdev_input_device *device, enum weston_led leds);
|
||||||
|
|
||||||
struct evdev_input_device *
|
struct evdev_input_device *
|
||||||
evdev_input_device_create(struct weston_seat *seat,
|
evdev_input_device_create(struct weston_seat *seat,
|
||||||
|
|||||||
Reference in New Issue
Block a user