about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c18
-rw-r--r--config.mk4
-rw-r--r--dwm.h7
-rw-r--r--event.c4
-rw-r--r--main.c18
5 files changed, 20 insertions, 31 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);
diff --git a/config.mk b/config.mk
index 338632d..2e5630a 100644
--- a/config.mk
+++ b/config.mk
@@ -17,8 +17,8 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
 # flags
 CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
 LDFLAGS = ${LIBS}
-#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
-#LDFLAGS = -g ${LIBS}
+CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
+LDFLAGS = -g ${LIBS}
 
 # Solaris
 #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
diff --git a/dwm.h b/dwm.h
index a7053c5..674ab1e 100644
--- a/dwm.h
+++ b/dwm.h
@@ -36,8 +36,6 @@
 
 /* mask shorthands, used in event.c and client.c */
 #define BUTTONMASK		(ButtonPressMask | ButtonReleaseMask)
-/* other stuff used in different places */
-#define PROTODELWIN		1
 
 enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMLast };	/* default atoms */
@@ -69,14 +67,13 @@ typedef struct {
 typedef struct Client Client;
 struct Client {
 	char name[256];
-	int proto;
 	int x, y, w, h;
 	int rx, ry, rw, rh; /* revert geometry */
 	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
 	int minax, minay, maxax, maxay;
 	long flags; 
 	unsigned int border;
-	Bool isfloat, isfixed, ismax;
+	Bool isfixed, isfloat, ismax;
 	Bool *tags;
 	Client *next;
 	Client *prev;
@@ -105,6 +102,7 @@ extern Window root, barwin;
 extern void configure(Client *c);		/* send synthetic configure event */
 extern void focus(Client *c);			/* focus c, c may be NULL */
 extern Client *getclient(Window w);		/* return client of w */
+extern Bool isprotodel(Client *c);		/* returns True if c->win supports wmatom[WMDelete] */
 extern void killclient(Arg *arg);		/* kill c nicely */
 extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
 extern void resize(Client *c, Bool sizehints);	/* resize c*/
@@ -123,7 +121,6 @@ extern void grabkeys(void);			/* grab all keys defined in config.h */
 extern void procevent(void);			/* process pending X events */
 
 /* main.c */
-extern int getproto(Window w);			/* return protocol mask of WMProtocols property of w */
 extern void quit(Arg *arg);			/* quit dwm nicely */
 extern void sendevent(Window w, Atom a, long value);	/* send synthetic event to w */
 extern int xerror(Display *dsply, XErrorEvent *ee);	/* dwm's X error handler */
diff --git a/event.c b/event.c
index 418e986..c66aa72 100644
--- a/event.c
+++ b/event.c
@@ -308,10 +308,6 @@ propertynotify(XEvent *e) {
 	if(ev->state == PropertyDelete)
 		return; /* ignore */
 	if((c = getclient(ev->window))) {
-		if(ev->atom == wmatom[WMProtocols]) {
-			c->proto = getproto(c->win);
-			return;
-		}
 		switch (ev->atom) {
 			default: break;
 			case XA_WM_TRANSIENT_FOR:
diff --git a/main.c b/main.c
index 97fdbaf..da95d95 100644
--- a/main.c
+++ b/main.c
@@ -172,24 +172,6 @@ xerrorstart(Display *dsply, XErrorEvent *ee) {
 
 /* extern */
 
-int
-getproto(Window w) {
-	int i, format, protos, status;
-	unsigned long extra, res;
-	Atom *protocols, real;
-
-	protos = 0;
-	status = XGetWindowProperty(dpy, w, wmatom[WMProtocols], 0L, 20L, False,
-			XA_ATOM, &real, &format, &res, &extra, (unsigned char **)&protocols);
-	if(status != Success || protocols == 0)
-		return protos;
-	for(i = 0; i < res; i++)
-		if(protocols[i] == wmatom[WMDelete])
-			protos |= PROTODELWIN;
-	free(protocols);
-	return protos;
-}
-
 void
 sendevent(Window w, Atom a, long value) {
 	XEvent e;
>
439e15d ^
1076f2b
bf35794 ^
1076f2b
439e15d ^
bf35794 ^
1076f2b
8af1d97 ^
c53980c ^
8b59083 ^
8b59083 ^


bf35794 ^

8b59083 ^

650a1fb ^
8b59083 ^
8b59083 ^


bf35794 ^


8b59083 ^

1076f2b
da2bbd3 ^

3399650 ^
58f2fe3 ^



a05beb6 ^
2e836ec ^

a05beb6 ^
901b3ed ^
1076f2b
efa7e51 ^
bf35794 ^

1076f2b

3aad922 ^



901b3ed ^
3aad922 ^

366d81e ^


c47da14 ^

366d81e ^

bf35794 ^

66da153 ^

bf35794 ^

efa7e51 ^
bf35794 ^




39677ec ^
439e15d ^
dba2306 ^
3399650 ^
adaa28a ^


dba2306 ^
adaa28a ^
c0705ee ^
adaa28a ^
dfd84f9 ^
adaa28a ^
dba2306 ^
0aaa9a2 ^
c53980c ^
58f2fe3 ^
adaa28a ^



3399650 ^
d7e1708 ^
dba2306 ^
c0705ee ^
adaa28a ^
c0705ee ^

9e8b325 ^
d7e1708 ^
dba2306 ^
29355bd ^
b9da4b0 ^
9e8b325 ^
adaa28a ^
c47da14 ^
dba2306 ^
adaa28a ^
9e8b325 ^
dba2306 ^
adaa28a ^
dba2306 ^

4f8b08d ^

dba2306 ^
adaa28a ^

29355bd ^
8b59083 ^
8b59083 ^
adaa28a ^
c47da14 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164