JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
simplified configurerequest
[dwm.git] / client.c
index 50e8a94..b9c519b 100644 (file)
--- a/client.c
+++ b/client.c
@@ -69,19 +69,20 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
 
 void
 configure(Client *c) {
-       XEvent synev;
+       XConfigureEvent ce;
 
-       synev.type = ConfigureNotify;
-       synev.xconfigure.display = dpy;
-       synev.xconfigure.event = c->win;
-       synev.xconfigure.window = c->win;
-       synev.xconfigure.x = c->x;
-       synev.xconfigure.y = c->y;
-       synev.xconfigure.width = c->w;
-       synev.xconfigure.height = c->h;
-       synev.xconfigure.border_width = c->border;
-       synev.xconfigure.above = None;
-       XSendEvent(dpy, c->win, True, NoEventMask, &synev);
+       ce.type = ConfigureNotify;
+       ce.display = dpy;
+       ce.event = c->win;
+       ce.window = c->win;
+       ce.x = c->x;
+       ce.y = c->y;
+       ce.width = c->w;
+       ce.height = c->h;
+       ce.border_width = c->border;
+       ce.above = None;
+       ce.override_redirect = False;
+       XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
 }
 
 void
@@ -120,11 +121,26 @@ getclient(Window w) {
        return NULL;
 }
 
+Bool
+isprotodel(Client *c) {
+       int i, n;
+       Atom *protocols;
+       Bool ret = False;
+
+       if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
+               for(i = 0; !ret && i < n; i++)
+                       if(protocols[i] == wmatom[WMDelete])
+                               ret = True;
+               XFree(protocols);
+       }
+       return ret;
+}
+
 void
 killclient(Arg *arg) {
        if(!sel)
                return;
-       if(sel->proto & PROTODELWIN)
+       if(isprotodel(sel))
                sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
        else
                XKillClient(dpy, sel->win);
@@ -159,7 +175,6 @@ manage(Window w, XWindowAttributes *wa) {
                        c->y = way;
        }
        updatesizehints(c);
-       c->proto = getproto(c->win);
        XSelectInput(dpy, c->win,
                StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
        XGetTransientForHint(dpy, c->win, &trans);