about summary refs log tree commit diff stats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-07 12:37:06 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-07 12:37:06 +0100
commit28ffff801bb0137ec3fe4093afc4fb29784b17ec (patch)
tree2072e2465fb0b3cbf4f3241a096de99752e79be1 /client.c
parent44ef3f5a07753ecaeacc2fb180e90bf4479ab975 (diff)
downloaddwm-28ffff801bb0137ec3fe4093afc4fb29784b17ec.tar.gz
replaced getproto with a saner function, now old-school artifacts of WM times in the early 90s completely disappeared, no punned pointer warning anymore ;)
Diffstat (limited to 'client.c')
-rw-r--r--client.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/client.c b/client.c
index 50e8a94..e37b9e6 100644
--- a/client.c
+++ b/client.c
@@ -120,11 +120,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 +174,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);