diff options
| -rw-r--r-- | dwm.c | 44 |
1 files changed, 21 insertions, 23 deletions
| @@ -57,21 +57,6 @@ enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ | |||
| 57 | 57 | ||
| 58 | /* typedefs */ | 58 | /* typedefs */ |
| 59 | typedef struct Client Client; | 59 | typedef struct Client Client; |
| 60 | struct Client { | ||
| 61 | char name[256]; | ||
| 62 | int x, y, w, h; | ||
| 63 | int rx, ry, rw, rh; /* revert geometry */ | ||
| 64 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | ||
| 65 | int minax, maxax, minay, maxay; | ||
| 66 | long flags; | ||
| 67 | unsigned int border, oldborder; | ||
| 68 | Bool isbanned, isfixed, ismax, isfloating, wasfloating; | ||
| 69 | Bool *tags; | ||
| 70 | Client *next; | ||
| 71 | Client *prev; | ||
| 72 | Client *snext; | ||
| 73 | Window win; | ||
| 74 | }; | ||
| 75 | 60 | ||
| 76 | typedef struct { | 61 | typedef struct { |
| 77 | int x, y, w, h; | 62 | int x, y, w, h; |
| @@ -195,7 +180,7 @@ char stext[256]; | |||
| 195 | double mwfact; | 180 | double mwfact; |
| 196 | int screen, sx, sy, sw, sh, wax, way, waw, wah; | 181 | int screen, sx, sy, sw, sh, wax, way, waw, wah; |
| 197 | int (*xerrorxlib)(Display *, XErrorEvent *); | 182 | int (*xerrorxlib)(Display *, XErrorEvent *); |
| 198 | unsigned int bh, bpos, ntags; | 183 | unsigned int bh, bpos; |
| 199 | unsigned int blw = 0; | 184 | unsigned int blw = 0; |
| 200 | unsigned int ltidx = 0; /* default */ | 185 | unsigned int ltidx = 0; /* default */ |
| 201 | unsigned int nlayouts = 0; | 186 | unsigned int nlayouts = 0; |
| @@ -218,7 +203,6 @@ void (*handler[LASTEvent]) (XEvent *) = { | |||
| 218 | Atom wmatom[WMLast], netatom[NetLast]; | 203 | Atom wmatom[WMLast], netatom[NetLast]; |
| 219 | Bool otherwm, readin; | 204 | Bool otherwm, readin; |
| 220 | Bool running = True; | 205 | Bool running = True; |
| 221 | Bool *seltags; | ||
| 222 | Bool selscreen = True; | 206 | Bool selscreen = True; |
| 223 | Client *clients = NULL; | 207 | Client *clients = NULL; |
| 224 | Client *sel = NULL; | 208 | Client *sel = NULL; |
| @@ -232,6 +216,26 @@ Regs *regs = NULL; | |||
| 232 | /* configuration, allows nested code to access above variables */ | 216 | /* configuration, allows nested code to access above variables */ |
| 233 | #include "config.h" | 217 | #include "config.h" |
| 234 | 218 | ||
| 219 | /* Statically define the number of tags. */ | ||
| 220 | unsigned int ntags = sizeof tags / sizeof tags[0]; | ||
| 221 | Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True}; | ||
| 222 | |||
| 223 | struct Client { | ||
| 224 | char name[256]; | ||
| 225 | int x, y, w, h; | ||
| 226 | int rx, ry, rw, rh; /* revert geometry */ | ||
| 227 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | ||
| 228 | int minax, maxax, minay, maxay; | ||
| 229 | long flags; | ||
| 230 | unsigned int border, oldborder; | ||
| 231 | Bool isbanned, isfixed, ismax, isfloating, wasfloating; | ||
| 232 | Bool tags[sizeof tags / sizeof tags[0]]; | ||
| 233 | Client *next; | ||
| 234 | Client *prev; | ||
| 235 | Client *snext; | ||
| 236 | Window win; | ||
| 237 | }; | ||
| 238 | |||
| 235 | /* functions*/ | 239 | /* functions*/ |
| 236 | void | 240 | void |
| 237 | applyrules(Client *c) { | 241 | applyrules(Client *c) { |
| @@ -393,7 +397,6 @@ cleanup(void) { | |||
| 393 | XFreeCursor(dpy, cursor[CurMove]); | 397 | XFreeCursor(dpy, cursor[CurMove]); |
| 394 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); | 398 | XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
| 395 | XSync(dpy, False); | 399 | XSync(dpy, False); |
| 396 | free(seltags); | ||
| 397 | } | 400 | } |
| 398 | 401 | ||
| 399 | void | 402 | void |
| @@ -1006,7 +1009,6 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 1006 | XWindowChanges wc; | 1009 | XWindowChanges wc; |
| 1007 | 1010 | ||
| 1008 | c = emallocz(sizeof(Client)); | 1011 | c = emallocz(sizeof(Client)); |
| 1009 | c->tags = emallocz(ntags * sizeof(Bool)); | ||
| 1010 | c->win = w; | 1012 | c->win = w; |
| 1011 | c->x = wa->x; | 1013 | c->x = wa->x; |
| 1012 | c->y = wa->y; | 1014 | c->y = wa->y; |
| @@ -1467,9 +1469,6 @@ setup(void) { | |||
| 1467 | 1469 | ||
| 1468 | /* init tags */ | 1470 | /* init tags */ |
| 1469 | compileregs(); | 1471 | compileregs(); |
| 1470 | ntags = sizeof tags / sizeof tags[0]; | ||
| 1471 | seltags = emallocz(sizeof(Bool) * ntags); | ||
| 1472 | seltags[0] = True; | ||
| 1473 | 1472 | ||
| 1474 | /* init appearance */ | 1473 | /* init appearance */ |
| 1475 | dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR); | 1474 | dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR); |
| @@ -1703,7 +1702,6 @@ unmanage(Client *c) { | |||
| 1703 | focus(NULL); | 1702 | focus(NULL); |
| 1704 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | 1703 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
| 1705 | setclientstate(c, WithdrawnState); | 1704 | setclientstate(c, WithdrawnState); |
| 1706 | free(c->tags); | ||
| 1707 | free(c); | 1705 | free(c); |
| 1708 | XSync(dpy, False); | 1706 | XSync(dpy, False); |
| 1709 | XSetErrorHandler(xerror); | 1707 | XSetErrorHandler(xerror); |
