From: NeilBrown Date: Fri, 11 Dec 2015 00:43:43 +0000 (+1100) Subject: Use new notifiers to close a popup when target disappears. X-Git-Tag: lca2016~64 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=c67ef439d74f3d5ed70c46d6a0084e8aaa5a13a4;p=edlib.git Use new notifiers to close a popup when target disappears. Signed-off-by: NeilBrown --- diff --git a/lib-popup.c b/lib-popup.c index 53914e65..836b5cc9 100644 --- a/lib-popup.c +++ b/lib-popup.c @@ -67,6 +67,12 @@ DEF_CMD(popup_handle) return 1; } + if (strcmp(ci->key, "Notify:Close") == 0) { + if (ci->focus == ppi->target) + pane_close(p); + return 1; + } + if (strcmp(ci->key, "Refresh") == 0) { popup_resize(p, ppi->style); return 1; @@ -175,6 +181,8 @@ DEF_CMD(popup_attach) attr_set_str(&ppi->popup->attrs, "borders", border, -1); attr_set_str(&ppi->popup->attrs, "render-wrap", "no", -1); + pane_add_notify(ppi->popup, ppi->target, "Notify:Close"); + if (ci->home) { p = doc_attach_view(ppi->popup, ci->home, NULL); } else {