aboutsummaryrefslogtreecommitdiff
path: root/src/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw.c')
-rw-r--r--src/draw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/draw.c b/src/draw.c
index 992cd60..fa59b0e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -260,6 +260,8 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns)
draw->layouts = g_list_reverse(draw->layouts);
+ // FIXME: BUG! Explodes if the buttons are not loaded with the left first!!!
+
int layout_width[3] = {
layout_end[PANGO_ALIGN_LEFT],
layout_end[PANGO_ALIGN_CENTER] - layout_end[PANGO_ALIGN_LEFT],
@@ -274,7 +276,7 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns)
int center_off = center - round(layout_width[PANGO_ALIGN_CENTER] / 2) - layout_end[PANGO_ALIGN_LEFT];
log_debug("Aligning center layout [center=%d, off=%d]", center, center_off);
- for (GList *it = layout_start[PANGO_ALIGN_CENTER]; it != layout_start[PANGO_ALIGN_RIGHT]; it = it->next) {
+ for (GList *it = layout_start[PANGO_ALIGN_CENTER]; it != NULL && it != layout_start[PANGO_ALIGN_RIGHT]; it = it->next) {
Layout *layout = it->data;
layout->x += center_off;
}