rootston: set real seat capabilities

This commit is contained in:
emersion 2018-01-16 20:33:55 +01:00
parent bcb58b5caa
commit 7f56ccd713
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -293,11 +293,6 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
return NULL; return NULL;
} }
wlr_seat_set_capabilities(seat->seat,
WL_SEAT_CAPABILITY_KEYBOARD |
WL_SEAT_CAPABILITY_POINTER |
WL_SEAT_CAPABILITY_TOUCH);
wl_list_insert(&input->seats, &seat->link); wl_list_insert(&input->seats, &seat->link);
seat->seat_destroy.notify = roots_seat_handle_seat_destroy; seat->seat_destroy.notify = roots_seat_handle_seat_destroy;
@ -306,6 +301,20 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
return seat; return seat;
} }
static void seat_update_capabilities(struct roots_seat *seat) {
uint32_t caps = 0;
if (!wl_list_empty(&seat->keyboards)) {
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
}
if (!wl_list_empty(&seat->pointers) || !wl_list_empty(&seat->tablet_tools)) {
caps |= WL_SEAT_CAPABILITY_POINTER;
}
if (!wl_list_empty(&seat->touch)) {
caps |= WL_SEAT_CAPABILITY_TOUCH;
}
wlr_seat_set_capabilities(seat->seat, caps);
}
static void seat_add_keyboard(struct roots_seat *seat, static void seat_add_keyboard(struct roots_seat *seat,
struct wlr_input_device *device) { struct wlr_input_device *device) {
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD); assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
@ -404,6 +413,8 @@ void roots_seat_add_device(struct roots_seat *seat,
seat_add_tablet_tool(seat, device); seat_add_tablet_tool(seat, device);
break; break;
} }
seat_update_capabilities(seat);
} }
static void seat_remove_keyboard(struct roots_seat *seat, static void seat_remove_keyboard(struct roots_seat *seat,
@ -480,6 +491,8 @@ void roots_seat_remove_device(struct roots_seat *seat,
seat_remove_tablet_tool(seat, device); seat_remove_tablet_tool(seat, device);
break; break;
} }
seat_update_capabilities(seat);
} }
void roots_seat_configure_xcursor(struct roots_seat *seat) { void roots_seat_configure_xcursor(struct roots_seat *seat) {