aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 00:09:20 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 11:24:15 -0500
commit4696f49ecc69aa86ea6bd53fc08abf6a32b4a414 (patch)
tree67c4e3d792c49ac7fbf6311c8b0d842768d29bc4 /sway/input/seat.c
parentReset container dimensions when moving into workspace from direction (diff)
downloadsway-4696f49ecc69aa86ea6bd53fc08abf6a32b4a414.tar.gz
sway-4696f49ecc69aa86ea6bd53fc08abf6a32b4a414.tar.zst
sway-4696f49ecc69aa86ea6bd53fc08abf6a32b4a414.zip
reload: reset input configs
This resets all input options to their defaults on reload. This also fixes some debug log typos in `input_manager_libinput_config_pointer`.
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index a8df5b99..09acab0d 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -405,6 +405,14 @@ static void seat_update_capabilities(struct sway_seat *seat) {
405 } 405 }
406} 406}
407 407
408static void seat_reset_input_config(struct sway_seat *seat,
409 struct sway_seat_device *sway_device) {
410 wlr_log(WLR_DEBUG, "Resetting output mapping for input device %s",
411 sway_device->input_device->identifier);
412 wlr_cursor_map_input_to_output(seat->cursor->cursor,
413 sway_device->input_device->wlr_device, NULL);
414}
415
408static void seat_apply_input_config(struct sway_seat *seat, 416static void seat_apply_input_config(struct sway_seat *seat,
409 struct sway_seat_device *sway_device) { 417 struct sway_seat_device *sway_device) {
410 const char *mapped_to_output = NULL; 418 const char *mapped_to_output = NULL;
@@ -522,6 +530,35 @@ void seat_configure_device(struct sway_seat *seat,
522 } 530 }
523} 531}
524 532
533void seat_reset_device(struct sway_seat *seat,
534 struct sway_input_device *input_device) {
535 struct sway_seat_device *seat_device = seat_get_device(seat, input_device);
536 if (!seat_device) {
537 return;
538 }
539
540 switch (input_device->wlr_device->type) {
541 case WLR_INPUT_DEVICE_POINTER:
542 seat_reset_input_config(seat, seat_device);
543 break;
544 case WLR_INPUT_DEVICE_KEYBOARD:
545 sway_keyboard_configure(seat_device->keyboard);
546 break;
547 case WLR_INPUT_DEVICE_TOUCH:
548 seat_reset_input_config(seat, seat_device);
549 break;
550 case WLR_INPUT_DEVICE_TABLET_TOOL:
551 seat_reset_input_config(seat, seat_device);
552 break;
553 case WLR_INPUT_DEVICE_TABLET_PAD:
554 wlr_log(WLR_DEBUG, "TODO: reset tablet pad");
555 break;
556 case WLR_INPUT_DEVICE_SWITCH:
557 wlr_log(WLR_DEBUG, "TODO: reset switch device");
558 break;
559 }
560}
561
525void seat_add_device(struct sway_seat *seat, 562void seat_add_device(struct sway_seat *seat,
526 struct sway_input_device *input_device) { 563 struct sway_input_device *input_device) {
527 if (seat_get_device(seat, input_device)) { 564 if (seat_get_device(seat, input_device)) {