mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-23 05:35:53 -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);
|
||||
} else if (strcmp(key, "tag_count") == 0) {
|
||||
config->tag_count = CLAMP_INT(atoi(value), 1, 32);
|
||||
tag_count = config->tag_count;
|
||||
} else if (strcmp(key, "center_master_overspread") == 0) {
|
||||
config->center_master_overspread = atoi(value);
|
||||
} else if (strcmp(key, "center_when_single_stack") == 0) {
|
||||
|
|
@ -3494,6 +3495,7 @@ bool parse_config(void) {
|
|||
config.scroller_proportion_preset_count = 0;
|
||||
config.circle_layout = NULL;
|
||||
config.circle_layout_count = 0;
|
||||
config.tag_count = 9;
|
||||
config.tag_rules = NULL;
|
||||
config.tag_rules_count = 0;
|
||||
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";
|
||||
if (tag > (uint32_t)tag_count)
|
||||
return NULL;
|
||||
snprintf(buf, len, "%u", tag);
|
||||
snprintf(buf, len, "%u", CLAMP_INT(tag, 1, 32));
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
@ -188,4 +188,4 @@ void workspaces_init() {
|
|||
ext_manager = wlr_ext_workspace_manager_v1_create(dpy, 1);
|
||||
/* Initialize the global workspaces list */
|
||||
wl_list_init(&workspaces);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5456,7 +5456,6 @@ void setup(void) {
|
|||
setenv("XDG_CURRENT_DESKTOP", "mango", 1);
|
||||
|
||||
parse_config();
|
||||
tag_count = config.tag_count;
|
||||
init_baked_points();
|
||||
|
||||
int32_t drm_fd, i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue