aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-01-22 01:16:23 +0100
committerLibravatar GitHub <noreply@github.com>2018-01-22 01:16:23 +0100
commit0c58673c6a108ba241419a0f1d5fecd47f22370e (patch)
treec3e19af6dd70f04fc5c617e932b4afcc7a1b41d9 /sway/config.c
parentRemove sway/old/ (diff)
parentdont allow kill command in config (diff)
downloadsway-0c58673c6a108ba241419a0f1d5fecd47f22370e.tar.gz
sway-0c58673c6a108ba241419a0f1d5fecd47f22370e.tar.zst
sway-0c58673c6a108ba241419a0f1d5fecd47f22370e.zip
Merge pull request #1574 from acrisci/config-refactor
Command criteria
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sway/config.c b/sway/config.c
index cbd9a8b2..1fd123b7 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -54,6 +54,8 @@ static void free_mode(struct sway_mode *mode) {
54} 54}
55 55
56void free_config(struct sway_config *config) { 56void free_config(struct sway_config *config) {
57 config_clear_handler_context(config);
58
57 int i; 59 int i;
58 60
59 if (!config) { 61 if (!config) {
@@ -485,6 +487,12 @@ bool load_include_configs(const char *path, struct sway_config *config) {
485 return true; 487 return true;
486} 488}
487 489
490void config_clear_handler_context(struct sway_config *config) {
491 free_input_config(config->handler_context.input_config);
492 free_seat_config(config->handler_context.seat_config);
493
494 memset(&config->handler_context, 0, sizeof(config->handler_context));
495}
488 496
489bool read_config(FILE *file, struct sway_config *config) { 497bool read_config(FILE *file, struct sway_config *config) {
490 bool success = true; 498 bool success = true;
@@ -597,14 +605,11 @@ bool read_config(FILE *file, struct sway_config *config) {
597 605
598 case CMD_BLOCK_INPUT: 606 case CMD_BLOCK_INPUT:
599 wlr_log(L_DEBUG, "End of input block"); 607 wlr_log(L_DEBUG, "End of input block");
600 free_input_config(current_input_config);
601 current_input_config = NULL;
602 block = CMD_BLOCK_END; 608 block = CMD_BLOCK_END;
603 break; 609 break;
604 610
605 case CMD_BLOCK_SEAT: 611 case CMD_BLOCK_SEAT:
606 wlr_log(L_DEBUG, "End of seat block"); 612 wlr_log(L_DEBUG, "End of seat block");
607 current_seat_config = NULL;
608 block = CMD_BLOCK_END; 613 block = CMD_BLOCK_END;
609 break; 614 break;
610 615
@@ -640,6 +645,7 @@ bool read_config(FILE *file, struct sway_config *config) {
640 645
641 default:; 646 default:;
642 } 647 }
648 config_clear_handler_context(config);
643 default:; 649 default:;
644 } 650 }
645 free(line); 651 free(line);