Re: [dwm] [patch] scan()

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon, 18 Aug 2008 10:14:25 +0100

Well, I changed your patch a little bit, since you expect that
XQueryTree will set children_return to NULL if there aren't any
windows. Unfortunately at least in the past there were some X
implementations which didn't touch children_return but depended on
nchildren_return, that's why I keep wins initialized to NULL.

Kind regards,
Anselm

2008/8/15 Martin Hurton <martin.hurton_AT_gmail.com>:
> The patch below makes the scan() function a little simpler.
> Comments are welcome.
>
> Cheers,
> /Martin
>
> diff -r bca7a556aa03 dwm.c
> --- a/dwm.c Thu Aug 14 22:35:52 2008 +0200
> +++ b/dwm.c Fri Aug 15 13:34:05 2008 +0200
> @@ -1249,7 +1249,6 @@
> Window *wins, d1, d2;
> XWindowAttributes wa;
>
> - wins = NULL;
> if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
> for(i = 0; i < num; i++) {
> if(!XGetWindowAttributes(dpy, wins[i], &wa)
> @@ -1265,9 +1264,9 @@
> && (wa.map_state == IsViewable || getstate(wins[i]) == IconicState))
> manage(wins[i], &wa);
> }
> + if(wins)
> + XFree(wins);
> }
> - if(wins)
> - XFree(wins);
> }
>
> void
Received on Mon Aug 18 2008 - 09:14:25 UTC

This archive was generated by hypermail 2.2.0 : Mon Aug 18 2008 - 09:24:04 UTC