aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/input/seat.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 49fe46ba..a9c564e7 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -348,17 +348,33 @@ struct sway_seat *seat_create(struct sway_input_manager *input,
348 seat->input = input; 348 seat->input = input;
349 wl_list_init(&seat->devices); 349 wl_list_init(&seat->devices);
350 350
351 wlr_seat_set_capabilities(seat->wlr_seat,
352 WL_SEAT_CAPABILITY_KEYBOARD |
353 WL_SEAT_CAPABILITY_POINTER |
354 WL_SEAT_CAPABILITY_TOUCH);
355
356
357 wl_list_insert(&input->seats, &seat->link); 351 wl_list_insert(&input->seats, &seat->link);
358 352
359 return seat; 353 return seat;
360} 354}
361 355
356static void seat_update_capabilities(struct sway_seat *seat) {
357 uint32_t caps = 0;
358 struct sway_seat_device *seat_device;
359 wl_list_for_each(seat_device, &seat->devices, link) {
360 switch (seat_device->input_device->wlr_device->type) {
361 case WLR_INPUT_DEVICE_KEYBOARD:
362 caps |= WL_SEAT_CAPABILITY_KEYBOARD;
363 break;
364 case WLR_INPUT_DEVICE_POINTER:
365 caps |= WL_SEAT_CAPABILITY_POINTER;
366 break;
367 case WLR_INPUT_DEVICE_TOUCH:
368 caps |= WL_SEAT_CAPABILITY_TOUCH;
369 break;
370 case WLR_INPUT_DEVICE_TABLET_TOOL:
371 case WLR_INPUT_DEVICE_TABLET_PAD:
372 break;
373 }
374 }
375 wlr_seat_set_capabilities(seat->wlr_seat, caps);
376}
377
362static void seat_apply_input_config(struct sway_seat *seat, 378static void seat_apply_input_config(struct sway_seat *seat,
363 struct sway_seat_device *sway_device) { 379 struct sway_seat_device *sway_device) {
364 const char *mapped_to_output = NULL; 380 const char *mapped_to_output = NULL;
@@ -489,6 +505,8 @@ void seat_add_device(struct sway_seat *seat,
489 wl_list_insert(&seat->devices, &seat_device->link); 505 wl_list_insert(&seat->devices, &seat_device->link);
490 506
491 seat_configure_device(seat, input_device); 507 seat_configure_device(seat, input_device);
508
509 seat_update_capabilities(seat);
492} 510}
493 511
494void seat_remove_device(struct sway_seat *seat, 512void seat_remove_device(struct sway_seat *seat,
@@ -503,6 +521,8 @@ void seat_remove_device(struct sway_seat *seat,
503 input_device->identifier, seat->wlr_seat->name); 521 input_device->identifier, seat->wlr_seat->name);
504 522
505 seat_device_destroy(seat_device); 523 seat_device_destroy(seat_device);
524
525 seat_update_capabilities(seat);
506} 526}
507 527
508void seat_configure_xcursor(struct sway_seat *seat) { 528void seat_configure_xcursor(struct sway_seat *seat) {