dwm.c
changeset 1355 9172f2200001
parent 1354 dced80b409d8
child 1356 d2658eac8ff9
equal deleted inserted replaced
1354:dced80b409d8 1355:9172f2200001
   178 static void scan(void);
   178 static void scan(void);
   179 static void setclientstate(Client *c, long state);
   179 static void setclientstate(Client *c, long state);
   180 static void setlayout(const Arg *arg);
   180 static void setlayout(const Arg *arg);
   181 static void setmfact(const Arg *arg);
   181 static void setmfact(const Arg *arg);
   182 static void setup(void);
   182 static void setup(void);
       
   183 static void showhide(Client *c);
   183 static void spawn(const Arg *arg);
   184 static void spawn(const Arg *arg);
   184 static void tag(const Arg *arg);
   185 static void tag(const Arg *arg);
   185 static int textnw(const char *text, unsigned int len);
   186 static int textnw(const char *text, unsigned int len);
   186 static void tile(void);
   187 static void tile(void);
   187 static void togglebar(const Arg *arg);
   188 static void togglebar(const Arg *arg);
   269 		c->tags = tagset[seltags];
   270 		c->tags = tagset[seltags];
   270 }
   271 }
   271 
   272 
   272 void
   273 void
   273 arrange(void) {
   274 arrange(void) {
   274 	Client *c;
   275 	if(stack)
   275 
   276 		showhide(stack);
   276 	for(c = clients; c; c = c->next)
       
   277 		if(ISVISIBLE(c)) {
       
   278 			XMoveWindow(dpy, c->win, c->x, c->y);
       
   279 			if(!lt[sellt]->arrange || c->isfloating)
       
   280 				resize(c, c->x, c->y, c->w, c->h, True);
       
   281 		}
       
   282 		else {
       
   283 			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
       
   284 		}
       
   285 
       
   286 	focus(NULL);
   277 	focus(NULL);
   287 	if(lt[sellt]->arrange)
   278 	if(lt[sellt]->arrange)
   288 		lt[sellt]->arrange();
   279 		lt[sellt]->arrange();
   289 	restack();
   280 	restack();
   290 }
   281 }
  1375 
  1366 
  1376 	grabkeys();
  1367 	grabkeys();
  1377 }
  1368 }
  1378 
  1369 
  1379 void
  1370 void
       
  1371 showhide(Client *c) {
       
  1372 	if(ISVISIBLE(c)) { /* show clients top down */
       
  1373 		XMoveWindow(dpy, c->win, c->x, c->y);
       
  1374 		if(!lt[sellt]->arrange || c->isfloating)
       
  1375 			resize(c, c->x, c->y, c->w, c->h, True);
       
  1376 	}
       
  1377 	if(c->snext) /* hide clients bottom up */
       
  1378 		showhide(c->snext);
       
  1379 	if(!ISVISIBLE(c))
       
  1380 		XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
       
  1381 }
       
  1382 
       
  1383 void
  1380 spawn(const Arg *arg) {
  1384 spawn(const Arg *arg) {
  1381 	/* The double-fork construct avoids zombie processes and keeps the code
  1385 	/* The double-fork construct avoids zombie processes and keeps the code
  1382 	 * clean from stupid signal handlers. */
  1386 	 * clean from stupid signal handlers. */
  1383 	if(fork() == 0) {
  1387 	if(fork() == 0) {
  1384 		if(fork() == 0) {
  1388 		if(fork() == 0) {