p = c;
return p;
}
+
+DEF_CMD(take_pane)
+{
+ struct call_return *cr = container_of(ci->comm, struct call_return, c);
+ cr->p = ci->focus;
+ return 1;
+}
+
+struct pane *call_pane(char *key, struct pane *focus, int numeric,
+ struct mark *m, int extra)
+{
+ struct cmd_info ci = {0};
+ struct call_return cr;
+
+ ci.key = key;
+ ci.focus = focus;
+ ci.numeric = numeric;
+ ci.extra = extra;
+ ci.mark = m;
+ cr.c = take_pane;
+ cr.p = NULL;
+ ci.comm2 = &cr.c;
+ if (!key_handle_focus(&ci))
+ return NULL;
+ return cr.p;
+}
void pane_clear(struct pane *p, char *attrs);
void pane_text(struct pane *p, wchar_t ch, char *attrs, int x, int y);
char *pane_attr_get(struct pane *p, char *key);
+struct pane *call_pane(char *key, struct pane *focus, int numeric,
+ struct mark *m, int extra);
static inline struct pane *pane_child(struct pane *p)
{
return comm->func(&ci);
}
-static inline struct pane *call_pane(char *key, struct pane *focus, int numeric,
- struct mark *m, int extra)
-{
- struct cmd_info ci = {0};
-
- ci.key = key;
- ci.focus = focus;
- ci.numeric = numeric;
- ci.extra = extra;
- ci.mark = m;
- if (!key_handle_focus(&ci))
- return NULL;
- return ci.focus;
-}
-
static inline int call_extra(char *key, struct pane *focus, int numeric, struct mark *m,
int extra)
{
pane_close(ppi->popup);
return 1;
}
- if (strcmp(ci->key, "popup:get-target") == 0) {
- ci->focus = ppi->target;
- return 1;
- }
+ if (strcmp(ci->key, "popup:get-target") == 0)
+ return comm_call(ci->comm2, "callback:get-target",
+ ppi->target, 0, NULL, NULL, 0);
+
return 0;
}
if (!list_empty(&ti->tiles)) {
struct tileinfo *ti2 = list_next_entry(ti, tiles);
- ci->focus = ti2->p;
- return 1;
+ return comm_call(ci->comm2, "callback:pane", ti2->p, 0,
+ NULL, NULL, 0);
}
/* Need to create a tile. If wider than 120 (FIXME configurable and
* pixel sensitive), horiz-split else vert
*/
p2 = tile_split(p, p->w >= 120, 1);
if (p2)
- ci->focus = p2;
- return 1;
+ return comm_call(ci->comm2, "callback:pane", p2, 0,
+ NULL, NULL, 0);
+ return -1;
}
DEF_CMD(tile_this)
{
- ci->focus = ci->home;
- return 1;
+ return comm_call(ci->comm2, "callback:pane", ci->home, 0,
+ NULL, NULL, 0);
}
DEF_CMD(tile_root)
p = p->parent;
ti = p->data;
}
- ci->focus = p;
- return 1;
+ return comm_call(ci->comm2, "callback:pane", p, 0,
+ NULL, NULL, 0);
}
void edlib_init(struct editor *ed)