[hackers] [dwm] added isdestroyed flag to unmanage || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Tue, 8 Sep 2009 12:13:07 +0000 (UTC)

changeset: 1485:3cde8e2dc511
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Tue Sep 08 13:13:03 2009 +0100
files: dwm.c
description:
added isdestroyed flag to unmanage

diff -r 487ed0f2e51d -r 3cde8e2dc511 dwm.c
--- a/dwm.c Mon Sep 07 11:46:02 2009 +0200
+++ b/dwm.c Tue Sep 08 13:13:03 2009 +0100
@@ -218,7 +218,7 @@
 static void toggletag(const Arg *arg);
 static void toggleview(const Arg *arg);
 static void unfocus(Client *c);
-static void unmanage(Client *c);
+static void unmanage(Client *c, Bool isdestroyed);
 static void unmapnotify(XEvent *e);
 static void updategeom(void);
 static void updatebarpos(Monitor *m);
@@ -466,7 +466,7 @@
         selmon->lt[selmon->sellt] = &foo;
         for(m = mons; m; m = m->next)
                 while(m->stack)
- unmanage(m->stack);
+ unmanage(m->stack, False);
         if(dc.font.set)
                 XFreeFontSet(dpy, dc.font.set);
         else
@@ -595,7 +595,7 @@
         XDestroyWindowEvent *ev = &e->xdestroywindow;
 
         if((c = wintoclient(ev->window)))
- unmanage(c);
+ unmanage(c, True);
 }
 
 void
@@ -1626,24 +1626,25 @@
 }
 
 void
-unmanage(Client *c) {
+unmanage(Client *c, Bool isdestroyed) {
         XWindowChanges wc;
 
- wc.border_width = c->oldbw;
         /* The server grab construct avoids race conditions. */
- XGrabServer(dpy);
- XSetErrorHandler(xerrordummy);
- XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
         detach(c);
         detachstack(c);
- XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
- setclientstate(c, WithdrawnState);
+ if(!isdestroyed) {
+ wc.border_width = c->oldbw;
+ XGrabServer(dpy);
+ XSetErrorHandler(xerrordummy);
+ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
+ XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+ setclientstate(c, WithdrawnState);
+ XSync(dpy, False);
+ XSetErrorHandler(xerror);
+ XUngrabServer(dpy);
+ }
         free(c);
- XSync(dpy, False);
- XSetErrorHandler(xerror);
- XUngrabServer(dpy);
         focus(NULL);
- arrange();
 }
 
 void
@@ -1652,7 +1653,7 @@
         XUnmapEvent *ev = &e->xunmap;
 
         if((c = wintoclient(ev->window)))
- unmanage(c);
+ unmanage(c, False);
 }
 
 void
Received on Tue Sep 08 2009 - 12:13:07 UTC

This archive was generated by hypermail 2.2.0 : Tue Sep 08 2009 - 12:24:05 UTC