mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-04-08 08:21:16 -04:00
Clean up tag_count config parsing; defensively clamp tag snprintf
This commit is contained in:
parent
8cc5579e16
commit
139f25a0b9
3 changed files with 4 additions and 3 deletions
|
|
@ -1577,6 +1577,7 @@ bool parse_option(Config *config, char *key, char *value) {
|
||||||
config->default_nmaster = atoi(value);
|
config->default_nmaster = atoi(value);
|
||||||
} else if (strcmp(key, "tag_count") == 0) {
|
} else if (strcmp(key, "tag_count") == 0) {
|
||||||
config->tag_count = CLAMP_INT(atoi(value), 1, 32);
|
config->tag_count = CLAMP_INT(atoi(value), 1, 32);
|
||||||
|
tag_count = config->tag_count;
|
||||||
} else if (strcmp(key, "center_master_overspread") == 0) {
|
} else if (strcmp(key, "center_master_overspread") == 0) {
|
||||||
config->center_master_overspread = atoi(value);
|
config->center_master_overspread = atoi(value);
|
||||||
} else if (strcmp(key, "center_when_single_stack") == 0) {
|
} else if (strcmp(key, "center_when_single_stack") == 0) {
|
||||||
|
|
@ -3494,6 +3495,7 @@ bool parse_config(void) {
|
||||||
config.scroller_proportion_preset_count = 0;
|
config.scroller_proportion_preset_count = 0;
|
||||||
config.circle_layout = NULL;
|
config.circle_layout = NULL;
|
||||||
config.circle_layout_count = 0;
|
config.circle_layout_count = 0;
|
||||||
|
config.tag_count = 9;
|
||||||
config.tag_rules = NULL;
|
config.tag_rules = NULL;
|
||||||
config.tag_rules_count = 0;
|
config.tag_rules_count = 0;
|
||||||
config.cursor_theme = NULL;
|
config.cursor_theme = NULL;
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static const char *get_name_from_tag(uint32_t tag, char *buf, size_t len) {
|
||||||
return "overview";
|
return "overview";
|
||||||
if (tag > (uint32_t)tag_count)
|
if (tag > (uint32_t)tag_count)
|
||||||
return NULL;
|
return NULL;
|
||||||
snprintf(buf, len, "%u", tag);
|
snprintf(buf, len, "%u", CLAMP_INT(tag, 1, 32));
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,4 +188,4 @@ void workspaces_init() {
|
||||||
ext_manager = wlr_ext_workspace_manager_v1_create(dpy, 1);
|
ext_manager = wlr_ext_workspace_manager_v1_create(dpy, 1);
|
||||||
/* Initialize the global workspaces list */
|
/* Initialize the global workspaces list */
|
||||||
wl_list_init(&workspaces);
|
wl_list_init(&workspaces);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5456,7 +5456,6 @@ void setup(void) {
|
||||||
setenv("XDG_CURRENT_DESKTOP", "mango", 1);
|
setenv("XDG_CURRENT_DESKTOP", "mango", 1);
|
||||||
|
|
||||||
parse_config();
|
parse_config();
|
||||||
tag_count = config.tag_count;
|
|
||||||
init_baked_points();
|
init_baked_points();
|
||||||
|
|
||||||
int32_t drm_fd, i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
|
int32_t drm_fd, i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue