X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=e2f306c1e64fbf20bfee3a6a7dd3da5667b2d815;hp=e22ea7adbc0878931472e5424dde6b5fcc12d2b8;hb=8ef465d592fada11dab075bb7569239c03e3afa4;hpb=999d6e795f26f85e4b4b59adb7637ec067a9deee diff --git a/dwm.c b/dwm.c index e22ea7a..e2f306c 100644 --- a/dwm.c +++ b/dwm.c @@ -207,7 +207,7 @@ static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); static void showhide(Client *c); -static void sigchld(int signal); +static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -1428,6 +1428,9 @@ setup(void) { int w; XSetWindowAttributes wa; + /* clean up any zombies immediately */ + sigchld(0); + /* init screen */ screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); @@ -1496,13 +1499,14 @@ showhide(Client *c) { void -sigchld(int signal) { +sigchld(int unused) { + if(signal(SIGCHLD, sigchld) == SIG_ERR) + die("Can't install SIGCHLD handler"); while(0 < waitpid(-1, NULL, WNOHANG)); } void spawn(const Arg *arg) { - signal(SIGCHLD, sigchld); if(fork() == 0) { if(dpy) close(ConnectionNumber(dpy)); @@ -1688,10 +1692,16 @@ updategeom(void) { Monitor *newmons = NULL, *m = NULL, *tm; #ifdef XINERAMA + int nn; XineramaScreenInfo *info = NULL; if(XineramaIsActive(dpy)) info = XineramaQueryScreens(dpy, &n); + for(i = 1, nn = n; i < n; i++) + if(info[i - 1].x_org == info[i].x_org && info[i - 1].y_org == info[i].y_org + && info[i - 1].width == info[i].width && info[i - 1].height == info[i].height) + --nn; + n = nn; /* we only consider unique geometries as separate screens */ #endif /* XINERAMA */ /* allocate monitor(s) for the new geometry setup */ for(i = 0; i < n; i++) {