From f6aa4602b88478c1e947f4e7add29dfb36584d41 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 15 Apr 2009 14:01:45 +0000 Subject: properly teardown X connection upon quit; static a few while here, requested by oga@ ok oga@ sometime ago --- calmwm.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'calmwm.c') diff --git a/calmwm.c b/calmwm.c index 953faab..a23e726 100644 --- a/calmwm.c +++ b/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.35 2009/01/27 02:16:20 okan Exp $ + * $Id: calmwm.c,v 1.36 2009/04/15 14:01:45 okan Exp $ */ #include "headers.h" @@ -40,6 +40,9 @@ struct conf Conf; static void _sigchld_cb(int); static void dpy_init(const char *); +static void x_setup(void); +static void x_setupscreen(struct screen_ctx *, u_int); +static void x_teardown(void); int main(int argc, char **argv) @@ -97,6 +100,8 @@ main(int argc, char **argv) xev_loop(); + x_teardown(); + return (0); } @@ -143,6 +148,17 @@ x_setup(void) Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow); } +void +x_teardown(void) +{ + struct screen_ctx *sc; + + TAILQ_FOREACH(sc, &Screenq, entry) + XFreeGC(X_Dpy, sc->gc); + + XCloseDisplay(X_Dpy); +} + void x_setupscreen(struct screen_ctx *sc, u_int which) { -- cgit v1.2.3-2-gb3c3