]> git.neil.brown.name Git - edlib.git/commitdiff
display-xcb: merge display_xcb and xcb_new_display
authorNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 20:44:50 +0000 (06:44 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 21:03:47 +0000 (07:03 +1000)
These two function are largely equivalent, so xcb_new_display does a
couple of step that are not harmful for display_xcb.

So discard display_xcb and just use xcb_new_display.

Signed-off-by: NeilBrown <neil@brown.name>
display-x11-xcb.c

index 497ae3f1942aa8d15540221894bbce4a3d8bd115..4800793f300f64f9686f5f80de73f4be4f95751b 100644 (file)
@@ -1915,23 +1915,6 @@ abort:
        return NULL;
 }
 
-DEF_CMD(display_xcb)
-{
-       struct pane *p;
-       struct pane *ed = pane_root(ci->focus);
-       const char *d = ci->str;
-
-       if (!d)
-               return Enoarg;
-       p = xcb_display_init(d, ci->str2, ed);
-       if (p && ci->focus != ed)
-               /* Assume ci->focus is a document */
-               p = home_call_ret(pane, ci->focus, "doc:attach-view", p, 1);
-       if (p)
-               return comm_call(ci->comm2, "cb", p);
-       return Efail;
-}
-
 DEF_CMD(xcb_new_display)
 {
        struct pane *p;
@@ -1957,7 +1940,7 @@ DEF_CMD(xcb_new_display)
 
 void edlib_init(struct pane *ed safe)
 {
-       call_comm("global-set-command", ed, &display_xcb, 0, NULL,
+       call_comm("global-set-command", ed, &xcb_new_display, 0, NULL,
                  "attach-display-x11");
        call_comm("global-set-command", ed, &xcb_new_display, 0, NULL,
                  "interactive-cmd-x11window");