treplaced getproto with a saner function, now old-school artifacts of WM times … | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 28ffff801bb0137ec3fe4093afc4fb29784b17ec | |
parent 44ef3f5a07753ecaeacc2fb180e90bf4479ab975 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Wed, 7 Feb 2007 12:37:06 +0100 | |
replaced getproto with a saner function, now old-school artifacts of WM times i… | |
Diffstat: | |
M client.c | 18 ++++++++++++++++-- | |
M config.mk | 4 ++-- | |
M dwm.h | 7 ++----- | |
M event.c | 4 ---- | |
M main.c | 18 ------------------ | |
5 files changed, 20 insertions(+), 31 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -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); | |
t@@ -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 | |
t@@ -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 | |
t@@ -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 */ | |
t@@ -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; | |
t@@ -105,6 +102,7 @@ extern Window root, barwin; | |
extern void configure(Client *c); /* send synthetic configure e… | |
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 su… | |
extern void killclient(Arg *arg); /* kill c nicely */ | |
extern void manage(Window w, XWindowAttributes *wa); /* manage new clie… | |
extern void resize(Client *c, Bool sizehints); /* resize c*/ | |
t@@ -123,7 +121,6 @@ extern void grabkeys(void); /* grab… | |
extern void procevent(void); /* process pending X event… | |
/* main.c */ | |
-extern int getproto(Window w); /* return protocol mask … | |
extern void quit(Arg *arg); /* quit dwm nicely */ | |
extern void sendevent(Window w, Atom a, long value); /* send synthetic … | |
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error ha… | |
diff --git a/event.c b/event.c | |
t@@ -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 | |
t@@ -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, Fals… | |
- XA_ATOM, &real, &format, &res, &extra, (unsigned char … | |
- 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; |