aewl

diff main.c @ 328:083f1f3e1e93

removed winprop (merged into getproto)
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 22 Aug 2006 17:38:59 +0200
parents 73efaa15a635
children cea0c98495bc
line diff
     1.1 --- a/main.c	Tue Aug 22 16:50:21 2006 +0200
     1.2 +++ b/main.c	Tue Aug 22 17:38:59 2006 +0200
     1.3 @@ -62,25 +62,6 @@
     1.4  		XFree(wins);
     1.5  }
     1.6  
     1.7 -static int
     1.8 -winprop(Window w, Atom a, Atom t, long l, unsigned char **prop)
     1.9 -{
    1.10 -	int status, format;
    1.11 -	unsigned long res, extra;
    1.12 -	Atom real;
    1.13 -
    1.14 -	status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
    1.15 -			&res, &extra, prop);
    1.16 -
    1.17 -	if(status != Success || *prop == 0) {
    1.18 -		return 0;
    1.19 -	}
    1.20 -	if(res == 0) {
    1.21 -		free((void *) *prop);
    1.22 -	}
    1.23 -	return res;
    1.24 -}
    1.25 -
    1.26  /*
    1.27   * Startup Error handler to check if another window manager
    1.28   * is already running.
    1.29 @@ -111,21 +92,20 @@
    1.30  int
    1.31  getproto(Window w)
    1.32  {
    1.33 -	int protos = 0;
    1.34 +	int status, format, protos = 0;
    1.35  	int i;
    1.36 -	long res;
    1.37 -	Atom *protocols;
    1.38 +	unsigned long extra, res;
    1.39 +	Atom *protocols, real;
    1.40  
    1.41 -	res = winprop(w, wmatom[WMProtocols], XA_ATOM, 20L,
    1.42 -			((unsigned char **)&protocols));
    1.43 -	if(res <= 0) {
    1.44 +	status = XGetWindowProperty(dpy, w, wmatom[WMProtocols], 0L, 20L,
    1.45 +			False, XA_ATOM, &real, &format, &res, &extra, (unsigned char **)&protocols);
    1.46 +	if(status != Success || protocols == 0)
    1.47  		return protos;
    1.48 -	}
    1.49  	for(i = 0; i < res; i++) {
    1.50  		if(protocols[i] == wmatom[WMDelete])
    1.51  			protos |= PROTODELWIN;
    1.52  	}
    1.53 -	free((char *) protocols);
    1.54 +	free(protocols);
    1.55  	return protos;
    1.56  }
    1.57