From: Johan Malm Date: Mon, 19 Jul 2021 19:46:32 +0000 (+0100) Subject: rcxml: allow without place="" attribute X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=2e4f931469a326b1310d388a28607fadb7121840;p=proto%2Flabwc.git rcxml: allow without place="" attribute The construct below will set the font for all supported places. Currently that's only ActiveWindow, but is likely to include InactiveWindow, MenuHeader, MenuItem and OnScreenDisplay at some point. --- diff --git a/docs/rc.xml b/docs/rc.xml index 12020580..dbe834d4 100644 --- a/docs/rc.xml +++ b/docs/rc.xml @@ -8,7 +8,7 @@ 8 - Sans10 + Sans12 diff --git a/src/config/rcxml.c b/src/config/rcxml.c index c40e2849..7c354677 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -80,14 +80,30 @@ fill_font(char *nodename, char *content, enum font_place place) } string_truncate_at_pattern(nodename, ".font.theme"); + switch (place) { + case FONT_PLACE_UNKNOWN: + /* + * If is used without a place="" + * attribute, we set all font variables + */ + if (!strcmp(nodename, "name")) { + rc.font_name_activewindow = strdup(content); + } else if (!strcmp(nodename, "size")) { + rc.font_size_activewindow = atoi(content); + } + break; + case FONT_PLACE_ACTIVEWINDOW: + if (!strcmp(nodename, "name")) { + rc.font_name_activewindow = strdup(content); + } else if (!strcmp(nodename, "size")) { + rc.font_size_activewindow = atoi(content); + } + break; + /* TODO: implement for all font places */ - if (place != FONT_PLACE_ACTIVEWINDOW) { - return; - } - if (!strcmp(nodename, "name")) { - rc.font_name_activewindow = strdup(content); - } else if (!strcmp(nodename, "size")) { - rc.font_size_activewindow = atoi(content); + + default: + break; } } @@ -108,7 +124,7 @@ enum_font_place(const char *place) static void entry(xmlNode *node, char *nodename, char *content) { - /* current */ + /* current */ static enum font_place font_place = FONT_PLACE_UNKNOWN; if (!nodename) {