aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-12-29 21:50:03 -0500
committeremersion <contact@emersion.fr>2018-12-30 14:12:36 +0100
commit09bb71f6507d86d98b5b9825f28b91ddd4b9a09b (patch)
treede570ea01b3262c46441afb1f75570a4d44210e8 /sway/input
parent3e8f548d1d0acb3aba384842615e6528b3027283 (diff)
downloadsway-09bb71f6507d86d98b5b9825f28b91ddd4b9a09b.tar.xz
Verify seat fallback settings on reload
This fixes an issue where on reload, all input devices that were added via an implicit fallback to the default seat would be removed from the default seat and applications would crash due to the seat having no capabilities. On reload, there is a query for a seat config with the fallback setting set (it can either be true or false). If no such seat config exists, the default seat is created (if needed) and has the implicit fallback true applied to its seat config. This is the same procedure that occurs when a new input is detected.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/input-manager.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 055f6752..9aaeb4d6 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -95,6 +95,17 @@ static bool input_has_seat_fallback_configuration(void) {
return false;
}
+void input_manager_verify_fallback_seat(void) {
+ struct sway_seat *seat = NULL;
+ if (!input_has_seat_fallback_configuration()) {
+ wlr_log(WLR_DEBUG, "no fallback seat config - creating default");
+ seat = input_manager_get_default_seat();
+ struct seat_config *sc = new_seat_config(seat->wlr_seat->name);
+ sc->fallback = true;
+ store_seat_config(sc);
+ }
+}
+
static void input_manager_libinput_config_keyboard(
struct sway_input_device *input_device) {
struct wlr_input_device *wlr_device = input_device->wlr_device;
@@ -296,16 +307,10 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
wl_signal_add(&device->events.destroy, &input_device->device_destroy);
input_device->device_destroy.notify = handle_device_destroy;
- struct sway_seat *seat = NULL;
- if (!input_has_seat_fallback_configuration()) {
- wlr_log(WLR_DEBUG, "no seat config - creating default seat config");
- seat = input_manager_get_default_seat();
- struct seat_config *sc = new_seat_config(seat->wlr_seat->name);
- sc->fallback = true;
- store_seat_config(sc);
- }
+ input_manager_verify_fallback_seat();
bool added = false;
+ struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input->seats, link) {
struct seat_config *seat_config = seat_get_config(seat);
bool has_attachment = seat_config &&