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/commands/input.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/commands/input.c')
-rw-r--r-- | sway/commands/input.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c index a11ad79a..53db9a16 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c | |||
@@ -44,23 +44,6 @@ static struct cmd_handler input_config_handlers[] = { | |||
44 | { "xkb_numlock", input_cmd_xkb_numlock }, | 44 | { "xkb_numlock", input_cmd_xkb_numlock }, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /** | ||
48 | * Re-translate keysyms if a change in the input config could affect them. | ||
49 | */ | ||
50 | static void retranslate_keysyms(struct input_config *input_config) { | ||
51 | for (int i = 0; i < config->input_configs->length; ++i) { | ||
52 | struct input_config *ic = config->input_configs->items[i]; | ||
53 | if (ic->xkb_layout || ic->xkb_file) { | ||
54 | // this is the first config with xkb_layout or xkb_file | ||
55 | if (ic->identifier == input_config->identifier) { | ||
56 | translate_keysyms(ic); | ||
57 | } | ||
58 | |||
59 | return; | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | |||
64 | struct cmd_results *cmd_input(int argc, char **argv) { | 47 | struct cmd_results *cmd_input(int argc, char **argv) { |
65 | struct cmd_results *error = NULL; | 48 | struct cmd_results *error = NULL; |
66 | if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) { | 49 | if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) { |
@@ -106,8 +89,9 @@ struct cmd_results *cmd_input(int argc, char **argv) { | |||
106 | return res; | 89 | return res; |
107 | } | 90 | } |
108 | 91 | ||
109 | input_manager_apply_input_config(ic); | 92 | if (!config->reloading) { |
110 | retranslate_keysyms(ic); | 93 | input_manager_apply_input_config(ic); |
94 | } | ||
111 | } else { | 95 | } else { |
112 | free_input_config(config->handler_context.input_config); | 96 | free_input_config(config->handler_context.input_config); |
113 | } | 97 | } |