aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2019-02-04 00:29:26 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-02-04 19:49:34 +0100
commit153aaf88bf9bf5c6c4b118bd871f8cf1eafdcab5 (patch)
treed54f40d8d846756d33128db749b831afecde1bac
parent65be875f5adf31e9c4762ac8a8d74b1dfdd78584 (diff)
Close when the embedding window is destroyed
-rw-r--r--LICENSE2
-rw-r--r--dmenu.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
index 6ed8ad3..9762166 100644
--- a/LICENSE
+++ b/LICENSE
@@ -9,7 +9,7 @@ MIT/X Consortium License
9© 2009 Evan Gates <evan.gates@gmail.com> 9© 2009 Evan Gates <evan.gates@gmail.com>
10© 2010-2012 Connor Lane Smith <cls@lubutu.com> 10© 2010-2012 Connor Lane Smith <cls@lubutu.com>
11© 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org> 11© 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org>
12© 2015-2018 Quentin Rameau <quinq@fifth.space> 12© 2015-2019 Quentin Rameau <quinq@fifth.space>
13 13
14Permission is hereby granted, free of charge, to any person obtaining a 14Permission is hereby granted, free of charge, to any person obtaining a
15copy of this software and associated documentation files (the "Software"), 15copy of this software and associated documentation files (the "Software"),
diff --git a/dmenu.c b/dmenu.c
index 6b8f51b..f803149 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -556,6 +556,11 @@ run(void)
556 if (XFilterEvent(&ev, None)) 556 if (XFilterEvent(&ev, None))
557 continue; 557 continue;
558 switch(ev.type) { 558 switch(ev.type) {
559 case DestroyNotify:
560 if (ev.xdestroywindow.window != win)
561 break;
562 cleanup();
563 exit(1);
559 case Expose: 564 case Expose:
560 if (ev.xexpose.count == 0) 565 if (ev.xexpose.count == 0)
561 drw_map(drw, win, 0, 0, mw, mh); 566 drw_map(drw, win, 0, 0, mw, mh);
@@ -667,7 +672,7 @@ setup(void)
667 XMapRaised(dpy, win); 672 XMapRaised(dpy, win);
668 XSetInputFocus(dpy, win, RevertToParent, CurrentTime); 673 XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
669 if (embed) { 674 if (embed) {
670 XSelectInput(dpy, parentwin, FocusChangeMask); 675 XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
671 if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { 676 if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
672 for (i = 0; i < du && dws[i] != win; ++i) 677 for (i = 0; i < du && dws[i] != win; ++i)
673 XSelectInput(dpy, dws[i], FocusChangeMask); 678 XSelectInput(dpy, dws[i], FocusChangeMask);