Fix warning with -Wall
This commit is contained in:
parent
f04bfc1f39
commit
4908e4b183
@ -45,6 +45,8 @@ barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool e
|
|||||||
b->bg = bg;
|
b->bg = bg;
|
||||||
b->fg = fg;
|
b->fg = fg;
|
||||||
|
|
||||||
|
SLIST_INIT(&b->mousebinds);
|
||||||
|
|
||||||
/* Attach */
|
/* Attach */
|
||||||
SLIST_INSERT_HEAD(&W->h.barwin, b, next);
|
SLIST_INSERT_HEAD(&W->h.barwin, b, next);
|
||||||
|
|
||||||
@ -63,6 +65,9 @@ barwin_remove(Barwin *b)
|
|||||||
XDestroyWindow(W->dpy, b->win);
|
XDestroyWindow(W->dpy, b->win);
|
||||||
XFreePixmap(W->dpy, b->dr);
|
XFreePixmap(W->dpy, b->dr);
|
||||||
|
|
||||||
|
/* Free mousebinds */
|
||||||
|
FREE_LIST(b->mousebinds, Mousebind);
|
||||||
|
|
||||||
free(b);
|
free(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +90,21 @@ barwin_resize(Barwin *b, int w, int h)
|
|||||||
XResizeWindow(W->dpy, b->win, w, h);
|
XResizeWindow(W->dpy, b->win, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
barwin_mousebind_new(Barwin *b, unsigned int button, bool u, Geo a, void (*func)(Uicb), Uicb cmd)
|
||||||
|
{
|
||||||
|
Mousebind *m;
|
||||||
|
|
||||||
|
m = xcalloc(1, sizeof(Mousebind));
|
||||||
|
|
||||||
|
m->button = button;
|
||||||
|
m->use_area = u;
|
||||||
|
m->area = a;
|
||||||
|
m->func = func;
|
||||||
|
m->cmd = cmd;
|
||||||
|
|
||||||
|
SLIST_INSERT_HEAD(&b->mousebinds, m, next):
|
||||||
|
}
|
||||||
|
|
||||||
/** Refresh the Barwin Color
|
/** Refresh the Barwin Color
|
||||||
* \param bw Barwin pointer
|
* \param bw Barwin pointer
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
Barwin* barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask);
|
Barwin* barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask);
|
||||||
void barwin_remove(Barwin *b);
|
void barwin_remove(Barwin *b);
|
||||||
void barwin_resize(Barwin *b, int w, int h);
|
void barwin_resize(Barwin *b, int w, int h);
|
||||||
|
void barwin_mousebind_new(Barwin *b, unsigned int button, bool u, Geo a, void (*func)(Uicb), Uicb cmd)
|
||||||
void barwin_refresh_color(Barwin *b);
|
void barwin_refresh_color(Barwin *b);
|
||||||
|
|
||||||
#endif /* BARWIN_H */
|
#endif /* BARWIN_H */
|
||||||
|
|||||||
@ -19,6 +19,7 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
|
|||||||
/* Sys */
|
/* Sys */
|
||||||
{ "spawn", uicb_spawn },
|
{ "spawn", uicb_spawn },
|
||||||
{ "quit", uicb_quit },
|
{ "quit", uicb_quit },
|
||||||
|
{ "reload", uicb_reload },
|
||||||
|
|
||||||
/* Tag */
|
/* Tag */
|
||||||
{ "tag_set", uicb_tag_set },
|
{ "tag_set", uicb_tag_set },
|
||||||
|
|||||||
@ -110,6 +110,8 @@ infobar_elem_init(Infobar *i)
|
|||||||
Element *e;
|
Element *e;
|
||||||
int n, j;
|
int n, j;
|
||||||
|
|
||||||
|
TAILQ_INIT(&i->elements);
|
||||||
|
|
||||||
for(n = 0; n < strlen(i->elemorder); ++n)
|
for(n = 0; n < strlen(i->elemorder); ++n)
|
||||||
{
|
{
|
||||||
for(j = 0; j < LEN(elem_funcs); ++j)
|
for(j = 0; j < LEN(elem_funcs); ++j)
|
||||||
@ -170,7 +172,6 @@ infobar_init(void)
|
|||||||
|
|
||||||
i->screen = s;
|
i->screen = s;
|
||||||
i->elemorder = xstrdup(ELEM_DEFAULT_ORDER);
|
i->elemorder = xstrdup(ELEM_DEFAULT_ORDER);
|
||||||
TAILQ_INIT(&i->elements);
|
|
||||||
|
|
||||||
/* Positions TODO: geo = infobar_position(Position {Top,Bottom,Hidden}) */
|
/* Positions TODO: geo = infobar_position(Position {Top,Bottom,Hidden}) */
|
||||||
i->geo = s->geo;
|
i->geo = s->geo;
|
||||||
@ -184,7 +185,9 @@ infobar_init(void)
|
|||||||
barwin_map_subwin(i->bar);
|
barwin_map_subwin(i->bar);
|
||||||
barwin_refresh_color(i->bar);
|
barwin_refresh_color(i->bar);
|
||||||
|
|
||||||
|
/* Elements */
|
||||||
infobar_elem_init(i);
|
infobar_elem_init(i);
|
||||||
|
|
||||||
infobar_refresh(i);
|
infobar_refresh(i);
|
||||||
|
|
||||||
SLIST_INSERT_HEAD(&s->infobars, i, next);
|
SLIST_INSERT_HEAD(&s->infobars, i, next);
|
||||||
@ -194,10 +197,6 @@ infobar_init(void)
|
|||||||
void
|
void
|
||||||
infobar_refresh(Infobar *i)
|
infobar_refresh(Infobar *i)
|
||||||
{
|
{
|
||||||
draw_text(i->bar->dr, 0, TEXTY(INFOBAR_DEF_W), 0x005500, "|");
|
|
||||||
|
|
||||||
i->elemupdate |= FLAGINT(ElemTag);
|
|
||||||
|
|
||||||
infobar_elem_update(i);
|
infobar_elem_update(i);
|
||||||
|
|
||||||
barwin_refresh(i->bar);
|
barwin_refresh(i->bar);
|
||||||
|
|||||||
@ -245,6 +245,7 @@ wmfs_quit(void)
|
|||||||
XCloseDisplay(W->dpy);
|
XCloseDisplay(W->dpy);
|
||||||
|
|
||||||
free(W->net_atom);
|
free(W->net_atom);
|
||||||
|
free(W->argv);
|
||||||
free(W);
|
free(W);
|
||||||
|
|
||||||
/* Conf stuffs */
|
/* Conf stuffs */
|
||||||
@ -253,6 +254,22 @@ wmfs_quit(void)
|
|||||||
W->running = false;
|
W->running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Reload WMFS binary
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
uicb_reload(Uicb cmd)
|
||||||
|
{
|
||||||
|
(void)cmd;
|
||||||
|
char *command = xstrdup(W->argv[0]);
|
||||||
|
char **argv = W->argv;
|
||||||
|
|
||||||
|
wmfs_quit();
|
||||||
|
|
||||||
|
for(; command[0] && command[0] == ' '; ++command[0]);
|
||||||
|
|
||||||
|
execvp(command, argv);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uicb_quit(Uicb cmd)
|
uicb_quit(Uicb cmd)
|
||||||
{
|
{
|
||||||
@ -265,6 +282,8 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
W = (struct Wmfs*)xcalloc(1, sizeof(struct Wmfs));
|
W = (struct Wmfs*)xcalloc(1, sizeof(struct Wmfs));
|
||||||
|
|
||||||
|
W->argv = argv;
|
||||||
|
|
||||||
/* Get X display */
|
/* Get X display */
|
||||||
if(!(W->dpy = XOpenDisplay(NULL)))
|
if(!(W->dpy = XOpenDisplay(NULL)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -58,7 +58,7 @@ struct Barwin
|
|||||||
Geo geo;
|
Geo geo;
|
||||||
Flags flags;
|
Flags flags;
|
||||||
void *ptr; /* Special cases */
|
void *ptr; /* Special cases */
|
||||||
SLIST_HEAD(, MouseBind) mousebinds;
|
SLIST_HEAD(, Mousebind) mousebinds;
|
||||||
SLIST_ENTRY(Barwin) next;
|
SLIST_ENTRY(Barwin) next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,6 +161,7 @@ struct Wmfs
|
|||||||
Flags numlockmask;
|
Flags numlockmask;
|
||||||
GC gc;
|
GC gc;
|
||||||
Atom *net_atom;
|
Atom *net_atom;
|
||||||
|
char **argv;
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
@ -190,6 +191,7 @@ int wmfs_error_handler(Display *d, XErrorEvent *event);
|
|||||||
int wmfs_error_handler_dummy(Display *d, XErrorEvent *event);
|
int wmfs_error_handler_dummy(Display *d, XErrorEvent *event);
|
||||||
void wmfs_grab_keys(void);
|
void wmfs_grab_keys(void);
|
||||||
void wmfs_quit(void);
|
void wmfs_quit(void);
|
||||||
|
void uicb_reload(Uicb cmd);
|
||||||
void uicb_quit(Uicb cmd);
|
void uicb_quit(Uicb cmd);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user