diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-11-26 19:43:06 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-11-27 02:04:13 +0100 |
commit | 1a5797803a48fb71515e6bd6335d684a6cae6b6d (patch) | |
tree | 528f75121271960a271709f495a75754916ee42f /sway/input/input-manager.c | |
parent | input/keyboard: check keyboard group before remove (diff) | |
download | sway-1a5797803a48fb71515e6bd6335d684a6cae6b6d.tar.gz sway-1a5797803a48fb71515e6bd6335d684a6cae6b6d.tar.zst sway-1a5797803a48fb71515e6bd6335d684a6cae6b6d.zip |
config: improvements to the reload validation
For the validation pass of reloading, there is no need to touch swaybg,
swaynag, inputs, outputs, or seats. This drastically improves the speed
of a reload by skipping over the expensive I/O configuration and
handling of wayland clients. As long as the syntax is valid, the
CMD_FAILURE's can be relayed during the actual reload.
Diffstat (limited to 'sway/input/input-manager.c')
-rw-r--r-- | sway/input/input-manager.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index cfd39bab..3d7f9e8b 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -359,6 +359,23 @@ void input_manager_set_focus(struct sway_node *node) { | |||
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
362 | /** | ||
363 | * Re-translate keysyms if a change in the input config could affect them. | ||
364 | */ | ||
365 | static void retranslate_keysyms(struct input_config *input_config) { | ||
366 | for (int i = 0; i < config->input_configs->length; ++i) { | ||
367 | struct input_config *ic = config->input_configs->items[i]; | ||
368 | if (ic->xkb_layout || ic->xkb_file) { | ||
369 | // this is the first config with xkb_layout or xkb_file | ||
370 | if (ic->identifier == input_config->identifier) { | ||
371 | translate_keysyms(ic); | ||
372 | } | ||
373 | |||
374 | return; | ||
375 | } | ||
376 | } | ||
377 | } | ||
378 | |||
362 | void input_manager_apply_input_config(struct input_config *input_config) { | 379 | void input_manager_apply_input_config(struct input_config *input_config) { |
363 | struct sway_input_device *input_device = NULL; | 380 | struct sway_input_device *input_device = NULL; |
364 | bool wildcard = strcmp(input_config->identifier, "*") == 0; | 381 | bool wildcard = strcmp(input_config->identifier, "*") == 0; |
@@ -376,6 +393,8 @@ void input_manager_apply_input_config(struct input_config *input_config) { | |||
376 | } | 393 | } |
377 | } | 394 | } |
378 | } | 395 | } |
396 | |||
397 | retranslate_keysyms(input_config); | ||
379 | } | 398 | } |
380 | 399 | ||
381 | void input_manager_reset_input(struct sway_input_device *input_device) { | 400 | void input_manager_reset_input(struct sway_input_device *input_device) { |