aboutsummaryrefslogtreecommitdiffstats
path: root/calmwm.c
diff options
context:
space:
mode:
authorokan2014-01-22 22:14:02 +0000
committerokan2014-01-22 22:14:02 +0000
commit3e85f9a3607cbf9f9d517a86c43f367407edd93b (patch)
treee6aff86706465b5e224ff85c574077d38fe5b817 /calmwm.c
parentd86dc240a824ab0c88be47a7c951517b8a07fdde (diff)
downloadcwm-3e85f9a3607cbf9f9d517a86c43f367407edd93b.tar.gz
start properly releasing X resources during teardown
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/calmwm.c b/calmwm.c
index d476aa0..e5ef927 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.
*
- * $OpenBSD: calmwm.c,v 1.84 2014/01/22 21:48:27 okan Exp $
+ * $OpenBSD: calmwm.c,v 1.85 2014/01/22 22:14:02 okan Exp $
*/
#include <sys/param.h>
@@ -156,6 +156,25 @@ x_restart(void)
static void
x_teardown(void)
{
+ struct screen_ctx *sc;
+ unsigned int i;
+
+ TAILQ_FOREACH(sc, &Screenq, entry) {
+ for (i = 0; i < CWM_COLOR_NITEMS; i++)
+ XftColorFree(X_Dpy, sc->visual, sc->colormap,
+ &sc->xftcolor[i]);
+ XftDrawDestroy(sc->xftdraw);
+ XftFontClose(X_Dpy, sc->xftfont);
+ XUnmapWindow(X_Dpy, sc->menuwin);
+ XDestroyWindow(X_Dpy, sc->menuwin);
+ XUngrabKey(X_Dpy, AnyKey, AnyModifier, sc->rootwin);
+ }
+ XUngrabPointer(X_Dpy, CurrentTime);
+ XUngrabKeyboard(X_Dpy, CurrentTime);
+ for (i = 0; i < CF_NITEMS; i++)
+ XFreeCursor(X_Dpy, Conf.cursor[i]);
+ XSync(X_Dpy, False);
+ XSetInputFocus(X_Dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XCloseDisplay(X_Dpy);
}