rem: for (i = 0; i < box->subviewCount; i++) { if (box->horizontal) { w = box->subviews[i].minSize; if (box->subviews[i].expand) w += total/expands; } else { h = box->subviews[i].minSize; if (box->subviews[i].expand) h += total/expands; } if (!box->subviews[i].end) { W_MoveView(box->subviews[i].view, x, y); } W_ResizeView(box->subviews[i].view, w, h); if (box->horizontal) { if (box->subviews[i].end) xe -= w + box->subviews[i].space; else x += w + box->subviews[i].space; } else { if (box->subviews[i].end) ye -= h + box->subviews[i].space; else y += h + box->subviews[i].space; } if (box->subviews[i].end) { W_MoveView(box->subviews[i].view, xe, ye); } }
add: WMMapArray(box->subviews, computeExpansion, &eData); WMMapArray(box->subviews, doRearrange, &eData);
context: rearrange(WMBox *box){    int i;    int x, y;    int xe, ye;    int w = 1, h = 1;    int total;    int expands = 0;        x = box->borderWidth;    y = box->borderWidth;        if (box->horizontal) {	ye = box->borderWidth;	xe = WMWidgetWidth(box) - box->borderWidth;	h = WMWidgetHeight(box) - 2 * box->borderWidth;	total = WMWidgetWidth(box) - 2 * box->borderWidth;    } else {	xe = box->borderWidth;	ye = WMWidgetHeight(box) - box->borderWidth;		w = WMWidgetWidth(box) - 2 * box->borderWidth;	total = WMWidgetHeight(box) - 2 * box->borderWidth;    }    if (w <= 0 || h <= 0 || total <= 0) {	return;    }	    for (i = 0; i < box->subviewCount; i++) {	total -= box->subviews[i].minSize;	total -= box->subviews[i].space;	if (box->subviews[i].expand) {	    expands++;	}    }    for (i = 0; i < box->subviewCount; i++) {	if (box->horizontal) {	    w = box->subviews[i].minSize;	    if (box->subviews[i].expand)		w += total/expands;	} else {	    h = box->subviews[i].minSize;	    if (box->subviews[i].expand)		h += total/expands;	}	if (!box->subviews[i].end) {	    W_MoveView(box->subviews[i].view, x, y);	}	W_ResizeView(box->subviews[i].view, w, h);	if (box->horizontal) {	    if (box->subviews[i].end)		xe -= w + box->subviews[i].space;	    else		x += w + box->subviews[i].space;	} else {	    if (box->subviews[i].end)		ye -= h + box->subviews[i].space;	    else		y += h + box->subviews[i].space;	}	if (box->subviews[i].end) {	    W_MoveView(box->subviews[i].view, xe, ye);	}    }}