diff --git a/config.c b/config.c index 4576ad4f..bac1552f 100644 --- a/config.c +++ b/config.c @@ -17,6 +17,8 @@ #include "layouts/spiral.h" #include "layouts/floating.h" +int blw = 0; + /* static */ static void initfont(const char *, Display *, DC *); static unsigned long initcolor(const char *colstr, Display *, int); @@ -195,6 +197,9 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf) eprint("error parsing configuration file at line %d: %s\n", config_error_line(&jdwmlibconf), config_error_text(&jdwmlibconf)); + /* font */ + initfont(config_lookup_string(&jdwmlibconf, "jdwm.font"), disp, drawcontext); + /* layouts */ conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts"); @@ -210,6 +215,10 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf) name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList); if(!jdwmconf->layouts[i].arrange) eprint("unknown layout in configuration file\n"); + + j = textw(jdwmconf->layouts[i].symbol); + if(j > blw) + blw = j; } jdwmconf->layouts[i].symbol = NULL; @@ -315,9 +324,6 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf) /* mwfact */ jdwmconf->mwfact = config_lookup_float(&jdwmlibconf, "jdwm.mwfact"); - /* font */ - initfont(config_lookup_string(&jdwmlibconf, "jdwm.font"), disp, drawcontext); - /* colors */ dc.norm[ColBorder] = initcolor(config_lookup_string(&jdwmlibconf, "jdwm.normal_border_color"), disp, scr); diff --git a/jdwm.c b/jdwm.c index 1001cbb9..1bfbbe28 100644 --- a/jdwm.c +++ b/jdwm.c @@ -174,7 +174,6 @@ setup(Display *disp, jdwm_config *jdwmconf) sx = sy = 0; sw = DisplayWidth(disp, screen); sh = DisplayHeight(disp, screen); - initlayouts(jdwmconf); /* bar */ dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; diff --git a/layout.c b/layout.c index 1e1c7f77..207bc8ab 100644 --- a/layout.c +++ b/layout.c @@ -10,8 +10,6 @@ #include "layouts/floating.h" #include "util.h" -int blw = 0; - /* extern */ extern int wax, way, wah, waw; /* windowarea geometry */ extern Window barwin; @@ -75,19 +73,6 @@ uicb_focusprev(Display *disp __attribute__ ((unused)), } } -void -initlayouts(jdwm_config * jdwmconf) -{ - int w, i; - - for(blw = i = 0; i < jdwmconf->nlayouts; i++) - { - w = textw(jdwmconf->layouts[i].symbol); - if(w > blw) - blw = w; - } -} - void loadjdwmprops(Display *disp, jdwm_config * jdwmconf) { diff --git a/layout.h b/layout.h index 396e4505..a9565417 100644 --- a/layout.h +++ b/layout.h @@ -9,7 +9,6 @@ #define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange) void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */ -void initlayouts(jdwm_config *); /* initialize layout array */ void restack(Display *, jdwm_config *); /* restores z layers of all clients */ void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */ void uicb_focusprev(Display *, jdwm_config *, const char *); /* focuses prev visible client */