mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-06 17:18:09 +02:00
evdev: make evdev_led_update independent from struct evdev_seat
in preparation of removing evdev_seat Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
0e9fd6fa0a
commit
83d7662cbb
1 changed files with 11 additions and 4 deletions
15
src/evdev.c
15
src/evdev.c
|
|
@ -32,7 +32,7 @@
|
||||||
#include "launcher-util.h"
|
#include "launcher-util.h"
|
||||||
|
|
||||||
static void
|
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 {
|
static const struct {
|
||||||
enum weston_led weston;
|
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_CAPS_LOCK, LED_CAPSL },
|
||||||
{ LED_SCROLL_LOCK, LED_SCROLLL },
|
{ LED_SCROLL_LOCK, LED_SCROLLL },
|
||||||
};
|
};
|
||||||
struct evdev_seat *seat = (struct evdev_seat *) seat_base;
|
|
||||||
struct evdev_input_device *device;
|
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;
|
||||||
|
|
@ -54,12 +53,20 @@ evdev_led_update(struct weston_seat *seat_base, enum weston_led leds)
|
||||||
ev[i].value = !!(leds & map[i].weston);
|
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)
|
if (device->caps & EVDEV_KEYBOARD)
|
||||||
write(device->fd, ev, sizeof ev);
|
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
|
static inline void
|
||||||
evdev_process_key(struct evdev_input_device *device,
|
evdev_process_key(struct evdev_input_device *device,
|
||||||
struct input_event *e, int time)
|
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);
|
memset(seat, 0, sizeof *seat);
|
||||||
weston_seat_init(&seat->base, c);
|
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);
|
wl_list_init(&seat->devices_list);
|
||||||
seat->seat_id = strdup(seat_id);
|
seat->seat_id = strdup(seat_id);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue