+ if(!sel)
+ return;
+ if(sel->isfloat || arrange == dofloat)
+ XRaiseWindow(dpy, sel->win);
+ if(arrange != dofloat) {
+ if(!sel->isfloat)
+ XLowerWindow(dpy, sel->win);
+ for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
+ if(c == sel)
+ continue;
+ XLowerWindow(dpy, c->win);
+ }
+ }
+ XSync(dpy, False);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
+void
+settags(Client *c, Client *trans) {
+ char prop[512];
+ unsigned int i, j;
+ regmatch_t tmp;
+ Bool matched = trans != NULL;
+ XClassHint ch = { 0 };
+
+ if(matched)
+ for(i = 0; i < ntags; i++)
+ c->tags[i] = trans->tags[i];
+ else {
+ XGetClassHint(dpy, c->win, &ch);
+ snprintf(prop, sizeof prop, "%s:%s:%s",
+ ch.res_class ? ch.res_class : "",
+ ch.res_name ? ch.res_name : "", c->name);
+ for(i = 0; i < len; i++)
+ if(regexps[i].propregex && !regexec(regexps[i].propregex, prop, 1, &tmp, 0)) {
+ c->isfloat = rule[i].isfloat;
+ for(j = 0; regexps[i].tagregex && j < ntags; j++) {
+ if(!regexec(regexps[i].tagregex, tags[j], 1, &tmp, 0)) {
+ matched = True;
+ c->tags[j] = True;
+ }
+ }
+ }
+ if(ch.res_class)
+ XFree(ch.res_class);
+ if(ch.res_name)
+ XFree(ch.res_name);
+ }
+ if(!matched)
+ for(i = 0; i < ntags; i++)
+ c->tags[i] = seltag[i];