From 4c4c8d61c662cfe45e4aa6b6662a1c00947225db Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 8 Dec 2009 16:52:17 +0000 Subject: start fixing screen_ctx usage, for it is utterly broken. bring font into screen_ctx and start passing screen_ctx around to in order get rid of Curscreen; fixup per-screen config colors the same way. diff mostly from oga@, with a bit harsher reaction to the state of screen_ctx. "please commit" oga@ --- conf.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 72a439f..b07a3de 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.71 2009/12/07 19:42:59 okan Exp $ + * $Id: conf.c,v 1.72 2009/12/08 16:52:17 okan Exp $ */ #include "headers.h" @@ -51,23 +51,16 @@ conf_cmd_add(struct conf *c, char *image, char *label, int flags) } void -conf_font(struct conf *c) +conf_font(struct conf *c, struct screen_ctx *sc) { - struct screen_ctx *sc; - - sc = screen_current(); - - c->DefaultFont = font_make(sc, c->DefaultFontName); - c->FontHeight = font_ascent() + font_descent() + 1; + sc->font = font_make(sc, c->DefaultFontName); + sc->fontheight = font_ascent(sc) + font_descent(sc) + 1; } void -conf_color(struct conf *c) +conf_color(struct conf *c, struct screen_ctx *sc) { - struct screen_ctx *sc; - int i; - - sc = screen_current(); + int i; for (i = 0; i < CWM_COLOR_MAX; i++) { xu_freecolor(sc, sc->color[i].pixel); @@ -78,6 +71,7 @@ conf_color(struct conf *c) void conf_reload(struct conf *c) { + struct screen_ctx *sc; struct client_ctx *cc; if (parse_config(c->conf_path, c) == -1) { @@ -85,10 +79,12 @@ conf_reload(struct conf *c) return; } - conf_color(c); TAILQ_FOREACH(cc, &Clientq, entry) client_draw_border(cc); - conf_font(c); + TAILQ_FOREACH(sc, &Screenq, entry) { + conf_color(c, sc); + conf_font(c, sc); + } } static struct { -- cgit v1.2.3-2-gb3c3