Add uicb_infobar_toggle_hide (Closes #18)

This commit is contained in:
David Delassus 2012-05-03 14:25:34 +02:00
parent 9d9460bfc0
commit 10089601c1
5 changed files with 55 additions and 1 deletions

View File

@ -211,4 +211,13 @@ client_get_larger(struct tag *t, bool ignoring_tag)
return lc; return lc;
} }
static inline void
clients_layout_refresh(void)
{
struct client *c;
SLIST_FOREACH(c, &W->h.client, next)
layout_fix_hole(c);
}
#endif /* CLIENT_H */ #endif /* CLIENT_H */

View File

@ -88,6 +88,9 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
{ "status" , uicb_status }, { "status" , uicb_status },
{ "status_surface", uicb_status_surface }, { "status_surface", uicb_status_surface },
/* Infobar */
{ "infobar_toggle_hide", uicb_infobar_toggle_hide },
/* Mouse */ /* Mouse */
{ "mouse_resize", uicb_mouse_resize }, { "mouse_resize", uicb_mouse_resize },
{ "mouse_move", uicb_mouse_move }, { "mouse_move", uicb_mouse_move },

View File

@ -515,8 +515,48 @@ infobar_free(struct screen *s)
} }
} }
void
uicb_infobar_toggle_hide(Uicb iname)
{
struct infobar *i;
if (iname)
i = infobar_gb_name(iname);
else
i = SLIST_FIRST(&W->screen->infobars);
if(i->pos == BarHide)
{
i->pos = i->opos;
if(infobar_placement(i, i->pos))
{
barwin_map(i->bar);
barwin_map_subwin(i->bar);
barwin_refresh_color(i->bar);
infobar_refresh(i);
}
}
else
{
i->opos = i->pos;
i->pos = BarHide;
barwin_unmap_subwin(i->bar);
barwin_unmap(i->bar);
switch(i->opos)
{
case BarTop:
i->screen->ugeo.y -= i->geo.h;
case BarBottom:
i->screen->ugeo.h += i->geo.h;
case BarHide:
default:
break;
}
}
clients_layout_refresh();
}

View File

@ -88,4 +88,6 @@ infobar_gb_name(const char *name)
return SLIST_FIRST(&s->infobars); return SLIST_FIRST(&s->infobars);
} }
void uicb_infobar_toggle_hide(Uicb iname);
#endif /* INFOBAR_H */ #endif /* INFOBAR_H */

View File

@ -151,7 +151,7 @@ struct infobar
struct screen *screen; struct screen *screen;
struct theme *theme; struct theme *theme;
struct status_ctx statusctx; struct status_ctx statusctx;
enum barpos pos; enum barpos opos, pos;
char *elemorder; char *elemorder;
char *name; char *name;
TAILQ_HEAD(esub, element) elements; TAILQ_HEAD(esub, element) elements;