2 const char *name; /* For easy discovery in gdb */
3 struct pane *parent safe;
4 struct list_head siblings;
5 struct list_head children;
9 short cx, cy; /* cursor position */
17 /* timestamp is low bits of time in milliseconds when some
18 * command started. This makes it easy to check when we
19 * have done too much work.
20 * 0 means nothing is running.
21 * 1 means time is exhausted
23 unsigned int timestamp;
25 struct pane *root safe;
26 struct command *handle;
27 struct attrset *attrs;
28 struct list_head notifiers, notifiees;
32 PANE_DATA_TYPE data[1];
37 DOC_DATA_TYPE doc_data[1];
39 #ifdef PANE_DATA_TYPE_2
40 PANE_DATA_TYPE_2 data2[1];
46 bool pane_too_long(struct pane *p safe, unsigned int msec);
47 void pane_set_time(struct pane *p safe);
48 static inline void pane_end_time(struct pane *p safe)
53 static inline struct pane * safe pane_root(struct pane *p safe)
58 static inline void time_starts(struct pane *p safe)
60 pane_set_time(pane_root(p));
63 static inline void time_ends(struct pane *p safe)
65 pane_end_time(pane_root(p));
68 static inline bool times_up(struct pane *p safe)
70 return pane_too_long(pane_root(p), 15000);
73 static inline bool times_up_fast(struct pane *p safe)
75 return pane_root(p)->timestamp == 1;
78 static inline struct pane *safe pane_leaf(struct pane *p safe)
82 while ((f = p->focus) != NULL)
87 static inline struct pane *pane_get(struct pane *p safe) safe
92 static inline void pane_put(struct pane *p safe)
98 static inline int do_call_val(enum target_type type, struct pane *home,
99 struct command *comm2a,
100 const char *key safe, struct pane *focus safe,
101 int num, struct mark *m, const char *str,
102 int num2, struct mark *m2, const char *str2,
103 int x, int y, struct command *comm2b)
105 struct cmd_info ci = {.key = key, .focus = focus, .home = focus,
106 .num = num, .mark = m, .str = str,
107 .num2 = num2, .mark2 = m2, .str2 = str2,
108 .comm2 = comm2a ?: comm2b, .x = x, .y = y,
109 .comm = safe_cast NULL};
112 if ((type == TYPE_pane || type == TYPE_home) && !home)
114 if (type == TYPE_comm && !comm2a)
116 ASSERT(!comm2a || !comm2b || comm2a == comm2b || type == TYPE_comm);
125 ret = key_handle(&ci);
128 if (!home->handle || (home->damaged & DAMAGED_DEAD))
130 if (times_up_fast(focus))
134 if ((home->damaged & DAMAGED_CLOSED) &&
135 strncmp(ci.key, "Close", 5) != 0 &&
136 strcmp(ci.key, "Notify:Close") != 0 &&
137 strcmp(ci.key, "Free") != 0)
138 /* This pane cannot accept anything but
139 * "Close" or "Close:mark" or "Free"
142 ci.comm = home->handle;
143 ret = ci.comm->func(&ci);
146 if (times_up_fast(focus))
150 if (ci.home->damaged & DAMAGED_CLOSED)
154 ret = ci.comm->func(&ci);