+ /* bar geometry setup */
+ for(m = newmons; m; m = m->next) {
+ /* TODO: consider removing the following values from config.h */
+ m->clients = NULL;
+ m->sel = NULL;
+ m->stack = NULL;
+ m->seltags = 0;
+ m->sellt = 0;
+ m->tagset[0] = m->tagset[1] = 1;
+ m->mfact = mfact;
+ m->showbar = showbar;
+ m->topbar = topbar;
+ updatebarpos(m);
+ }
+
+ /* reassign left over clients of disappeared monitors */
+ for(tm = mons; tm; tm = tm->next)
+ while(tm->clients) {
+ c = tm->clients;
+ tm->clients = c->next;
+ detachstack(c);
+ c->mon = newmons;
+ attach(c);
+ attachstack(c);
+ }
+
+ /* select focused monitor */
+ selmon = newmons;
+ if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui))
+ for(m = newmons; m; m = m->next)
+ if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) {
+ selmon = m;
+ break;
+ }
+
+ /* final assignment of new monitors */
+ cleanupmons();
+ mons = newmons;
+}
+
+void
+updatenumlockmask(void) {
+ unsigned int i, j;
+ XModifierKeymap *modmap;
+
+ numlockmask = 0;
+ modmap = XGetModifierMapping(dpy);
+ for(i = 0; i < 8; i++)
+ for(j = 0; j < modmap->max_keypermod; j++)
+ if(modmap->modifiermap[i * modmap->max_keypermod + j]
+ == XKeysymToKeycode(dpy, XK_Num_Lock))
+ numlockmask = (1 << i);
+ XFreeModifiermap(modmap);