if (debug_wireframe > 1) { fprintf(stderr, "snapshot_stack_list: num=%d len=%d\n", stack_list_num, stack_list_len); }
void snapshot_stack_list(int free_only, double allowed_age) {	static double last_snap = 0.0, last_free = 0.0;	double now; 	int num, rc, i;	Window r, w;	Window *list;	if (! stack_list) {		stack_list = (winattr_t *) malloc(256*sizeof(winattr_t));		stack_list_num = 0;		stack_list_len = 256;	}	dtime0(&now);	if (free_only) {		/* we really don't free it, just reset to zero windows */		stack_list_num = 0;		last_free = now;		return;	}	if (stack_list_num && now < last_snap + allowed_age) {		return;	}	stack_list_num = 0;	last_free = now;	X_LOCK;	rc = XQueryTree(dpy, rootwin, &r, &w, &list, &num);	if (! rc) {		stack_list_num = 0;		last_free = now;		last_snap = 0.0;		X_UNLOCK;		return;	}	last_snap = now;	if (num > stack_list_len) {		int n = 2*num;		free(stack_list);		stack_list = (winattr_t *) malloc(n*sizeof(winattr_t));		stack_list_len = n;	}	for (i=0; i<num; i++) {		stack_list[i].win = list[i];		stack_list[i].fetched = 0;		stack_list[i].valid = 0;		stack_list[i].time = now;	}	stack_list_num = num;	XFree(list);	X_UNLOCK;}