ci2.extra |= DAMAGED_CONTENT;
if (ci2.extra & DAMAGED_CONTENT)
ci2.extra |= DAMAGED_CURSOR;
- damage &= DAMAGED_SIZE;
+ damage &= DAMAGED_SIZE | DAMAGED_EVENTS;
ci2.comm = p->handle;
ret = p->handle->func(&ci2);
if (ret == 0)
struct command *comm);
struct command *key_register_prefix(char *name);
+/* DAMAGED_SIZE and DAMAGED_EVENTS propagate down.
+ * DAMAGED_CURSOR propagates up.
+ * If any flag is set on children, DAMAGED_CHILD is set.
+ */
enum {
DAMAGED_CHILD = 1,
DAMAGED_SIZE = 2, /* these three each impose the next. */
DAMAGED_CURSOR = 8,
DAMAGED_CLOSED = 1024,
+ DAMAGED_EVENTS = 2048, /* event loop changed, resubmit requests */
};
struct pane *pane_register(struct pane *parent, int z,
int damage = ci->extra;
if (damage & DAMAGED_SIZE)
getmaxyx(stdscr, p->h, p->w);
+ if (damage & DAMAGED_EVENTS) {
+ call_home(p, "event:read", p, 0, NULL,
+ &input_handle);
+ call_home(p, "event:signal", p, SIGWINCH, NULL,
+ &handle_winch);
+ }
}
return 2; /* request post-order call */
}
key_handle(&ci);
pane_refresh(&ed->root);
- call3("event:run", vroot, 0, NULL);
+ while (call3("event:run", vroot, 0, NULL) == 1)
+ ;
}
pane_close(&ed->root);
exit(0);
DEF_CMD(libevent_run)
{
struct event_base *b = base;
+ if (!b)
+ return 0;
+
event_base_dispatch(b);
while (!list_empty(&event_list)) {
struct evt *ev = list_first_entry(&event_list, struct evt, lst);