diff options
author | Brian Ashworth <[email protected]> | 2019-01-09 00:09:20 -0500 |
---|---|---|
committer | Brian Ashworth <[email protected]> | 2019-01-09 11:24:15 -0500 |
commit | 4696f49ecc69aa86ea6bd53fc08abf6a32b4a414 (patch) | |
tree | 67c4e3d792c49ac7fbf6311c8b0d842768d29bc4 /sway/input/seat.c | |
parent | 14cab7861294189f820e0830ae84ac7b15271342 (diff) |
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.c | 37 |
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) { } } +static void seat_reset_input_config(struct sway_seat *seat, + struct sway_seat_device *sway_device) { + wlr_log(WLR_DEBUG, "Resetting output mapping for input device %s", + sway_device->input_device->identifier); + wlr_cursor_map_input_to_output(seat->cursor->cursor, + sway_device->input_device->wlr_device, NULL); +} + static void seat_apply_input_config(struct sway_seat *seat, struct sway_seat_device *sway_device) { const char *mapped_to_output = NULL; @@ -522,6 +530,35 @@ void seat_configure_device(struct sway_seat *seat, } } +void seat_reset_device(struct sway_seat *seat, + struct sway_input_device *input_device) { + struct sway_seat_device *seat_device = seat_get_device(seat, input_device); + if (!seat_device) { + return; + } + + switch (input_device->wlr_device->type) { + case WLR_INPUT_DEVICE_POINTER: + seat_reset_input_config(seat, seat_device); + break; + case WLR_INPUT_DEVICE_KEYBOARD: + sway_keyboard_configure(seat_device->keyboard); + break; + case WLR_INPUT_DEVICE_TOUCH: + seat_reset_input_config(seat, seat_device); + break; + case WLR_INPUT_DEVICE_TABLET_TOOL: + seat_reset_input_config(seat, seat_device); + break; + case WLR_INPUT_DEVICE_TABLET_PAD: + wlr_log(WLR_DEBUG, "TODO: reset tablet pad"); + break; + case WLR_INPUT_DEVICE_SWITCH: + wlr_log(WLR_DEBUG, "TODO: reset switch device"); + break; + } +} + void seat_add_device(struct sway_seat *seat, struct sway_input_device *input_device) { if (seat_get_device(seat, input_device)) { |