applied anydot's patchset.diff a8e0772c
Anselm R Garbe · 2008-06-11 09:12 3 file(s) · +206 −211
config.def.h +35 −35
8 8
#define SELBORDERCOLOR  "#0066ff"
9 9
#define SELBGCOLOR      "#0066ff"
10 10
#define SELFGCOLOR      "#ffffff"
11 -
unsigned int borderpx  = 1;        /* border pixel of windows */
12 -
unsigned int snap      = 32;       /* snap pixel */
13 -
Bool showbar           = True;     /* False means no bar */
14 -
Bool topbar            = True;     /* False means bottom bar */
11 +
static uint borderpx  = 1;        /* border pixel of windows */
12 +
static uint snap      = 32;       /* snap pixel */
13 +
static Bool showbar           = True;     /* False means no bar */
14 +
static Bool topbar            = True;     /* False means bottom bar */
15 15
16 16
/* tagging */
17 -
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
17 +
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
18 18
19 -
Rule rules[] = {
19 +
static Rule rules[] = {
20 20
	/* class      instance    title       tags ref      isfloating */
21 21
	{ "Gimp",     NULL,       NULL,       0,            True },
22 22
	{ "Firefox",  NULL,       NULL,       1 << 8,       True },
23 23
};
24 24
25 25
/* layout(s) */
26 -
double mfact           = 0.55;
27 -
Bool resizehints       = False;     /* False means respect size hints in tiled resizals */
26 +
static float mfact           = 0.55;
27 +
static Bool resizehints       = False;     /* False means respect size hints in tiled resizals */
28 28
29 -
Layout layouts[] = {
29 +
static Layout layouts[] = {
30 30
	/* symbol     arrange function */
31 31
	{ "[]=",      tile }, /* first entry is default */
32 32
	{ "><>",      NULL }, /* no layout function means floating behavior */
40 40
        { MODKEY|ShiftMask,             KEY,      tag,            TAG }, \
41 41
        { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      TAG },
42 42
43 -
Key keys[] = {
43 +
static Key keys[] = {
44 44
	/* modifier                     key        function        argument */
45 -
	{ MODKEY,                       XK_p,      spawn,          (char *)"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
46 -
	{ MODKEY|ShiftMask,             XK_Return, spawn,          (char *)"exec uxterm" },
47 -
	{ MODKEY,                       XK_b,      togglebar,      NULL },
48 -
	{ MODKEY,                       XK_j,      focusnext,      NULL },
49 -
	{ MODKEY,                       XK_k,      focusprev,      NULL },
50 -
	{ MODKEY,                       XK_h,      setmfact,       (double[]){-0.05} },
51 -
	{ MODKEY,                       XK_l,      setmfact,       (double[]){+0.05} },
52 -
	{ MODKEY,                       XK_m,      togglemax,      NULL },
53 -
	{ MODKEY,                       XK_Return, zoom,           NULL },
54 -
	{ MODKEY,                       XK_Tab,    view,           NULL },
55 -
	{ MODKEY|ShiftMask,             XK_c,      killclient,     NULL },
56 -
	{ MODKEY,                       XK_space,  togglelayout,   NULL },
57 -
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, NULL },
58 -
	{ MODKEY,                       XK_0,      view,           (uint[]){ ~0 } },
59 -
	{ MODKEY|ShiftMask,             XK_0,      tag,            (uint[]){ ~0 } },
60 -
	TAGKEYS(                        XK_1,                      (uint[]){ 1 << 0} )
61 -
	TAGKEYS(                        XK_2,                      (uint[]){ 1 << 1} )
62 -
	TAGKEYS(                        XK_3,                      (uint[]){ 1 << 2} )
63 -
	TAGKEYS(                        XK_4,                      (uint[]){ 1 << 3} )
64 -
	TAGKEYS(                        XK_5,                      (uint[]){ 1 << 4} )
65 -
	TAGKEYS(                        XK_6,                      (uint[]){ 1 << 5} )
66 -
	TAGKEYS(                        XK_7,                      (uint[]){ 1 << 6} )
67 -
	TAGKEYS(                        XK_8,                      (uint[]){ 1 << 7} )
68 -
	TAGKEYS(                        XK_9,                      (uint[]){ 1 << 8} )
69 -
	{ MODKEY|ShiftMask,             XK_q,      quit,           NULL },
45 +
	{ MODKEY,                       XK_p,      spawn,          {.c = "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }},
46 +
	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.c = "exec uxterm" }},
47 +
	{ MODKEY,                       XK_b,      togglebar,      {0}},
48 +
	{ MODKEY,                       XK_j,      focusstack,     {.i = +1  }},
49 +
	{ MODKEY,                       XK_k,      focusstack,     {.i = -1  }},
50 +
	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05}},
51 +
	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05}},
52 +
	{ MODKEY,                       XK_m,      togglemax,      {0}},
53 +
	{ MODKEY,                       XK_Return, zoom,           {0}},
54 +
	{ MODKEY,                       XK_Tab,    view,           {0}},
55 +
	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0}},
56 +
	{ MODKEY,                       XK_space,  togglelayout,   {0}},
57 +
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0}},
58 +
	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
59 +
	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
60 +
	TAGKEYS(                        XK_1,                      {.ui = 1 << 0} )
61 +
	TAGKEYS(                        XK_2,                      {.ui = 1 << 1} )
62 +
	TAGKEYS(                        XK_3,                      {.ui = 1 << 2} )
63 +
	TAGKEYS(                        XK_4,                      {.ui = 1 << 3} )
64 +
	TAGKEYS(                        XK_5,                      {.ui = 1 << 4} )
65 +
	TAGKEYS(                        XK_6,                      {.ui = 1 << 5} )
66 +
	TAGKEYS(                        XK_7,                      {.ui = 1 << 6} )
67 +
	TAGKEYS(                        XK_8,                      {.ui = 1 << 7} )
68 +
	TAGKEYS(                        XK_9,                      {.ui = 1 << 8} )
69 +
	{ MODKEY|ShiftMask,             XK_q,      quit,           {0}},
70 70
};
config.mk +2 −2
22 22
CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
23 23
#CFLAGS = -Os ${INCS} ${CPPFLAGS}
24 24
#LDFLAGS = -s ${LIBS}
25 -
CFLAGS = -g -std=c99 -pedantic -Wall -O2 ${INCS} ${CPPFLAGS}
26 -
LDFLAGS = -g ${LIBS}
25 +
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
26 +
LDFLAGS = -s ${LIBS}
27 27
28 28
# Solaris
29 29
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
dwm.c +169 −174
68 68
	char name[256];
69 69
	int x, y, w, h;
70 70
	int basew, baseh, incw, inch, maxw, maxh, minw, minh;
71 -
	int minax, maxax, minay, maxay;
71 +
	float mina, maxa;
72 72
	int bw, oldbw;
73 73
	Bool isbanned, isfixed, isfloating, ismoved, isurgent;
74 74
	uint tags;
75 75
	Client *next;
76 -
	Client *prev;
77 76
	Client *snext;
78 77
	Window win;
79 78
};
92 91
		XFontStruct *xfont;
93 92
	} font;
94 93
} DC; /* draw context */
94 +
95 +
typedef union {
96 +
	const char *c;
97 +
	int i;
98 +
	uint ui;
99 +
	float f;
100 +
	void *aux;
101 +
} Arg;
95 102
96 103
typedef struct {
97 104
	uint mod;
98 105
	KeySym keysym;
99 -
	void (*func)(const void *arg);
100 -
	const void *arg;
106 +
	void (*func)(const Arg *);
107 +
	const Arg arg;
101 108
} Key;
102 109
103 110
typedef struct {
114 121
} Rule;
115 122
116 123
/* function declarations */
117 -
void applyrules(Client *c);
118 -
void arrange(void);
119 -
void attach(Client *c);
120 -
void attachstack(Client *c);
121 -
void buttonpress(XEvent *e);
122 -
void checkotherwm(void);
123 -
void cleanup(void);
124 -
void configure(Client *c);
125 -
void configurenotify(XEvent *e);
126 -
void configurerequest(XEvent *e);
127 -
void destroynotify(XEvent *e);
128 -
void detach(Client *c);
129 -
void detachstack(Client *c);
130 -
void drawbar(void);
131 -
void drawsquare(Bool filled, Bool empty, Bool invert, ulong col[ColLast]);
132 -
void drawtext(const char *text, ulong col[ColLast], Bool invert);
133 -
void enternotify(XEvent *e);
134 -
void eprint(const char *errstr, ...);
135 -
void expose(XEvent *e);
136 -
void focus(Client *c);
137 -
void focusin(XEvent *e);
138 -
void focusnext(const void *arg);
139 -
void focusprev(const void *arg);
140 -
Client *getclient(Window w);
141 -
ulong getcolor(const char *colstr);
142 -
long getstate(Window w);
143 -
Bool gettextprop(Window w, Atom atom, char *text, uint size);
144 -
void grabbuttons(Client *c, Bool focused);
145 -
void grabkeys(void);
146 -
void initfont(const char *fontstr);
147 -
Bool isoccupied(uint t);
148 -
Bool isprotodel(Client *c);
149 -
Bool isurgent(uint t);
150 -
void keypress(XEvent *e);
151 -
void killclient(const void *arg);
152 -
void manage(Window w, XWindowAttributes *wa);
153 -
void mappingnotify(XEvent *e);
154 -
void maprequest(XEvent *e);
155 -
void movemouse(Client *c);
156 -
Client *nexttiled(Client *c);
157 -
void propertynotify(XEvent *e);
158 -
void quit(const void *arg);
159 -
void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
160 -
void resizemouse(Client *c);
161 -
void restack(void);
162 -
void run(void);
163 -
void scan(void);
164 -
void setclientstate(Client *c, long state);
165 -
void setmfact(const void *arg);
166 -
void setup(void);
167 -
void spawn(const void *arg);
168 -
void tag(const void *arg);
169 -
int textnw(const char *text, uint len);
170 -
void tile(void);
171 -
void togglebar(const void *arg);
172 -
void togglefloating(const void *arg);
173 -
void togglelayout(const void *arg);
174 -
void togglemax(const void *arg);
175 -
void toggletag(const void *arg);
176 -
void toggleview(const void *arg);
177 -
void unmanage(Client *c);
178 -
void unmapnotify(XEvent *e);
179 -
void updatebar(void);
180 -
void updategeom(void);
181 -
void updatesizehints(Client *c);
182 -
void updatetitle(Client *c);
183 -
void updatewmhints(Client *c);
184 -
void view(const void *arg);
185 -
int xerror(Display *dpy, XErrorEvent *ee);
186 -
int xerrordummy(Display *dpy, XErrorEvent *ee);
187 -
int xerrorstart(Display *dpy, XErrorEvent *ee);
188 -
void zoom(const void *arg);
124 +
static void applyrules(Client *c);
125 +
static void arrange(void);
126 +
static void attach(Client *c);
127 +
static void attachstack(Client *c);
128 +
static void buttonpress(XEvent *e);
129 +
static void checkotherwm(void);
130 +
static void cleanup(void);
131 +
static void configure(Client *c);
132 +
static void configurenotify(XEvent *e);
133 +
static void configurerequest(XEvent *e);
134 +
static void destroynotify(XEvent *e);
135 +
static void detach(Client *c);
136 +
static void detachstack(Client *c);
137 +
static void drawbar(void);
138 +
static void drawsquare(Bool filled, Bool empty, Bool invert, ulong col[ColLast]);
139 +
static void drawtext(const char *text, ulong col[ColLast], Bool invert);
140 +
static void enternotify(XEvent *e);
141 +
static void eprint(const char *errstr, ...);
142 +
static void expose(XEvent *e);
143 +
static void focus(Client *c);
144 +
static void focusin(XEvent *e);
145 +
static void focusstack(const Arg *arg);
146 +
static Client *getclient(Window w);
147 +
static ulong getcolor(const char *colstr);
148 +
static long getstate(Window w);
149 +
static Bool gettextprop(Window w, Atom atom, char *text, uint size);
150 +
static void grabbuttons(Client *c, Bool focused);
151 +
static void grabkeys(void);
152 +
static void initfont(const char *fontstr);
153 +
static Bool isoccupied(uint t);
154 +
static Bool isprotodel(Client *c);
155 +
static Bool isurgent(uint t);
156 +
static void keypress(XEvent *e);
157 +
static void killclient(const Arg *arg);
158 +
static void manage(Window w, XWindowAttributes *wa);
159 +
static void mappingnotify(XEvent *e);
160 +
static void maprequest(XEvent *e);
161 +
static void movemouse(Client *c);
162 +
static Client *nexttiled(Client *c);
163 +
static void propertynotify(XEvent *e);
164 +
static void quit(const Arg *arg);
165 +
static void resize(Client *c, int x, int y, int w, int h, Bool sizehints);
166 +
static void resizemouse(Client *c);
167 +
static void restack(void);
168 +
static void run(void);
169 +
static void scan(void);
170 +
static void setclientstate(Client *c, long state);
171 +
static void setmfact(const Arg *arg);
172 +
static void setup(void);
173 +
static void spawn(const Arg *arg);
174 +
static void tag(const Arg *arg);
175 +
static int textnw(const char *text, uint len);
176 +
static void tile(void);
177 +
static void togglebar(const Arg *arg);
178 +
static void togglefloating(const Arg *arg);
179 +
static void togglelayout(const Arg *arg);
180 +
static void togglemax(const Arg *arg);
181 +
static void toggletag(const Arg *arg);
182 +
static void toggleview(const Arg *arg);
183 +
static void unmanage(Client *c);
184 +
static void unmapnotify(XEvent *e);
185 +
static void updatebar(void);
186 +
static void updategeom(void);
187 +
static void updatesizehints(Client *c);
188 +
static void updatetitle(Client *c);
189 +
static void updatewmhints(Client *c);
190 +
static void view(const Arg *arg);
191 +
static int xerror(Display *dpy, XErrorEvent *ee);
192 +
static int xerrordummy(Display *dpy, XErrorEvent *ee);
193 +
static int xerrorstart(Display *dpy, XErrorEvent *ee);
194 +
static void zoom(const Arg *arg);
189 195
190 196
/* variables */
191 -
char stext[256];
192 -
int screen, sx, sy, sw, sh;
193 -
int by, bh, blw, wx, wy, ww, wh;
194 -
uint seltags = 0;
195 -
int (*xerrorxlib)(Display *, XErrorEvent *);
196 -
uint numlockmask = 0;
197 -
void (*handler[LASTEvent]) (XEvent *) = {
197 +
static char stext[256];
198 +
static int screen, sx, sy, sw, sh;
199 +
static int by, bh, blw, wx, wy, ww, wh;
200 +
static uint seltags = 0;
201 +
static int (*xerrorxlib)(Display *, XErrorEvent *);
202 +
static uint numlockmask = 0;
203 +
static void (*handler[LASTEvent]) (XEvent *) = {
198 204
	[ButtonPress] = buttonpress,
199 205
	[ConfigureRequest] = configurerequest,
200 206
	[ConfigureNotify] = configurenotify,
208 214
	[PropertyNotify] = propertynotify,
209 215
	[UnmapNotify] = unmapnotify
210 216
};
211 -
Atom wmatom[WMLast], netatom[NetLast];
212 -
Bool ismax = False;
213 -
Bool otherwm, readin;
214 -
Bool running = True;
215 -
uint tagset[] = {1, 1}; /* after start, first tag is selected */
216 -
Client *clients = NULL;
217 -
Client *sel = NULL;
218 -
Client *stack = NULL;
219 -
Cursor cursor[CurLast];
220 -
Display *dpy;
221 -
DC dc = {0};
222 -
Layout layouts[];
223 -
Layout *lt = layouts;
224 -
Window root, barwin;
217 +
static Atom wmatom[WMLast], netatom[NetLast];
218 +
static Bool ismax = False;
219 +
static Bool otherwm, readin;
220 +
static Bool running = True;
221 +
static uint tagset[] = {1, 1}; /* after start, first tag is selected */
222 +
static Client *clients = NULL;
223 +
static Client *sel = NULL;
224 +
static Client *stack = NULL;
225 +
static Cursor cursor[CurLast];
226 +
static Display *dpy;
227 +
static DC dc = {0};
228 +
static Window root, barwin;
225 229
226 230
/* configuration, allows nested code to access above variables */
227 231
#include "config.h"
232 +
233 +
static Layout *lt = layouts;
228 234
229 235
/* compile-time check if all tags fit into an uint bit array. */
230 236
struct NumTags { char limitexceeded[sizeof(uint) * 8 < LENGTH(tags) ? -1 : 1]; };
282 288
283 289
void
284 290
attach(Client *c) {
285 -
	if(clients)
286 -
		clients->prev = c;
287 291
	c->next = clients;
288 292
	clients = c;
289 293
}
309 313
				mask = 1 << i;
310 314
				if(ev->button == Button1) {
311 315
					if(ev->state & MODKEY)
312 -
						tag(&mask);
316 +
						tag((Arg*)&mask);
313 317
					else
314 -
						view(&mask);
318 +
						view((Arg*)&mask);
315 319
				}
316 320
				else if(ev->button == Button3) {
317 321
					if(ev->state & MODKEY)
318 -
						toggletag(&mask);
322 +
						toggletag((Arg*)&mask);
319 323
					else
320 -
						toggleview(&mask);
324 +
						toggleview((Arg*)&mask);
321 325
				}
322 326
				return;
323 327
			}
359 363
360 364
void
361 365
cleanup(void) {
366 +
	Arg a = {.i = ~0};
362 367
	close(STDIN_FILENO);
363 -
	view((uint[]){~0});
368 +
	view(&a);
364 369
	while(stack)
365 370
		unmanage(stack);
366 371
	if(dc.font.set)
466 471
467 472
void
468 473
detach(Client *c) {
469 -
	if(c->prev)
470 -
		c->prev->next = c->next;
471 -
	if(c->next)
472 -
		c->next->prev = c->prev;
473 -
	if(c == clients)
474 +
	Client *i;
475 +
476 +
	if (c != clients) {
477 +
		for(i = clients; i->next != c; i = i->next);
478 +
		i->next = c->next;
479 +
	}
480 +
	else {
474 481
		clients = c->next;
475 -
	c->next = c->prev = NULL;
482 +
	}
483 +
	c->next =  NULL;
476 484
}
477 485
478 486
void
640 648
}
641 649
642 650
void
643 -
focusnext(const void *arg) {
644 -
	Client *c;
651 +
focusstack(const Arg *arg) {
652 +
	Client *c = NULL, *i;
645 653
646 654
	if(!sel)
647 655
		return;
648 -
	for(c = sel->next; c && c->isbanned; c = c->next);
649 -
	if(!c)
650 -
		for(c = clients; c && c->isbanned; c = c->next);
651 -
	if(c) {
652 -
		focus(c);
653 -
		restack();
656 +
	if (arg->i > 0) {
657 +
		for(c = sel->next; c && c->isbanned; c = c->next);
658 +
		if(!c)
659 +
			for(c = clients; c && c->isbanned; c = c->next);
654 660
	}
655 -
}
656 -
657 -
void
658 -
focusprev(const void *arg) {
659 -
	Client *c;
660 -
661 -
	if(!sel)
662 -
		return;
663 -
	for(c = sel->prev; c && c->isbanned; c = c->prev);
664 -
	if(!c) {
665 -
		for(c = clients; c && c->next; c = c->next);
666 -
		for(; c && c->isbanned; c = c->prev);
661 +
	else {
662 +
		for(i = clients; i != sel; i = i->next)
663 +
			if (!i->isbanned)
664 +
				c = i;
665 +
		if(!c) 
666 +
			for(; i; i = i->next)
667 +
				if (!i->isbanned)
668 +
					c = i;
667 669
	}
668 670
	if(c) {
669 671
		focus(c);
866 868
		if(keysym == keys[i].keysym
867 869
		   && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
868 870
		   && keys[i].func)
869 -
			keys[i].func(keys[i].arg);
871 +
			keys[i].func(&(keys[i].arg));
870 872
}
871 873
872 874
void
873 -
killclient(const void *arg) {
875 +
killclient(const Arg *arg) {
874 876
	XEvent ev;
875 877
876 878
	if(!sel)
1056 1058
}
1057 1059
1058 1060
void
1059 -
quit(const void *arg) {
1061 +
quit(const Arg *arg) {
1060 1062
	readin = running = False;
1061 1063
}
1062 1064
1074 1076
		h -= c->baseh;
1075 1077
1076 1078
		/* adjust for aspect limits */
1077 -
		if(c->minax != c->maxax && c->minay != c->maxay 
1078 -
		&& c->minax > 0 && c->maxax > 0 && c->minay > 0 && c->maxay > 0) {
1079 -
			if(w * c->maxay > h * c->maxax)
1080 -
				w = h * c->maxax / c->maxay;
1081 -
			else if(w * c->minay < h * c->minax)
1082 -
				h = w * c->minay / c->minax;
1079 +
		if(c->mina > 0 && c->maxa > 0) {
1080 +
			if(c->maxa < (float) w/h)
1081 +
				w = h * c->maxa;
1082 +
			else if(c->mina > (float) h/w)
1083 +
				h = w * c->mina;
1083 1084
		}
1084 1085
1085 1086
		/* adjust for increment value */
1295 1296
1296 1297
/* arg > 1.0 will set mfact absolutly */
1297 1298
void
1298 -
setmfact(const void *arg) {
1299 -
	double d = *((double*) arg);
1299 +
setmfact(const Arg *arg) {
1300 +
	float f;
1300 1301
1301 -
	if(!d || !lt->arrange)
1302 +
	if(!arg || !lt->arrange)
1302 1303
		return;
1303 -
	d = d < 1.0 ? d + mfact : d - 1.0;
1304 -
	if(d < 0.1 || d > 0.9)
1304 +
	f = arg->f < 1.0 ? arg->f + mfact : arg->f - 1.0;
1305 +
	if(f < 0.1 || f > 0.9)
1305 1306
		return;
1306 -
	mfact = d;
1307 +
	mfact = f;
1307 1308
	arrange();
1308 1309
}
1309 1310
1386 1387
}
1387 1388
1388 1389
void
1389 -
spawn(const void *arg) {
1390 +
spawn(const Arg *arg) {
1390 1391
	static char *shell = NULL;
1391 1392
1392 1393
	if(!shell && !(shell = getenv("SHELL")))
1398 1399
			if(dpy)
1399 1400
				close(ConnectionNumber(dpy));
1400 1401
			setsid();
1401 -
			execl(shell, shell, "-c", (char *)arg, (char *)NULL);
1402 -
			fprintf(stderr, "dwm: execl '%s -c %s'", shell, (char *)arg);
1402 +
			execl(shell, shell, "-c", arg->c, (char *)NULL);
1403 +
			fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg->c);
1403 1404
			perror(" failed");
1404 1405
		}
1405 1406
		exit(0);
1408 1409
}
1409 1410
1410 1411
void
1411 -
tag(const void *arg) {
1412 -
	if(sel && *(int *)arg & TAGMASK) {
1413 -
		sel->tags = *(int *)arg & TAGMASK;
1412 +
tag(const Arg *arg) {
1413 +
	if(sel && arg->ui & TAGMASK) {
1414 +
		sel->tags = arg->ui & TAGMASK;
1414 1415
		arrange();
1415 1416
	}
1416 1417
}
1461 1462
}
1462 1463
1463 1464
void
1464 -
togglebar(const void *arg) {
1465 +
togglebar(const Arg *arg) {
1465 1466
	showbar = !showbar;
1466 1467
	updategeom();
1467 1468
	updatebar();
1469 1470
}
1470 1471
1471 1472
void
1472 -
togglefloating(const void *arg) {
1473 +
togglefloating(const Arg *arg) {
1473 1474
	if(!sel)
1474 1475
		return;
1475 1476
	sel->isfloating = !sel->isfloating || sel->isfixed;
1479 1480
}
1480 1481
1481 1482
void
1482 -
togglelayout(const void *arg) {
1483 +
togglelayout(const Arg *arg) {
1483 1484
	uint i;
1484 1485
1485 -
	if(!arg) {
1486 +
	if(!arg->c) {
1486 1487
		if(++lt == &layouts[LENGTH(layouts)])
1487 1488
			lt = &layouts[0];
1488 1489
	}
1489 1490
	else {
1490 1491
		for(i = 0; i < LENGTH(layouts); i++)
1491 -
			if(!strcmp((char *)arg, layouts[i].symbol))
1492 +
			if(!strcmp(arg->c, layouts[i].symbol))
1492 1493
				break;
1493 1494
		if(i == LENGTH(layouts))
1494 1495
			return;
1501 1502
}
1502 1503
1503 1504
void
1504 -
togglemax(const void *arg) {
1505 +
togglemax(const Arg *arg) {
1505 1506
	ismax = !ismax;
1506 1507
	arrange();
1507 1508
}
1508 1509
1509 1510
void
1510 -
toggletag(const void *arg) {
1511 -
	if(sel && (sel->tags ^ ((*(int *)arg) & TAGMASK))) {
1512 -
		sel->tags ^= (*(int *)arg) & TAGMASK;
1511 +
toggletag(const Arg *arg) {
1512 +
	if(sel && (sel->tags ^= (arg->ui & TAGMASK)))
1513 1513
		arrange();
1514 -
	}
1515 1514
}
1516 1515
1517 1516
void
1518 -
toggleview(const void *arg) {
1519 -
	if((tagset[seltags] ^ ((*(int *)arg) & TAGMASK))) {
1520 -
		tagset[seltags] ^= (*(int *)arg) & TAGMASK;
1517 +
toggleview(const Arg *arg) {
1518 +
	if((tagset[seltags] ^= (arg->ui & TAGMASK)))
1521 1519
		arrange();
1522 -
	}
1523 1520
}
1524 1521
1525 1522
void
1628 1625
	else
1629 1626
		c->minw = c->minh = 0;
1630 1627
	if(size.flags & PAspect) {
1631 -
		c->minax = size.min_aspect.x;
1632 -
		c->maxax = size.max_aspect.x;
1633 -
		c->minay = size.min_aspect.y;
1634 -
		c->maxay = size.max_aspect.y;
1628 +
		c->mina = (float)size.min_aspect.y / (float)size.min_aspect.x;
1629 +
		c->maxa = (float)size.max_aspect.x / (float)size.max_aspect.y;
1635 1630
	}
1636 1631
	else
1637 -
		c->minax = c->maxax = c->minay = c->maxay = 0;
1632 +
		c->maxa = c->mina = 0.0;
1638 1633
	c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
1639 1634
			&& c->maxw == c->minw && c->maxh == c->minh);
1640 1635
}
1659 1654
}
1660 1655
1661 1656
void
1662 -
view(const void *arg) {
1657 +
view(const Arg *arg) {
1663 1658
	seltags ^= 1; /* toggle sel tagset */
1664 -
	if(arg && (*(int *)arg & TAGMASK))
1665 -
		tagset[seltags] = *(int *)arg & TAGMASK;
1659 +
	if(arg && (arg->ui & TAGMASK))
1660 +
		tagset[seltags] = arg->i & TAGMASK;
1666 1661
	arrange();
1667 1662
}
1668 1663
1700 1695
}
1701 1696
1702 1697
void
1703 -
zoom(const void *arg) {
1698 +
zoom(const Arg *arg) {
1704 1699
	Client *c = sel;
1705 1700
1706 1701
	if(ismax || !lt->arrange || (sel && sel->isfloating))