summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dwm.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/dwm.c b/dwm.c
index c9495ec..9e9e748 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,21 +57,6 @@ enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */
57 57
58/* typedefs */ 58/* typedefs */
59typedef struct Client Client; 59typedef struct Client Client;
60struct 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
76typedef struct { 61typedef struct {
77 int x, y, w, h; 62 int x, y, w, h;
@@ -195,7 +180,7 @@ char stext[256];
195double mwfact; 180double mwfact;
196int screen, sx, sy, sw, sh, wax, way, waw, wah; 181int screen, sx, sy, sw, sh, wax, way, waw, wah;
197int (*xerrorxlib)(Display *, XErrorEvent *); 182int (*xerrorxlib)(Display *, XErrorEvent *);
198unsigned int bh, bpos, ntags; 183unsigned int bh, bpos;
199unsigned int blw = 0; 184unsigned int blw = 0;
200unsigned int ltidx = 0; /* default */ 185unsigned int ltidx = 0; /* default */
201unsigned int nlayouts = 0; 186unsigned int nlayouts = 0;
@@ -218,7 +203,6 @@ void (*handler[LASTEvent]) (XEvent *) = {
218Atom wmatom[WMLast], netatom[NetLast]; 203Atom wmatom[WMLast], netatom[NetLast];
219Bool otherwm, readin; 204Bool otherwm, readin;
220Bool running = True; 205Bool running = True;
221Bool *seltags;
222Bool selscreen = True; 206Bool selscreen = True;
223Client *clients = NULL; 207Client *clients = NULL;
224Client *sel = NULL; 208Client *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. */
220unsigned int ntags = sizeof tags / sizeof tags[0];
221Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True};
222
223struct 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*/
236void 240void
237applyrules(Client *c) { 241applyrules(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
399void 402void
@@ -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);