Fix status & fifo parse and taglist width with border
This commit is contained in:
parent
7924fd8269
commit
2a47c21c01
@ -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)))
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ infobar_elem_placement(struct element *e)
|
||||
e->geo.h = e->infobar->geo.h;
|
||||
|
||||
if(e->align == Left)
|
||||
e->geo.x = (p ? p->geo.x + p->geo.w: 0);
|
||||
e->geo.x = (p ? p->geo.x + p->geo.w : 0);
|
||||
else
|
||||
e->geo.x = ((p = TAILQ_NEXT(e, next))
|
||||
? p->geo.x - e->geo.w
|
||||
|
||||
16
src/status.c
16
src/status.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user