moved focus{next,prev} and nexttiled from client.c to layout.c (because those are not client-specific), moved toggleversatile() from layout.c to client.c (because those are client-specific) 29c26b88
Anselm R. Garbe · 2007-02-21 11:39 3 file(s) · +50 −50
client.c +8 −38
171 171
}
172 172
173 173
void
174 -
focusnext(Arg *arg) {
175 -
	Client *c;
176 -
   
177 -
	if(!sel)
178 -
		return;
179 -
	for(c = sel->next; c && !isvisible(c); c = c->next);
180 -
	if(!c)
181 -
		for(c = clients; c && !isvisible(c); c = c->next);
182 -
	if(c) {
183 -
		focus(c);
184 -
		restack();
185 -
	}
186 -
}
187 -
188 -
void
189 -
focusprev(Arg *arg) {
190 -
	Client *c;
191 -
192 -
	if(!sel)
193 -
		return;
194 -
	for(c = sel->prev; c && !isvisible(c); c = c->prev);
195 -
	if(!c) {
196 -
		for(c = clients; c && c->next; c = c->next);
197 -
		for(; c && !isvisible(c); c = c->prev);
198 -
	}
199 -
	if(c) {
200 -
		focus(c);
201 -
		restack();
202 -
	}
203 -
}
204 -
205 -
void
206 174
killclient(Arg *arg) {
207 175
	if(!sel)
208 176
		return;
266 234
	lt->arrange();
267 235
}
268 236
269 -
Client *
270 -
nexttiled(Client *c) {
271 -
	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
272 -
	return c;
273 -
}
274 -
275 237
void
276 238
resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
277 239
	float actual, dx, dy, max, min;
338 300
		configure(c);
339 301
		XSync(dpy, False);
340 302
	}
303 +
}
304 +
305 +
void
306 +
toggleversatile(Arg *arg) {
307 +
	if(!sel || lt->arrange == versatile)
308 +
		return;
309 +
	sel->isversatile = !sel->isversatile;
310 +
	lt->arrange();
341 311
}
342 312
343 313
void
dwm.h +4 −4
105 105
/* client.c */
106 106
extern void configure(Client *c);		/* send synthetic configure event */
107 107
extern void focus(Client *c);			/* focus c, c may be NULL */
108 -
extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
109 -
extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
110 108
extern void killclient(Arg *arg);		/* kill c nicely */
111 109
extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
112 -
extern Client *nexttiled(Client *c);		/* returns tiled successor of c */
113 110
extern void resize(Client *c, int x, int y,
114 111
		int w, int h, Bool sizehints);	/* resize with given coordinates c*/
112 +
extern void toggleversatile(Arg *arg);		/* toggles focused client between versatile/and non-versatile state */
115 113
extern void updatesizehints(Client *c);		/* update the size hint variables of c */
116 114
extern void updatetitle(Client *c);		/* update the name of c */
117 115
extern void unmanage(Client *c);		/* destroy c */
127 125
extern void grabkeys(void);			/* grab all keys defined in config.h */
128 126
129 127
/* layout.c */
128 +
extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
129 +
extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
130 130
extern void incnmaster(Arg *arg);		/* increments nmaster with arg's index value */
131 131
extern void initlayouts(void);			/* initialize layout array */
132 +
extern Client *nexttiled(Client *c);		/* returns tiled successor of c */
132 133
extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
133 134
extern void restack(void);			/* restores z layers of all clients */
134 135
extern void setlayout(Arg *arg);		/* sets layout, -1 toggles */
135 -
extern void toggleversatile(Arg *arg);		/* toggles focusesd client between versatile/and non-versatile state */
136 136
extern void versatile(void);			/* arranges all windows versatile */
137 137
138 138
/* main.c */
layout.c +38 −8
69 69
/* extern */
70 70
71 71
void
72 +
focusnext(Arg *arg) {
73 +
	Client *c;
74 +
   
75 +
	if(!sel)
76 +
		return;
77 +
	for(c = sel->next; c && !isvisible(c); c = c->next);
78 +
	if(!c)
79 +
		for(c = clients; c && !isvisible(c); c = c->next);
80 +
	if(c) {
81 +
		focus(c);
82 +
		restack();
83 +
	}
84 +
}
85 +
86 +
void
87 +
focusprev(Arg *arg) {
88 +
	Client *c;
89 +
90 +
	if(!sel)
91 +
		return;
92 +
	for(c = sel->prev; c && !isvisible(c); c = c->prev);
93 +
	if(!c) {
94 +
		for(c = clients; c && c->next; c = c->next);
95 +
		for(; c && !isvisible(c); c = c->prev);
96 +
	}
97 +
	if(c) {
98 +
		focus(c);
99 +
		restack();
100 +
	}
101 +
}
102 +
103 +
void
72 104
incnmaster(Arg *arg) {
73 105
	if((lt->arrange != tile) || (nmaster + arg->i < 1)
74 106
	|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
91 123
		if(w > blw)
92 124
			blw = w;
93 125
	}
126 +
}
127 +
128 +
Client *
129 +
nexttiled(Client *c) {
130 +
	for(; c && (c->isversatile || !isvisible(c)); c = c->next);
131 +
	return c;
94 132
}
95 133
96 134
void
151 189
		lt->arrange();
152 190
	else
153 191
		drawstatus();
154 -
}
155 -
156 -
void
157 -
toggleversatile(Arg *arg) {
158 -
	if(!sel || lt->arrange == versatile)
159 -
		return;
160 -
	sel->isversatile = !sel->isversatile;
161 -
	lt->arrange();
162 192
}
163 193
164 194
void