mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
seat: add seat_add_device helper
This commit is contained in:
parent
d7d11a079a
commit
065b015fbb
1 changed files with 12 additions and 6 deletions
18
src/seat.c
18
src/seat.c
|
|
@ -222,6 +222,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)
|
||||||
{
|
{
|
||||||
|
|
@ -229,7 +240,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 = znew(*input);
|
struct input *input = znew(*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:
|
||||||
|
|
@ -246,11 +256,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