From f22148e512454d40ff995b5fd7ada209521e2a47 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 4 Feb 2019 00:29:26 +0100 Subject: [PATCH] Close when the embedding window is destroyed --- dmenubar/LICENSE | 2 +- dmenubar/dmenu.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dmenubar/LICENSE b/dmenubar/LICENSE index 6ed8ad3..9762166 100644 --- a/dmenubar/LICENSE +++ b/dmenubar/LICENSE @@ -9,7 +9,7 @@ MIT/X Consortium License © 2009 Evan Gates © 2010-2012 Connor Lane Smith © 2014-2019 Hiltjo Posthuma -© 2015-2018 Quentin Rameau +© 2015-2019 Quentin Rameau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/dmenubar/dmenu.c b/dmenubar/dmenu.c index 6b8f51b..f803149 100644 --- a/dmenubar/dmenu.c +++ b/dmenubar/dmenu.c @@ -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); @@ -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);