From afe32e27f0252d446ba1ca13a179290ea1dddec3 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 22 Dec 2007 16:49:21 +0100 Subject: [PATCH] renders right widget from last to first --- statusbar.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/statusbar.c b/statusbar.c index 20cd3bb4..07e169b6 100644 --- a/statusbar.c +++ b/statusbar.c @@ -37,7 +37,7 @@ statusbar_draw(int screen) { int phys_screen = get_phys_screen(screen); VirtScreen vscreen; - Widget *widget; + Widget *widget, *last_drawn = NULL; int left = 0, right = 0; vscreen = globalconf.screens[screen]; @@ -58,8 +58,15 @@ statusbar_draw(int screen) for(widget = vscreen.statusbar->widgets; widget; widget = widget->next) if (widget->alignment == AlignLeft) left += widget->draw(widget, ctx, left, (left + right)); - else if (widget->alignment == AlignRight) + + /* renders right widget from last to first */ + for(widget = vscreen.statusbar->widgets; widget; widget = widget->next) + if (widget->alignment == AlignRight && last_drawn == widget->next) + { right += widget->draw(widget, ctx, right, (left + right)); + last_drawn = widget; + widget = vscreen.statusbar->widgets; + } for(widget = vscreen.statusbar->widgets; widget; widget = widget->next) if (widget->alignment == AlignFlex)