opt: optimzie code struct

This commit is contained in:
DreamMaoMao 2025-09-07 14:30:15 +08:00
parent 3ea0f11084
commit 33a1289813

View file

@ -1440,6 +1440,7 @@ void parse_config_line(Config *config, const char *line) {
ConfigWinRule *rule = &config->window_rules[config->window_rules_count];
memset(rule, 0, sizeof(ConfigWinRule));
// int rule value, relay to a client property
rule->isfloating = -1;
rule->isfullscreen = -1;
rule->isnoborder = -1;
@ -1455,22 +1456,29 @@ void parse_config_line(Config *config, const char *line) {
rule->isterm = -1;
rule->noswallow = -1;
rule->noblur = -1;
rule->monitor = NULL;
rule->offsetx = 0;
rule->offsety = 0;
rule->nofadein = -1;
rule->nofadeout = -1;
rule->no_force_center = -1;
rule->focused_opacity = 0;
rule->unfocused_opacity = 0;
rule->width = 0;
rule->height = 0;
// string rule value, relay to a client property
rule->animation_type_open = NULL;
rule->animation_type_close = NULL;
// float rule value, relay to a client property
rule->focused_opacity = 0;
rule->unfocused_opacity = 0;
rule->scroller_proportion = 0;
// special rule value,not directly set to client property
rule->tags = 0;
rule->offsetx = 0;
rule->offsety = 0;
rule->width = 0;
rule->height = 0;
rule->monitor = NULL;
rule->id = NULL;
rule->title = NULL;
rule->tags = 0;
rule->globalkeybinding = (KeyBinding){0};
char *token = strtok(value, ",");