mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
seat: add seat_update_capabilities helper
This commit is contained in:
parent
d83c58919f
commit
d7d11a079a
1 changed files with 25 additions and 17 deletions
42
src/seat.c
42
src/seat.c
|
|
@ -198,6 +198,30 @@ new_touch(struct seat *seat, struct input *input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
seat_update_capabilities(struct seat *seat)
|
||||||
|
{
|
||||||
|
struct input *input = NULL;
|
||||||
|
uint32_t caps = 0;
|
||||||
|
|
||||||
|
wl_list_for_each(input, &seat->inputs, link) {
|
||||||
|
switch (input->wlr_input_device->type) {
|
||||||
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
||||||
|
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
||||||
|
break;
|
||||||
|
case WLR_INPUT_DEVICE_POINTER:
|
||||||
|
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||||
|
break;
|
||||||
|
case WLR_INPUT_DEVICE_TOUCH:
|
||||||
|
caps |= WL_SEAT_CAPABILITY_TOUCH;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wlr_seat_set_capabilities(seat->seat, caps);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
new_input_notify(struct wl_listener *listener, void *data)
|
new_input_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -226,23 +250,7 @@ new_input_notify(struct wl_listener *listener, void *data)
|
||||||
wl_signal_add(&device->events.destroy, &input->destroy);
|
wl_signal_add(&device->events.destroy, &input->destroy);
|
||||||
wl_list_insert(&seat->inputs, &input->link);
|
wl_list_insert(&seat->inputs, &input->link);
|
||||||
|
|
||||||
uint32_t caps = 0;
|
seat_update_capabilities(seat);
|
||||||
wl_list_for_each(input, &seat->inputs, link) {
|
|
||||||
switch (input->wlr_input_device->type) {
|
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
|
||||||
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
|
|
||||||
break;
|
|
||||||
case WLR_INPUT_DEVICE_POINTER:
|
|
||||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
|
||||||
break;
|
|
||||||
case WLR_INPUT_DEVICE_TOUCH:
|
|
||||||
caps |= WL_SEAT_CAPABILITY_TOUCH;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wlr_seat_set_capabilities(seat->seat, caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue