mirror of
https://github.com/labwc/labwc.git
synced 2026-04-11 08:21:13 -04:00
seat: Add seat_add_device helper
This commit is contained in:
parent
a53ccd5308
commit
c5ea2b8eee
1 changed files with 12 additions and 6 deletions
18
src/seat.c
18
src/seat.c
|
|
@ -220,6 +220,17 @@ seat_update_capabilities(struct seat *seat)
|
||||||
wlr_seat_set_capabilities(seat->seat, caps);
|
wlr_seat_set_capabilities(seat->seat, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
seat_add_device(struct seat *seat, struct input *input)
|
||||||
|
{
|
||||||
|
input->seat = seat;
|
||||||
|
input->destroy.notify = input_device_destroy;
|
||||||
|
wl_signal_add(&input->wlr_input_device->events.destroy, &input->destroy);
|
||||||
|
wl_list_insert(&seat->inputs, &input->link);
|
||||||
|
|
||||||
|
seat_update_capabilities(seat);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_input_notify(struct wl_listener *listener, void *data)
|
new_input_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -227,7 +238,6 @@ new_input_notify(struct wl_listener *listener, void *data)
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct input *input = calloc(1, sizeof(struct input));
|
struct input *input = calloc(1, sizeof(struct input));
|
||||||
input->wlr_input_device = device;
|
input->wlr_input_device = device;
|
||||||
input->seat = seat;
|
|
||||||
|
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
||||||
|
|
@ -244,11 +254,7 @@ new_input_notify(struct wl_listener *listener, void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
input->destroy.notify = input_device_destroy;
|
seat_add_device(seat, input);
|
||||||
wl_signal_add(&device->events.destroy, &input->destroy);
|
|
||||||
wl_list_insert(&seat->inputs, &input->link);
|
|
||||||
|
|
||||||
seat_update_capabilities(seat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue