X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Futil%2Farea.c;h=460abd94e0f7ffc258c981f14ee2c317eefa2519;hb=9daa525aab5dfb62788865e4cbe4d92ddf055e93;hp=7455561b34e90e5f0862ac476ce794953531ab97;hpb=e7c43073246afe07cddf67d40d545f2bebcf62a1;p=chaz%2Ftint2 diff --git a/src/util/area.c b/src/util/area.c index 7455561..460abd9 100644 --- a/src/util/area.c +++ b/src/util/area.c @@ -68,15 +68,18 @@ * 'panel_items = SC' define a panel with just Systray and Clock. * So the tree 'Panel.Area' will have 2 childs (Systray and Clock). * - * 1) ok - * 2) ?? - * 3) ?? - * répartition entre niveau global et niveau local ?? - * size_by_content peut-il modifier redraw=1 en cas de changement ? ou est ce géré par chaque composant ? - * size_by_layout peut-il modifier redraw ? - * ************************************************************/ +void rendering(void *obj) +{ + Panel *panel = (Panel*)obj; + + size_by_content(&panel->area); + size_by_layout(&panel->area, 0, 0); + + refresh(&panel->area); +} + void size_by_content (Area *a) { @@ -94,16 +97,16 @@ void size_by_content (Area *a) if (a->_resize) { if (a->_resize(a)) { - // 'size' changed then 'resize = 1' on the parent + // 'size' changed => 'resize = 1' on the parent and redraw object ((Area*)a->parent)->resize = 1; + a->redraw = 1; } - a->redraw = 1; } } } -void size_by_layout (Area *a) +void size_by_layout (Area *a, int pos, int level) { // don't resize hiden objects if (!a->on_screen) return; @@ -125,8 +128,24 @@ void size_by_layout (Area *a) } } - for (l = a->list; l ; l = l->next) - size_by_layout(l->data); + // update position of childs + pos += a->paddingxlr + a->bg->border.width; + int i=0; + for (l = a->list; l ; l = l->next) { + Area *child = ((Area*)l->data); + i++; + + if (pos != child->posx) { + // pos changed => redraw + child->posx = pos; + child->redraw = 1; + } + //printf("level %d, object %d, pos %d\n", level, i, pos); + + size_by_layout(child, pos, level+1); + + pos += child->width + a->paddingx; + } }