dwm-meillo

diff client.c @ 734:6283adb1fcf2

replaced getproto with a saner function, now old-school artifacts of WM times in the early 90s completely disappeared, no punned pointer warning anymore ;)
author Anselm R. Garbe <arg@suckless.org>
date Wed, 07 Feb 2007 12:37:06 +0100
parents 1950833a5614
children
line diff
     1.1 --- a/client.c	Tue Feb 06 15:29:19 2007 +0100
     1.2 +++ b/client.c	Wed Feb 07 12:37:06 2007 +0100
     1.3 @@ -120,11 +120,26 @@
     1.4  	return NULL;
     1.5  }
     1.6  
     1.7 +Bool
     1.8 +isprotodel(Client *c) {
     1.9 +	int i, n;
    1.10 +	Atom *protocols;
    1.11 +	Bool ret = False;
    1.12 +
    1.13 +	if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
    1.14 +		for(i = 0; !ret && i < n; i++)
    1.15 +			if(protocols[i] == wmatom[WMDelete])
    1.16 +				ret = True;
    1.17 +		XFree(protocols);
    1.18 +	}
    1.19 +	return ret;
    1.20 +}
    1.21 +
    1.22  void
    1.23  killclient(Arg *arg) {
    1.24  	if(!sel)
    1.25  		return;
    1.26 -	if(sel->proto & PROTODELWIN)
    1.27 +	if(isprotodel(sel))
    1.28  		sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
    1.29  	else
    1.30  		XKillClient(dpy, sel->win);
    1.31 @@ -159,7 +174,6 @@
    1.32  			c->y = way;
    1.33  	}
    1.34  	updatesizehints(c);
    1.35 -	c->proto = getproto(c->win);
    1.36  	XSelectInput(dpy, c->win,
    1.37  		StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
    1.38  	XGetTransientForHint(dpy, c->win, &trans);