From be942a6413e9509c08f2841cf0f4ea8f450f22fc Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sat, 10 Apr 2021 19:17:39 +0100 Subject: [PATCH] theme: fix pattern match bug Remove 'else' from if-statements in order for the pattern match to apply to more than just the first instance of each match. --- src/theme.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/theme.c b/src/theme.c index 348a3269..bfbbffce 100644 --- a/src/theme.c +++ b/src/theme.c @@ -91,31 +91,46 @@ static void entry(struct theme *theme, const char *key, const char *value) if (!key || !value) { return; } + + /* + * Note that in order for the pattern match to apply to more than just + * the first instance, "else if" cannot be used throughout this function + */ if (match(key, "border.width")) { theme->border_width = atoi(value); + } - } else if (match(key, "window.active.border.color")) { + if (match(key, "window.active.border.color")) { parse_hexstr(value, theme->window_active_border_color); - } else if (match(key, "window.inactive.border.color")) { + } + if (match(key, "window.inactive.border.color")) { parse_hexstr(value, theme->window_inactive_border_color); + } - } else if (match(key, "window.active.title.bg.color")) { + if (match(key, "window.active.title.bg.color")) { parse_hexstr(value, theme->window_active_title_bg_color); - } else if (match(key, "window.inactive.title.bg.color")) { + } + if (match(key, "window.inactive.title.bg.color")) { parse_hexstr(value, theme->window_inactive_title_bg_color); + } - } else if (match(key, "window.active.button.unpressed.image.color")) { + if (match(key, "window.active.button.unpressed.image.color")) { parse_hexstr(value, theme->window_active_button_unpressed_image_color); - } else if (match(key, "window.inactive.button.unpressed.image.color")) { + } + if (match(key, "window.inactive.button.unpressed.image.color")) { parse_hexstr(value, theme->window_inactive_button_unpressed_image_color); + } - } else if (match(key, "menu.items.bg.color")) { + if (match(key, "menu.items.bg.color")) { parse_hexstr(value, theme->menu_items_bg_color); - } else if (match(key, "menu.items.text.color")) { + } + if (match(key, "menu.items.text.color")) { parse_hexstr(value, theme->menu_items_text_color); - } else if (match(key, "menu.items.active.bg.color")) { + } + if (match(key, "menu.items.active.bg.color")) { parse_hexstr(value, theme->menu_items_active_bg_color); - } else if (match(key, "menu.items.active.text.color")) { + } + if (match(key, "menu.items.active.text.color")) { parse_hexstr(value, theme->menu_items_active_text_color); } } -- 2.52.0