equal
deleted
inserted
replaced
180 static void setclientstate(Client *c, long state); |
180 static void setclientstate(Client *c, long state); |
181 static void setlayout(const Arg *arg); |
181 static void setlayout(const Arg *arg); |
182 static void setmfact(const Arg *arg); |
182 static void setmfact(const Arg *arg); |
183 static void setup(void); |
183 static void setup(void); |
184 static void showhide(Client *c); |
184 static void showhide(Client *c); |
|
185 static void sigchld(int signal); |
185 static void spawn(const Arg *arg); |
186 static void spawn(const Arg *arg); |
186 static void tag(const Arg *arg); |
187 static void tag(const Arg *arg); |
187 static int textnw(const char *text, unsigned int len); |
188 static int textnw(const char *text, unsigned int len); |
188 static void tile(void); |
189 static void tile(void); |
189 static void togglebar(const Arg *arg); |
190 static void togglebar(const Arg *arg); |
1389 showhide(c->snext); |
1390 showhide(c->snext); |
1390 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
1391 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
1391 } |
1392 } |
1392 } |
1393 } |
1393 |
1394 |
|
1395 |
|
1396 void |
|
1397 sigchld(int signal) { |
|
1398 while(0 < waitpid(-1, NULL, WNOHANG)); |
|
1399 } |
|
1400 |
1394 void |
1401 void |
1395 spawn(const Arg *arg) { |
1402 spawn(const Arg *arg) { |
1396 /* The double-fork construct avoids zombie processes and keeps the code |
1403 signal(SIGCHLD, sigchld); |
1397 * clean from stupid signal handlers. */ |
|
1398 if(fork() == 0) { |
1404 if(fork() == 0) { |
1399 if(fork() == 0) { |
1405 if(dpy) |
1400 if(dpy) |
1406 close(ConnectionNumber(dpy)); |
1401 close(ConnectionNumber(dpy)); |
1407 setsid(); |
1402 setsid(); |
1408 execvp(((char **)arg->v)[0], (char **)arg->v); |
1403 execvp(((char **)arg->v)[0], (char **)arg->v); |
1409 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
1404 fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
1410 perror(" failed"); |
1405 perror(" failed"); |
|
1406 } |
|
1407 exit(0); |
1411 exit(0); |
1408 } |
1412 } |
1409 wait(0); |
|
1410 } |
1413 } |
1411 |
1414 |
1412 void |
1415 void |
1413 tag(const Arg *arg) { |
1416 tag(const Arg *arg) { |
1414 if(sel && arg->ui & TAGMASK) { |
1417 if(sel && arg->ui & TAGMASK) { |
1453 h = wh / n; |
1456 h = wh / n; |
1454 if(h < bh) |
1457 if(h < bh) |
1455 h = wh; |
1458 h = wh; |
1456 |
1459 |
1457 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
1460 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
1458 if(i + 1 == n) { /* remainder */ |
1461 resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) |
1459 if(wy + wh - y < bh) |
1462 ? wy + wh - y - 2 * c->bw : h - 2 * c->bw), resizehints); |
1460 resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, False); |
|
1461 else |
|
1462 resize(c, x, y, w - 2 * c->bw, wy + wh - y - 2 * c->bw, resizehints); |
|
1463 } |
|
1464 else |
|
1465 resize(c, x, y, w - 2 * c->bw, h - 2 * c->bw, resizehints); |
|
1466 if(h != wh) |
1463 if(h != wh) |
1467 y = c->y + HEIGHT(c); |
1464 y = c->y + HEIGHT(c); |
1468 } |
1465 } |
1469 } |
1466 } |
1470 |
1467 |