Skip to content

Commit

Permalink
Close when the embedding window is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Rameau authored and hiltjo committed Feb 4, 2019
1 parent 65be875 commit 153aaf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MIT/X Consortium License
© 2009 Evan Gates <[email protected]>
© 2010-2012 Connor Lane Smith <[email protected]>
© 2014-2019 Hiltjo Posthuma <[email protected]>
© 2015-2018 Quentin Rameau <[email protected]>
© 2015-2019 Quentin Rameau <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
Expand Down
7 changes: 6 additions & 1 deletion dmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ run(void)
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);
Expand Down Expand Up @@ -667,7 +672,7 @@ setup(void)
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);
Expand Down

0 comments on commit 153aaf8

Please sign in to comment.