Colormap cmap;
Window win;
XdbeBackBuffer buf;
- Atom xembed;
+ Atom xembed, wmdeletewin;
XIM xim;
XIC xic;
XftDraw *xft_draw;
void
sigchld(int a) {
int stat = 0;
+
if(waitpid(pid, &stat, 0) < 0)
die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
- if(WIFEXITED(stat))
+
+ if(WIFEXITED(stat)) {
exit(WEXITSTATUS(stat));
- else
+ } else {
exit(EXIT_FAILURE);
+ }
}
void
&(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
+ xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
+ XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
xresettitle();
XMapWindow(xw.dpy, xw.win);
} else if(e->xclient.data.l[1] == XEMBED_FOCUS_OUT) {
xw.state &= ~WIN_FOCUSED;
}
+ } else if(e->xclient.data.l[0] == xw.wmdeletewin) {
+ /* Send SIGHUP to shell */
+ kill(pid, SIGHUP);
+ exit(EXIT_SUCCESS);
}
}