#include <string.h>
#include <strings.h>
#include <time.h>
-#ifdef __OpenBSD__
#include <unistd.h>
-#endif
#include <X11/Xlib.h>
#include <X11/Xatom.h>
if (XFilterEvent(&ev, None))
continue;
switch(ev.type) {
+ case DestroyNotify:
+ if (ev.xdestroywindow.window != win)
+ break;
+ cleanup();
+ exit(1);
case Expose:
if (ev.xexpose.count == 0)
drw_map(drw, win, 0, 0, mw, mh);
XMapRaised(dpy, win);
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
if (embed) {
- XSelectInput(dpy, parentwin, FocusChangeMask);
+ XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
for (i = 0; i < du && dws[i] != win; ++i)
XSelectInput(dpy, dws[i], FocusChangeMask);
die("pledge");
#endif
- if (fast) {
+ if (fast && !isatty(0)) {
grabkeyboard();
readstdin();
} else {