-void
-dofloat(Arg *arg)
-{
- Client *c;
-
- for(c = clients; c; c = c->next) {
- c->ismax = False;
- if(c->tags[tsel]) {
- resize(c, True, TopLeft);
- }
- else
- ban(c);
- }
- if(sel && !sel->tags[tsel]) {
- if((sel = getnext(clients))) {
- higher(sel);
- focus(sel);
- }
- else
- XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
- }
- drawall();
-}
-
-void
-dotile(Arg *arg)
-{
- int n, i, w, h;
- Client *c;
-
- w = sw - mw;
- for(n = 0, c = clients; c; c = c->next)
- if(c->tags[tsel] && !c->isfloat)
- n++;
-
- if(n > 1)
- h = (sh - bh) / (n - 1);
- else
- h = sh - bh;
-
- for(i = 0, c = clients; c; c = c->next) {
- c->ismax = False;
- if(c->tags[tsel]) {
- if(c->isfloat) {
- higher(c);
- resize(c, True, TopLeft);
- continue;
- }
- if(n == 1) {
- c->x = sx;
- c->y = sy + bh;
- c->w = sw - 2 * c->border;
- c->h = sh - 2 * c->border - bh;
- }
- else if(i == 0) {
- c->x = sx;
- c->y = sy + bh;
- c->w = mw - 2 * c->border;
- c->h = sh - 2 * c->border - bh;
- }
- else if(h > bh) {
- c->x = sx + mw;
- c->y = sy + (i - 1) * h + bh;
- c->w = w - 2 * c->border;
- c->h = h - 2 * c->border;
- }
- else { /* fallback if h < bh */
- c->x = sx + mw;
- c->y = sy + bh;
- c->w = w - 2 * c->border;
- c->h = sh - 2 * c->border - bh;
- }
- resize(c, False, TopLeft);
- i++;
+ if(rreg)
+ return;
+ len = sizeof rule / sizeof rule[0];
+ rreg = emallocz(len * sizeof(RReg));
+ for(i = 0; i < len; i++) {
+ if(rule[i].clpattern) {
+ reg = emallocz(sizeof(regex_t));
+ if(regcomp(reg, rule[i].clpattern, REG_EXTENDED))
+ free(reg);
+ else
+ rreg[i].clregex = reg;