From bf20f9cee9453d00c26552fca6c1cfede89ed82b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 15 Dec 2007 13:37:34 +0100 Subject: [PATCH] rework widget.c --- widget.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/widget.c b/widget.c index 41f9de9a5..fe4b7ed7c 100644 --- a/widget.c +++ b/widget.c @@ -1,25 +1,21 @@ - #include "widget.h" - void calculate_alignments(Widget *widget) { - while (widget){ - printf("%s\n", widget->name); - if (widget->alignment == AlignFlex){ + for(; widget; widget = widget->next) + { + if(widget->alignment == AlignFlex) + { widget = widget->next; break; } widget->alignment = AlignLeft; - widget = widget->next; } - if (widget){ - while (widget){ + + if(widget) + for(; widget; widget = widget->next) widget->alignment = AlignRight; - widget = widget->next; - } - } } int @@ -27,8 +23,8 @@ calculate_offset(int barwidth, int widgetwidth, int offset, int alignment) { if (alignment == AlignLeft || alignment == AlignFlex) return offset; - else - return barwidth - offset - widgetwidth; + + return barwidth - offset - widgetwidth; } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99