final style fixes 450b08dd
Anselm R Garbe · 2009-07-14 16:26 1 file(s) · +13 −15
dwm.c +13 −15
380 380
arrange(void) {
381 381
	Monitor *m;
382 382
383 -
	/* optimise two loops into one, check focus(NULL) */
384 383
	for(m = mons; m; m = m->next)
385 384
		showhide(m->stack);
386 385
	focus(NULL);
440 439
	}
441 440
	for(i = 0; i < LENGTH(buttons); i++)
442 441
		if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
443 -
		   && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
442 +
		&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
444 443
			buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
445 444
}
446 445
885 884
	Atom real;
886 885
887 886
	status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState],
888 -
			&real, &format, &n, &extra, (unsigned char **)&p);
887 +
	                            &real, &format, &n, &extra, (unsigned char **)&p);
889 888
	if(status != Success)
890 889
		return -1;
891 890
	if(n != 0)
909 908
	if(name.encoding == XA_STRING)
910 909
		strncpy(text, (char *)name.value, size - 1);
911 910
	else {
912 -
		if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
913 -
		&& n > 0 && *list)
914 -
		{
911 +
		if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
915 912
			strncpy(text, *list, size - 1);
916 913
			XFreeStringList(list);
917 914
		}
1022 1019
	keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
1023 1020
	for(i = 0; i < LENGTH(keys); i++)
1024 1021
		if(keysym == keys[i].keysym
1025 -
		   && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
1026 -
		   && keys[i].func)
1022 +
		&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
1023 +
		&& keys[i].func)
1027 1024
			keys[i].func(&(keys[i].arg));
1028 1025
}
1029 1026
1168 1165
			nx = ocx + (ev.xmotion.x - x);
1169 1166
			ny = ocy + (ev.xmotion.y - y);
1170 1167
			if(snap && nx >= selmon->wx && nx <= selmon->wx + selmon->ww
1171 -
			        && ny >= selmon->wy && ny <= selmon->wy + selmon->wh) {
1168 +
			&& ny >= selmon->wy && ny <= selmon->wy + selmon->wh) {
1172 1169
				if(abs(selmon->wx - nx) < snap)
1173 1170
					nx = selmon->wx;
1174 1171
				else if(abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
1178 1175
				else if(abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
1179 1176
					ny = selmon->wy + selmon->wh - HEIGHT(c);
1180 1177
				if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
1181 -
				                  && (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
1178 +
				&& (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
1182 1179
					togglefloating(NULL);
1183 1180
			}
1184 1181
			if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1279 1276
	ocx = c->x;
1280 1277
	ocy = c->y;
1281 1278
	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
1282 -
	None, cursor[CurResize], CurrentTime) != GrabSuccess)
1279 +
	                None, cursor[CurResize], CurrentTime) != GrabSuccess)
1283 1280
		return;
1284 1281
	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
1285 1282
	do {
1294 1291
			nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
1295 1292
			nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
1296 1293
			if(snap && nw >= selmon->wx && nw <= selmon->wx + selmon->ww
1297 -
			        && nh >= selmon->wy && nh <= selmon->wy + selmon->wh) {
1294 +
			&& nh >= selmon->wy && nh <= selmon->wy + selmon->wh)
1295 +
			{
1298 1296
				if(!c->isfloating && selmon->lt[selmon->sellt]->arrange
1299 -
				   && (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
1297 +
				&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
1300 1298
					togglefloating(NULL);
1301 1299
			}
1302 1300
			if(!selmon->lt[selmon->sellt]->arrange || c->isfloating)
1473 1471
	/* select for events */
1474 1472
	wa.cursor = cursor[CurNormal];
1475 1473
	wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask
1476 -
			|EnterWindowMask|LeaveWindowMask|StructureNotifyMask
1477 -
			|PropertyChangeMask;
1474 +
	                |EnterWindowMask|LeaveWindowMask|StructureNotifyMask
1475 +
	                |PropertyChangeMask;
1478 1476
	XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
1479 1477
	XSelectInput(dpy, root, wa.event_mask);
1480 1478
	grabkeys();