[taglist] Fix taglist bugs in show_empty=false mode

Attached patch fixes the width allocation for the taglist (it stayed
the same size when it should've become smaller (FS#205)), as well as a
bug with mouse bindings when the first tag was empty and thus hidden.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Lucas de Vries 2008-06-07 21:54:25 +02:00 committed by Julien Danjou
parent 8ab1831ed6
commit 90088be534

View file

@ -154,7 +154,10 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
text[i] = tag_markup_parse(tag, text[i], a_strlen(text[i]));
*area = draw_text_extents(ctx->connection, ctx->phys_screen,
globalconf.font, text[i]);
w->area.width += area->width;
if (data->show_empty || tag->selected || tag_isoccupied(tag))
w->area.width += area->width;
area_list_append(&tda->area, area);
}
@ -219,7 +222,8 @@ taglist_button_press(widget_node_t *w,
if(ev->detail == b->button && CLEANMASK(ev->state) == b->mod && b->fct)
for(tag = vscreen->tags; tag && area; tag = tag->next, area = area->next)
if(ev->event_x >= AREA_LEFT(*area)
&& ev->event_x < AREA_RIGHT(*area))
&& ev->event_x < AREA_RIGHT(*area)
&& (data->show_empty || tag->selected || tag_isoccupied(tag)) )
{
luaA_pushpointer(object, type);
luaA_tag_userdata_new(tag);