From e4e1ceec387038b7b8a1edfb93f7912a63444ca8 Mon Sep 17 00:00:00 2001 From: o9000 Date: Tue, 5 May 2015 23:32:18 +0200 Subject: [PATCH] Started work on spacer item --- src/panel.c | 10 ++++++++++ src/util/area.c | 3 +++ src/util/area.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/panel.c b/src/panel.c index cb2210e..974cc58 100644 --- a/src/panel.c +++ b/src/panel.c @@ -505,6 +505,16 @@ void set_panel_items_order(Panel *p) } if (panel_items_order[k] == 'C') p->area.list = g_slist_append(p->area.list, &p->clock); + if (panel_items_order[k] == 'F') { + Area *spacer = calloc(sizeof(Area), 1); + spacer->panel = p; + spacer->parent = p; + spacer->bg = &g_array_index(backgrounds, Background, 0); + spacer->on_screen = 1; + spacer->size_mode = SIZE_BY_LAYOUT; + spacer->gc = 1; + p->area.list = g_slist_append(p->area.list, spacer); + } } init_rendering(&p->area, 0); } diff --git a/src/util/area.c b/src/util/area.c index 20af792..e5be69a 100644 --- a/src/util/area.c +++ b/src/util/area.c @@ -277,6 +277,7 @@ int resize_by_layout(void *obj, int maximum_size) } else { // detect free size for SIZE_BY_LAYOUT's Area + // TODO the spacer should collapse when the other areas are overflowing size = a->height - (2 * (a->paddingxlr + a->bg->border.width)); GSList *l; for (l = a->list ; l ; l = l->next) { @@ -471,6 +472,8 @@ void free_area (Area *a) XFreePixmap (server.dsp, a->pix); a->pix = 0; } + if (a->gc) + free(a); } diff --git a/src/util/area.h b/src/util/area.h index da437aa..1e60167 100644 --- a/src/util/area.h +++ b/src/util/area.h @@ -72,6 +72,7 @@ typedef struct { int resize; // need redraw Pixmap int redraw; + int gc; // paddingxlr = horizontal padding left/right // paddingx = horizontal padding between childs int paddingxlr, paddingx, paddingy;