diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-18 10:44:51 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-18 10:44:51 -0500 |
commit | 4c436a1a6f78ce9eae40791b85c02d44458de727 (patch) | |
tree | 64cb8fed2e33720ac6c1315e3ff8e205c50c1e08 | |
parent | improve xkb command logging (diff) | |
download | sway-4c436a1a6f78ce9eae40791b85c02d44458de727.tar.gz sway-4c436a1a6f78ce9eae40791b85c02d44458de727.tar.zst sway-4c436a1a6f78ce9eae40791b85c02d44458de727.zip |
remove assumption of one device per identifier
-rw-r--r-- | sway/input/input-manager.c | 29 | ||||
-rw-r--r-- | sway/input/keyboard.c | 2 |
2 files changed, 11 insertions, 20 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 12a66917..52da8f5e 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -83,17 +83,6 @@ static struct sway_input_device *input_sway_device_from_wlr( | |||
83 | return NULL; | 83 | return NULL; |
84 | } | 84 | } |
85 | 85 | ||
86 | static struct sway_input_device *input_sway_device_from_config( | ||
87 | struct sway_input_manager *input, struct input_config *config) { | ||
88 | struct sway_input_device *input_device = NULL; | ||
89 | wl_list_for_each(input_device, &input->devices, link) { | ||
90 | if (strcmp(input_device->identifier, config->identifier) == 0) { | ||
91 | return input_device; | ||
92 | } | ||
93 | } | ||
94 | return NULL; | ||
95 | } | ||
96 | |||
97 | static bool input_has_seat_configuration(struct sway_input_manager *input) { | 86 | static bool input_has_seat_configuration(struct sway_input_manager *input) { |
98 | struct sway_seat *seat = NULL; | 87 | struct sway_seat *seat = NULL; |
99 | wl_list_for_each(seat, &input->seats, link) { | 88 | wl_list_for_each(seat, &input->seats, link) { |
@@ -238,16 +227,16 @@ void sway_input_manager_set_focus(struct sway_input_manager *input, | |||
238 | 227 | ||
239 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, | 228 | void sway_input_manager_apply_input_config(struct sway_input_manager *input, |
240 | struct input_config *input_config) { | 229 | struct input_config *input_config) { |
241 | struct sway_input_device *input_device = | 230 | struct sway_input_device *input_device = NULL; |
242 | input_sway_device_from_config(input, input_config); | 231 | wl_list_for_each(input_device, &input->devices, link) { |
243 | if (!input_device) { | 232 | if (strcmp(input_device->identifier, input_config->identifier) == 0) { |
244 | return; | 233 | input_device->config = input_config; |
245 | } | ||
246 | input_device->config = input_config; | ||
247 | 234 | ||
248 | struct sway_seat *seat = NULL; | 235 | struct sway_seat *seat = NULL; |
249 | wl_list_for_each(seat, &input->seats, link) { | 236 | wl_list_for_each(seat, &input->seats, link) { |
250 | sway_seat_configure_device(seat, input_device); | 237 | sway_seat_configure_device(seat, input_device); |
238 | } | ||
239 | } | ||
251 | } | 240 | } |
252 | } | 241 | } |
253 | 242 | ||
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index ce0df3c5..bb18edd2 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -91,6 +91,8 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) { | |||
91 | wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap); | 91 | wlr_keyboard_set_keymap(wlr_device->keyboard, keyboard->keymap); |
92 | wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600); | 92 | wlr_keyboard_set_repeat_info(wlr_device->keyboard, 25, 600); |
93 | xkb_context_unref(context); | 93 | xkb_context_unref(context); |
94 | struct wlr_seat *seat = keyboard->seat_device->sway_seat->wlr_seat; | ||
95 | wlr_seat_set_keyboard(seat, wlr_device); | ||
94 | 96 | ||
95 | wl_list_remove(&keyboard->keyboard_key.link); | 97 | wl_list_remove(&keyboard->keyboard_key.link); |
96 | wl_signal_add(&wlr_device->keyboard->events.key, &keyboard->keyboard_key); | 98 | wl_signal_add(&wlr_device->keyboard->events.key, &keyboard->keyboard_key); |