- nmons = (unsigned int)n;
- for(c = clients; c; c = c->next)
- if(c->mon >= nmons)
- c->mon = nmons - 1;
- if(!(mon = (Monitor *)realloc(mon, sizeof(Monitor) * nmons)))
- die("fatal: could not realloc() %u bytes\n", sizeof(Monitor) * nmons);
- pquery = XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui);
- for(i = 0; i < nmons; i++) {
+ if(n != nmons) {
+ for(c = clients; c; c = c->next)
+ if(c->mon >= n)
+ c->mon = n - 1;
+ if(!(mon = (Monitor *)realloc(mon, sizeof(Monitor) * n)))
+ die("fatal: could not realloc() %u bytes\n", sizeof(Monitor) * nmons);
+ }
+ for(i = 0; i < n ; i++) {