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)
|
fifo_parse(char *cmd)
|
||||||
{
|
{
|
||||||
void (*func)(Uicb);
|
void (*func)(Uicb);
|
||||||
char *p = NULL, *arg;
|
char *p = NULL, *arg = NULL;
|
||||||
|
|
||||||
/* remove trailing newline */
|
/* remove trailing newline */
|
||||||
if((p = strchr(cmd, '\n')))
|
if((p = strchr(cmd, '\n')))
|
||||||
@ -42,10 +42,10 @@ fifo_parse(char *cmd)
|
|||||||
|
|
||||||
/* If an argument is present, delimit function string */
|
/* If an argument is present, delimit function string */
|
||||||
if((p = strchr(cmd, ' ')))
|
if((p = strchr(cmd, ' ')))
|
||||||
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
arg = p + 1;
|
||||||
/* Avoid pointer out of bound if no arg */
|
}
|
||||||
arg = ((p + 1 == 1) ? NULL : p + 1);
|
|
||||||
|
|
||||||
/* call the UICB function, p + 1 is command or NULL */
|
/* call the UICB function, p + 1 is command or NULL */
|
||||||
if((func = uicb_name_func(cmd)))
|
if((func = uicb_name_func(cmd)))
|
||||||
|
|||||||
@ -40,7 +40,7 @@ infobar_elem_tag_init(struct element *e)
|
|||||||
int s, j;
|
int s, j;
|
||||||
|
|
||||||
/* Get final size before to use in placement */
|
/* 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)
|
TAILQ_FOREACH(t, &e->infobar->screen->tags, next)
|
||||||
e->geo.w += draw_textw(e->infobar->theme, t->name) + PAD;
|
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;
|
e->geo.h = e->infobar->geo.h;
|
||||||
|
|
||||||
if(e->align == Left)
|
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
|
else
|
||||||
e->geo.x = ((p = TAILQ_NEXT(e, next))
|
e->geo.x = ((p = TAILQ_NEXT(e, next))
|
||||||
? p->geo.x - e->geo.w
|
? 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 infobar *ib;
|
||||||
struct screen *s;
|
struct screen *s;
|
||||||
int i = 0;
|
char *p;
|
||||||
char si[128] = { 0 };
|
|
||||||
|
|
||||||
if(!cmd)
|
if(!cmd || !(p = strchr(cmd, ' ')))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get infobar name */
|
/* Get infobar name & status */
|
||||||
while(cmd[i] && cmd[i] != ' ')
|
*p = '\0';
|
||||||
si[i] = cmd[i++];
|
++p;
|
||||||
++i;
|
|
||||||
|
|
||||||
SLIST_FOREACH(s, &W->h.screen, next)
|
SLIST_FOREACH(s, &W->h.screen, next)
|
||||||
{
|
{
|
||||||
SLIST_FOREACH(ib, &s->infobars, next)
|
SLIST_FOREACH(ib, &s->infobars, next)
|
||||||
if(!strcmp(si, ib->name))
|
if(!strcmp(cmd, ib->name))
|
||||||
{
|
{
|
||||||
free(ib->status);
|
free(ib->status);
|
||||||
ib->status = xstrdup(cmd + i);
|
ib->status = xstrdup(p);
|
||||||
infobar_elem_screen_update(s, ElemStatus);
|
infobar_elem_screen_update(s, ElemStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user