From ce6b760b4b8a9d7715e5e876da370105395a9d19 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Wed, 8 Mar 2023 23:53:34 +0100 Subject: [PATCH] src/config/rcxml.c: reset default values on Reconfigure Reported-by: via IRC --- include/common/font.h | 4 ++-- src/config/rcxml.c | 30 ++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/include/common/font.h b/include/common/font.h index 22d9097a..bb765d23 100644 --- a/include/common/font.h +++ b/include/common/font.h @@ -5,12 +5,12 @@ struct lab_data_buffer; enum font_slant { - FONT_SLANT_NORMAL, + FONT_SLANT_NORMAL = 0, FONT_SLANT_ITALIC }; enum font_weight { - FONT_WEIGHT_NORMAL, + FONT_WEIGHT_NORMAL = 0, FONT_WEIGHT_BOLD }; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 15c95df6..8b968a2e 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -535,23 +535,35 @@ rcxml_parse_xml(struct buf *b) xmlCleanupParser(); } +static void +init_font_defaults(struct font *font) +{ + font->size = 10; + font->slant = FONT_SLANT_NORMAL; + font->weight = FONT_WEIGHT_NORMAL; +} + static void rcxml_init(void) { static bool has_run; - if (has_run) { - return; + if (!has_run) { + wl_list_init(&rc.keybinds); + wl_list_init(&rc.mousebinds); + wl_list_init(&rc.libinput_categories); + wl_list_init(&rc.workspace_config.workspaces); + wl_list_init(&rc.regions); } has_run = true; - wl_list_init(&rc.keybinds); - wl_list_init(&rc.mousebinds); - wl_list_init(&rc.libinput_categories); + rc.xdg_shell_server_side_deco = true; rc.corner_radius = 8; - rc.font_activewindow.size = 10; - rc.font_menuitem.size = 10; - rc.font_osd.size = 10; + + init_font_defaults(&rc.font_activewindow); + init_font_defaults(&rc.font_menuitem); + init_font_defaults(&rc.font_osd); + rc.doubleclick_time = 500; rc.repeat_rate = 25; rc.repeat_delay = 600; @@ -562,8 +574,6 @@ rcxml_init(void) rc.cycle_preview_contents = false; rc.cycle_preview_outlines = true; rc.workspace_config.popuptime = INT_MIN; - wl_list_init(&rc.workspace_config.workspaces); - wl_list_init(&rc.regions); } static struct {