]> git.neil.brown.name Git - edlib.git/commitdiff
Use new notifiers to close a popup when target disappears.
authorNeilBrown <neil@brown.name>
Fri, 11 Dec 2015 00:43:43 +0000 (11:43 +1100)
committerNeilBrown <neil@brown.name>
Fri, 11 Dec 2015 00:43:43 +0000 (11:43 +1100)
Signed-off-by: NeilBrown <neil@brown.name>
lib-popup.c

index 53914e65d7e325f6179395ab6116b54f9d6eb216..836b5cc902d7a7534c970b8ab7ad022ce3bc1a76 100644 (file)
@@ -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 {