Use global head for mousebind to free all at quit()
This commit is contained in:
parent
f5f574b6bd
commit
dbac129bf9
17
src/barwin.c
17
src/barwin.c
@ -70,9 +70,6 @@ barwin_remove(struct barwin *b)
|
||||
XDestroyWindow(W->dpy, b->win);
|
||||
XFreePixmap(W->dpy, b->dr);
|
||||
|
||||
/* Free mousebinds */
|
||||
FREE_LIST(mousebind, b->mousebinds);
|
||||
|
||||
free(b);
|
||||
}
|
||||
|
||||
@ -95,20 +92,6 @@ barwin_resize(struct barwin *b, int w, int h)
|
||||
XResizeWindow(W->dpy, b->win, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
barwin_mousebind_new(struct barwin *b, unsigned int button, bool u, struct geo a, void (*func)(Uicb), Uicb cmd)
|
||||
{
|
||||
struct mousebind *m = (struct mousebind*)xcalloc(1, sizeof(struct 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
|
||||
* \param bw barwin pointer
|
||||
*/
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
struct barwin* barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool entermask);
|
||||
void barwin_remove(struct barwin *b);
|
||||
void barwin_resize(struct barwin *b, int w, int h);
|
||||
void barwin_mousebind_new(struct barwin *b, unsigned int button, bool u, struct geo a, void (*func)(Uicb), Uicb cmd);
|
||||
void barwin_refresh_color(struct barwin *b);
|
||||
|
||||
#endif /* BARWIN_H */
|
||||
|
||||
@ -25,10 +25,11 @@ config_mouse_section(struct mbhead *mousebinds, struct conf_sec **sec)
|
||||
|
||||
m->button = fetch_opt_first(sec[i], "1", "button").num;
|
||||
m->func = uicb_name_func(fetch_opt_first(sec[i], "", "func").str);
|
||||
m->cmd = fetch_opt_first(sec[i], "", "cmd").str;
|
||||
m->cmd = xstrdup(fetch_opt_first(sec[i], "", "cmd").str);
|
||||
m->use_area = false;
|
||||
|
||||
SLIST_INSERT_HEAD(mousebinds, m, next);
|
||||
SLIST_INSERT_HEAD(&W->h.mousebind, m, globnext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -133,14 +133,11 @@ mouse_move(struct client *c, void (*func)(struct client*, struct client*))
|
||||
} while(ev.type != ButtonRelease);
|
||||
|
||||
if(c2)
|
||||
{
|
||||
if(last == c2)
|
||||
_REV_SBORDER(c2);
|
||||
|
||||
func(c, c2);
|
||||
}
|
||||
else if(t && t != (struct tag*)c)
|
||||
tag_client(t, c);
|
||||
else
|
||||
_REV_SBORDER(c);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -391,6 +391,7 @@ wmfs_quit(void)
|
||||
struct rule *r;
|
||||
struct theme *t;
|
||||
struct client *c;
|
||||
struct mousebind *m;
|
||||
|
||||
/* Will free:
|
||||
*
|
||||
@ -439,6 +440,14 @@ wmfs_quit(void)
|
||||
free(k);
|
||||
}
|
||||
|
||||
while(!SLIST_EMPTY(&W->h.mousebind))
|
||||
{
|
||||
m = SLIST_FIRST(&W->h.mousebind);
|
||||
SLIST_REMOVE_HEAD(&W->h.mousebind, globnext);
|
||||
free((void*)m->cmd);
|
||||
free(m);
|
||||
}
|
||||
|
||||
/* FIFO stuffs */
|
||||
if(W->fifo.fd > 0)
|
||||
{
|
||||
|
||||
@ -214,6 +214,7 @@ struct mousebind
|
||||
Uicb cmd;
|
||||
SLIST_ENTRY(mousebind) next;
|
||||
SLIST_ENTRY(mousebind) snext;
|
||||
SLIST_ENTRY(mousebind) globnext;
|
||||
};
|
||||
|
||||
struct theme
|
||||
@ -297,6 +298,7 @@ struct wmfs
|
||||
SLIST_HEAD(, barwin) barwin;
|
||||
SLIST_HEAD(, theme) theme;
|
||||
SLIST_HEAD(, rule) rule;
|
||||
SLIST_HEAD(, mousebind) mousebind;
|
||||
} h;
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user