applied dfenze cleanups, fixed some comments in dwm.h ab3d6a7d
Anselm R. Garbe · 2007-05-14 11:54 4 file(s) · +20 −21
client.c +10 −4
153 153
}
154 154
155 155
void
156 +
focustopvisible(void) {
157 +
	Client *c;
158 +
159 +
	for(c = stack; c && !isvisible(c); c = c->snext);
160 +
	focus(c);
161 +
}
162 +
163 +
void
156 164
killclient(const char *arg) {
157 165
	XEvent ev;
158 166
391 399
	XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
392 400
	detach(c);
393 401
	detachstack(c);
394 -
	if(sel == c) {
395 -
		for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
396 -
		focus(nc);
397 -
	}
402 +
	if(sel == c)
403 +
		focustopvisible();
398 404
	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
399 405
	setclientstate(c, WithdrawnState);
400 406
	free(c->tags);
dwm.h +5 −4
100 100
void configure(Client *c);		/* send synthetic configure event */
101 101
void detach(Client *c);			/* detaches c from global client list */
102 102
void focus(Client *c);			/* focus c, c may be NULL */
103 -
void killclient(const char *arg);		/* kill c nicely */
103 +
void focustopvisible(void);	    /* focus top visible window on stack */
104 +
void killclient(const char *arg);		/* kill sel  nicely */
104 105
void manage(Window w, XWindowAttributes *wa);	/* manage new client */
105 106
void resize(Client *c, int x, int y,
106 107
		int w, int h, Bool sizehints);	/* resize with given coordinates c*/
107 -
void togglefloating(const char *arg);	/* toggles focused client between floating/tiled state */
108 +
void togglefloating(const char *arg);	/* toggles sel between floating/tiled state */
108 109
void updatesizehints(Client *c);		/* update the size hint variables of c */
109 110
void updatetitle(Client *c);		/* update the name of c */
110 111
void unmanage(Client *c);		/* destroy c */
137 138
void compileregs(void);			/* initialize regexps of rules defined in config.h */
138 139
Bool isvisible(Client *c);		/* returns True if client is visible */
139 140
void settags(Client *c, Client *trans);	/* sets tags of c */
140 -
void tag(const char *arg);		/* tags c with arg's index */
141 -
void toggletag(const char *arg);		/* toggles c tags with arg's index */
141 +
void tag(const char *arg);		/* tags sel with arg's index */
142 +
void toggletag(const char *arg);		/* toggles sel tags with arg's index */
142 143
void toggleview(const char *arg);	/* toggles the tag with arg's index (in)visible */
143 144
void view(const char *arg);		/* views the tag with arg's index */
144 145
event.c +1 −2
247 247
		focus(c);
248 248
	else if(ev->window == root) {
249 249
		selscreen = True;
250 -
		for(c = stack; c && !isvisible(c); c = c->snext);
251 -
		focus(c);
250 +
		focustopvisible();
252 251
	}
253 252
}
254 253
layout.c +4 −11
61 61
			c->isbanned = True;
62 62
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
63 63
		}
64 -
	if(!sel || !isvisible(sel)) {
65 -
		for(c = stack; c && !isvisible(c); c = c->snext);
66 -
		focus(c);
67 -
	}
64 +
	if(!sel || !isvisible(sel)) 
65 +
		focustopvisible();
68 66
	restack();
69 67
}
70 68
88 86
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
89 87
		}
90 88
	}
91 -
	if(!sel || !isvisible(sel)) {
92 -
		for(c = stack; c && !isvisible(c); c = c->snext);
93 -
		focus(c);
94 -
	}
89 +
	if(!sel || !isvisible(sel))
90 +
		focustopvisible();
95 91
	restack();
96 92
}
97 93
241 237
242 238
void
243 239
zoom(const char *arg) {
244 -
	unsigned int n;
245 240
	Client *c;
246 241
247 242
	if(!sel || lt->arrange != tile || sel->isfloating)
248 243
		return;
249 -
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
250 -
		n++;
251 244
	if((c = sel) == nexttiled(clients))
252 245
		if(!(c = nexttiled(c->next)))
253 246
			return;