Fix status & fifo parse and taglist width with border

This commit is contained in:
Martin Duquesnoy 2012-01-07 11:02:08 +01:00
parent 7924fd8269
commit 2a47c21c01
4 changed files with 13 additions and 15 deletions

View File

@ -34,7 +34,7 @@ static void
fifo_parse(char *cmd)
{
void (*func)(Uicb);
char *p = NULL, *arg;
char *p = NULL, *arg = NULL;
/* remove trailing newline */
if((p = strchr(cmd, '\n')))
@ -42,10 +42,10 @@ fifo_parse(char *cmd)
/* If an argument is present, delimit function string */
if((p = strchr(cmd, ' ')))
{
*p = '\0';
/* Avoid pointer out of bound if no arg */
arg = ((p + 1 == 1) ? NULL : p + 1);
arg = p + 1;
}
/* call the UICB function, p + 1 is command or NULL */
if((func = uicb_name_func(cmd)))

View File

@ -40,7 +40,7 @@ infobar_elem_tag_init(struct element *e)
int s, j;
/* Get final size before to use in placement */
e->geo.w = 0;
e->geo.w = e->infobar->theme->tags_border_width << 1;
TAILQ_FOREACH(t, &e->infobar->screen->tags, next)
e->geo.w += draw_textw(e->infobar->theme, t->name) + PAD;

View File

@ -31,24 +31,22 @@ uicb_status(Uicb cmd)
{
struct infobar *ib;
struct screen *s;
int i = 0;
char si[128] = { 0 };
char *p;
if(!cmd)
if(!cmd || !(p = strchr(cmd, ' ')))
return;
/* Get infobar name */
while(cmd[i] && cmd[i] != ' ')
si[i] = cmd[i++];
++i;
/* Get infobar name & status */
*p = '\0';
++p;
SLIST_FOREACH(s, &W->h.screen, next)
{
SLIST_FOREACH(ib, &s->infobars, next)
if(!strcmp(si, ib->name))
if(!strcmp(cmd, ib->name))
{
free(ib->status);
ib->status = xstrdup(cmd + i);
ib->status = xstrdup(p);
infobar_elem_screen_update(s, ElemStatus);
}
}