Line | Count | Source |
1 | | /* $OpenBSD: tmux.h,v 1.1431 2026/08/25 08:37:08 nicm Exp $ */ |
2 | | |
3 | | /* |
4 | | * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> |
5 | | * |
6 | | * Permission to use, copy, modify, and distribute this software for any |
7 | | * purpose with or without fee is hereby granted, provided that the above |
8 | | * copyright notice and this permission notice appear in all copies. |
9 | | * |
10 | | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | | * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER |
15 | | * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING |
16 | | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | | */ |
18 | | |
19 | | #ifndef TMUX_H |
20 | | #define TMUX_H |
21 | | |
22 | | #include <sys/time.h> |
23 | | #include <sys/uio.h> |
24 | | |
25 | | #include <limits.h> |
26 | | #include <stdarg.h> |
27 | | #include <stdio.h> |
28 | | #include <termios.h> |
29 | | #include <wchar.h> |
30 | | |
31 | | #ifdef HAVE_UTEMPTER |
32 | | #include <utempter.h> |
33 | | #endif |
34 | | |
35 | | #include "compat.h" |
36 | | #include "tmux-protocol.h" |
37 | | #include "xmalloc.h" |
38 | | |
39 | | extern char **environ; |
40 | | |
41 | | struct args; |
42 | | struct args_command_state; |
43 | | struct client; |
44 | | struct cmd; |
45 | | struct cmd_find_state; |
46 | | struct cmdq_item; |
47 | | struct cmdq_list; |
48 | | struct cmdq_state; |
49 | | struct cmds; |
50 | | struct control_state; |
51 | | struct environ; |
52 | | struct event_payload; |
53 | | struct event_payload_item; |
54 | | struct events_sink; |
55 | | struct format_job_tree; |
56 | | struct format_tree; |
57 | | struct hyperlinks_uri; |
58 | | struct hyperlinks; |
59 | | struct input_ctx; |
60 | | struct input_request; |
61 | | struct input_requests; |
62 | | struct job; |
63 | | struct menu_data; |
64 | | struct mode_tree_data; |
65 | | struct mouse_event; |
66 | | struct options; |
67 | | struct options_array_item; |
68 | | struct options_entry; |
69 | | struct prompt; |
70 | | struct window_pane_prompt; |
71 | | struct redraw_scene; |
72 | | struct redraw_span; |
73 | | struct screen_write_citem; |
74 | | struct screen_write_cline; |
75 | | struct screen_write_ctx; |
76 | | struct session; |
77 | | |
78 | | #ifdef ENABLE_SIXEL |
79 | | struct sixel_image; |
80 | | #endif |
81 | | |
82 | | struct tty_ctx; |
83 | | struct tty_code; |
84 | | struct tty_key; |
85 | | struct tmuxpeer; |
86 | | struct tmuxproc; |
87 | | struct winlink; |
88 | | |
89 | | /* Default configuration files and socket paths. */ |
90 | | #ifndef TMUX_CONF |
91 | | #define TMUX_CONF "/etc/tmux.conf:~/.tmux.conf" |
92 | | #endif |
93 | | #ifndef TMUX_SOCK |
94 | 0 | #define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP |
95 | | #endif |
96 | | #ifndef TMUX_SOCK_PERM |
97 | 0 | #define TMUX_SOCK_PERM (7 /* o+rwx */) |
98 | | #endif |
99 | | #ifndef TMUX_TERM |
100 | | #define TMUX_TERM "screen" |
101 | | #endif |
102 | | #ifndef TMUX_LOCK_CMD |
103 | | #define TMUX_LOCK_CMD "lock -np" |
104 | | #endif |
105 | | #ifndef TMUX_MOUSE |
106 | | #define TMUX_MOUSE 0 |
107 | | #endif |
108 | | |
109 | | /* Minimum and maximum layout cell size, NOT including border lines. */ |
110 | 0 | #define PANE_MINIMUM 1 |
111 | 0 | #define PANE_MAXIMUM 10000 |
112 | | |
113 | | /* Minimum and maximum window size. */ |
114 | 0 | #define WINDOW_MINIMUM PANE_MINIMUM |
115 | 0 | #define WINDOW_MAXIMUM 10000 |
116 | | |
117 | | /* Automatic name refresh interval, in microseconds. Must be < 1 second. */ |
118 | 0 | #define NAME_INTERVAL 500000 |
119 | | |
120 | | /* Default pixel cell sizes. */ |
121 | 0 | #define DEFAULT_XPIXEL 16 |
122 | 0 | #define DEFAULT_YPIXEL 32 |
123 | | |
124 | | /* Attribute to make GCC check printf-like arguments. */ |
125 | | #define printflike(a, b) __attribute__ ((format (printf, a, b))) |
126 | | |
127 | | /* Number of items in array. */ |
128 | | #ifndef nitems |
129 | 13.5M | #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) |
130 | | #endif |
131 | | |
132 | | /* Alert option values. */ |
133 | | #define ALERT_NONE 0 |
134 | 0 | #define ALERT_ANY 1 |
135 | 0 | #define ALERT_CURRENT 2 |
136 | 0 | #define ALERT_OTHER 3 |
137 | | |
138 | | /* Visual option values. */ |
139 | 0 | #define VISUAL_OFF 0 |
140 | | #define VISUAL_ON 1 |
141 | 0 | #define VISUAL_BOTH 2 |
142 | | |
143 | | /* Key modifier bits. */ |
144 | 1.10k | #define KEYC_META 0x00100000000000ULL |
145 | 1.10k | #define KEYC_CTRL 0x00200000000000ULL |
146 | 1.10k | #define KEYC_SHIFT 0x00400000000000ULL |
147 | | |
148 | | /* Key flag bits. */ |
149 | 1.10k | #define KEYC_LITERAL 0x01000000000000ULL |
150 | 0 | #define KEYC_KEYPAD 0x02000000000000ULL |
151 | 0 | #define KEYC_CURSOR 0x04000000000000ULL |
152 | 0 | #define KEYC_IMPLIED_META 0x08000000000000ULL |
153 | 0 | #define KEYC_BUILD_MODIFIERS 0x10000000000000ULL |
154 | 0 | #define KEYC_VI 0x20000000000000ULL |
155 | 0 | #define KEYC_SENT 0x40000000000000ULL |
156 | | |
157 | | /* Masks for key bits. */ |
158 | 2.05k | #define KEYC_MASK_TYPE 0x0000ff00000000ULL |
159 | 0 | #define KEYC_MASK_MODIFIERS 0x00ff0000000000ULL |
160 | 0 | #define KEYC_MASK_FLAGS 0xff000000000000ULL |
161 | 1.41M | #define KEYC_MASK_KEY 0x0000ffffffffffULL |
162 | | |
163 | 0 | #define KEYC_NUSER 1000 |
164 | 3.08k | #define KEYC_SHIFT_TYPE(t) ((unsigned long long)(t) << 32) |
165 | 0 | #define KEYC_IS_TYPE(k, t) (((k) & KEYC_MASK_TYPE) == KEYC_SHIFT_TYPE(t)) |
166 | | enum key_code_type { |
167 | | KEYC_TYPE_UNICODE, |
168 | | KEYC_TYPE_USER, |
169 | | KEYC_TYPE_FUNCTION, |
170 | | KEYC_TYPE_MOUSEMOVE, |
171 | | KEYC_TYPE_MOUSEDOWN, |
172 | | KEYC_TYPE_MOUSEUP, |
173 | | KEYC_TYPE_MOUSEDRAG, |
174 | | KEYC_TYPE_MOUSEDRAGEND, |
175 | | KEYC_TYPE_WHEELDOWN, |
176 | | KEYC_TYPE_WHEELUP, |
177 | | KEYC_TYPE_SECONDCLICK, |
178 | | KEYC_TYPE_DOUBLECLICK, |
179 | | KEYC_TYPE_TRIPLECLICK, |
180 | | KEYC_TYPE_NOTYPE /* end */ |
181 | | }; |
182 | | |
183 | | enum key_code_mouse_location { |
184 | | KEYC_MOUSE_LOCATION_PANE, |
185 | | KEYC_MOUSE_LOCATION_STATUS, |
186 | | KEYC_MOUSE_LOCATION_STATUS_LEFT, |
187 | | KEYC_MOUSE_LOCATION_STATUS_RIGHT, |
188 | | KEYC_MOUSE_LOCATION_STATUS_DEFAULT, |
189 | | KEYC_MOUSE_LOCATION_BORDER, |
190 | | KEYC_MOUSE_LOCATION_SCROLLBAR_UP, |
191 | | KEYC_MOUSE_LOCATION_SCROLLBAR_SLIDER, |
192 | | KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN, |
193 | | KEYC_MOUSE_LOCATION_EMPTY, |
194 | | KEYC_MOUSE_LOCATION_CONTROL0, /* keep order */ |
195 | | KEYC_MOUSE_LOCATION_CONTROL1, |
196 | | KEYC_MOUSE_LOCATION_CONTROL2, |
197 | | KEYC_MOUSE_LOCATION_CONTROL3, |
198 | | KEYC_MOUSE_LOCATION_CONTROL4, |
199 | | KEYC_MOUSE_LOCATION_CONTROL5, |
200 | | KEYC_MOUSE_LOCATION_CONTROL6, |
201 | | KEYC_MOUSE_LOCATION_CONTROL7, |
202 | | KEYC_MOUSE_LOCATION_CONTROL8, |
203 | | KEYC_MOUSE_LOCATION_CONTROL9, |
204 | | KEYC_MOUSE_LOCATION_NOWHERE /* end */ |
205 | | }; |
206 | | |
207 | | /* Is this a Unicode key? */ |
208 | | #define KEYC_IS_UNICODE(key) \ |
209 | 1.02k | (((key) & KEYC_MASK_TYPE) == KEYC_SHIFT_TYPE(KEYC_TYPE_UNICODE) && \ |
210 | 1.02k | ((key) & KEYC_MASK_KEY) > 0x7f) |
211 | | |
212 | | /* Is this a user key? */ |
213 | | #define KEYC_IS_USER(key) \ |
214 | 1.02k | (((key) & KEYC_MASK_TYPE) == KEYC_SHIFT_TYPE(KEYC_TYPE_USER)) |
215 | | |
216 | | /* Is this a function key? */ |
217 | | #define KEYC_IS_SPECIAL(key) \ |
218 | 0 | (((key) & KEYC_MASK_TYPE) == KEYC_SHIFT_TYPE(KEYC_TYPE_FUNCTION)) |
219 | | |
220 | | /* Is this a mouse key? */ |
221 | | #define KEYC_IS_MOUSE(key) \ |
222 | 0 | (((key) & KEYC_MASK_KEY) == KEYC_MOUSE || \ |
223 | 0 | (((key) & KEYC_MASK_TYPE) >= KEYC_SHIFT_TYPE(KEYC_TYPE_MOUSEMOVE) && \ |
224 | 0 | ((key) & KEYC_MASK_TYPE) <= KEYC_SHIFT_TYPE(KEYC_TYPE_TRIPLECLICK))) |
225 | | |
226 | | /* Is this a paste key? */ |
227 | | #define KEYC_IS_PASTE(key) \ |
228 | 0 | (((key) & KEYC_MASK_TYPE) == KEYC_SHIFT_TYPE(KEYC_TYPE_FUNCTION) && \ |
229 | 0 | (((key) & KEYC_MASK_KEY) == KEYC_PASTE_START || \ |
230 | 0 | ((key) & KEYC_MASK_KEY) == KEYC_PASTE_END)) |
231 | | |
232 | | /* Multiple click timeout. */ |
233 | 0 | #define KEYC_CLICK_TIMEOUT 300 |
234 | | |
235 | | /* Bit shift for mouse events. */ |
236 | 0 | #define KEYC_MOUSE_LOCATION_SHIFT 0 |
237 | 0 | #define KEYC_MOUSE_BUTTON_SHIFT 8 |
238 | | |
239 | | /* Mouse key codes. */ |
240 | | #define KEYC_MOUSE_KEYS(t) \ |
241 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, PANE), \ |
242 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, STATUS), \ |
243 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, STATUS_LEFT), \ |
244 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, STATUS_RIGHT), \ |
245 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, STATUS_DEFAULT), \ |
246 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, BORDER), \ |
247 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, SCROLLBAR_UP), \ |
248 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, SCROLLBAR_SLIDER), \ |
249 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, SCROLLBAR_DOWN), \ |
250 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, EMPTY), \ |
251 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL0), \ |
252 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL1), \ |
253 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL2), \ |
254 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL3), \ |
255 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL4), \ |
256 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL5), \ |
257 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL6), \ |
258 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL7), \ |
259 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL8), \ |
260 | | KEYC_MOUSE_KEY(KEYC_ ## t, KEYC_TYPE_ ## t, CONTROL9) |
261 | | #define KEYC_MOUSE_KEY(p, t, l) \ |
262 | | p ## _ ## l = KEYC_MAKE_MOUSE_KEY(t, 0, KEYC_MOUSE_LOCATION_ ## l), \ |
263 | | p ## 1_ ## l = KEYC_MAKE_MOUSE_KEY(t, 1, KEYC_MOUSE_LOCATION_ ## l), \ |
264 | | p ## 2_ ## l = KEYC_MAKE_MOUSE_KEY(t, 2, KEYC_MOUSE_LOCATION_ ## l), \ |
265 | | p ## 3_ ## l = KEYC_MAKE_MOUSE_KEY(t, 3, KEYC_MOUSE_LOCATION_ ## l), \ |
266 | | p ## 6_ ## l = KEYC_MAKE_MOUSE_KEY(t, 6, KEYC_MOUSE_LOCATION_ ## l), \ |
267 | | p ## 7_ ## l = KEYC_MAKE_MOUSE_KEY(t, 7, KEYC_MOUSE_LOCATION_ ## l), \ |
268 | | p ## 8_ ## l = KEYC_MAKE_MOUSE_KEY(t, 8, KEYC_MOUSE_LOCATION_ ## l), \ |
269 | | p ## 9_ ## l = KEYC_MAKE_MOUSE_KEY(t, 9, KEYC_MOUSE_LOCATION_ ## l), \ |
270 | | p ## 10_ ## l = KEYC_MAKE_MOUSE_KEY(t, 10, KEYC_MOUSE_LOCATION_ ## l), \ |
271 | | p ## 11_ ## l = KEYC_MAKE_MOUSE_KEY(t, 11, KEYC_MOUSE_LOCATION_ ## l) |
272 | | #define KEYC_MAKE_MOUSE_KEY(t, b, l) \ |
273 | 0 | ((KEYC_SHIFT_TYPE(t)) | \ |
274 | 0 | ((unsigned long long)(b) << KEYC_MOUSE_BUTTON_SHIFT) | \ |
275 | 0 | ((unsigned long long)(l) << KEYC_MOUSE_LOCATION_SHIFT)) |
276 | | #define KEYC_MOUSE_STRING(name, s) \ |
277 | | { #s "Pane", KEYC_ ## name ## _PANE }, \ |
278 | | { #s "Status", KEYC_ ## name ## _STATUS }, \ |
279 | | { #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \ |
280 | | { #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \ |
281 | | { #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \ |
282 | | { #s "ScrollbarUp", KEYC_ ## name ## _SCROLLBAR_UP }, \ |
283 | | { #s "ScrollbarSlider", KEYC_ ## name ## _SCROLLBAR_SLIDER }, \ |
284 | | { #s "ScrollbarDown", KEYC_ ## name ## _SCROLLBAR_DOWN }, \ |
285 | | { #s "Empty", KEYC_ ## name ## _EMPTY }, \ |
286 | | { #s "Border", KEYC_ ## name ## _BORDER }, \ |
287 | | { #s "Control0", KEYC_ ## name ## _CONTROL0 }, \ |
288 | | { #s "Control1", KEYC_ ## name ## _CONTROL1 }, \ |
289 | | { #s "Control2", KEYC_ ## name ## _CONTROL2 }, \ |
290 | | { #s "Control3", KEYC_ ## name ## _CONTROL3 }, \ |
291 | | { #s "Control4", KEYC_ ## name ## _CONTROL4 }, \ |
292 | | { #s "Control5", KEYC_ ## name ## _CONTROL5 }, \ |
293 | | { #s "Control6", KEYC_ ## name ## _CONTROL6 }, \ |
294 | | { #s "Control7", KEYC_ ## name ## _CONTROL7 }, \ |
295 | | { #s "Control8", KEYC_ ## name ## _CONTROL8 }, \ |
296 | | { #s "Control9", KEYC_ ## name ## _CONTROL9 } |
297 | | |
298 | | /* |
299 | | * A single key. This can be ASCII or Unicode or one of the keys between |
300 | | * KEYC_BASE and KEYC_BASE_END. |
301 | | */ |
302 | | typedef unsigned long long key_code; |
303 | | |
304 | | /* C0 control characters */ |
305 | | enum { |
306 | | C0_NUL, |
307 | | C0_SOH, |
308 | | C0_STX, |
309 | | C0_ETX, |
310 | | C0_EOT, |
311 | | C0_ENQ, |
312 | | C0_ASC, |
313 | | C0_BEL, |
314 | | C0_BS, |
315 | | C0_HT, |
316 | | C0_LF, |
317 | | C0_VT, |
318 | | C0_FF, |
319 | | C0_CR, |
320 | | C0_SO, |
321 | | C0_SI, |
322 | | C0_DLE, |
323 | | C0_DC1, |
324 | | C0_DC2, |
325 | | C0_DC3, |
326 | | C0_DC4, |
327 | | C0_NAK, |
328 | | C0_SYN, |
329 | | C0_ETB, |
330 | | C0_CAN, |
331 | | C0_EM, |
332 | | C0_SUB, |
333 | | C0_ESC, |
334 | | C0_FS, |
335 | | C0_GS, |
336 | | C0_RS, |
337 | | C0_US |
338 | | }; |
339 | | |
340 | | /* Special key codes. */ |
341 | | enum { |
342 | | /* User key code range. */ |
343 | | KEYC_USER = KEYC_SHIFT_TYPE(KEYC_TYPE_USER), |
344 | | |
345 | | /* Functional key code range. */ |
346 | | KEYC_NONE = KEYC_SHIFT_TYPE(KEYC_TYPE_FUNCTION), |
347 | | KEYC_UNKNOWN, |
348 | | |
349 | | /* Focus events. */ |
350 | | KEYC_FOCUS_IN, |
351 | | KEYC_FOCUS_OUT, |
352 | | |
353 | | /* "Any" key, used if not found in key table. */ |
354 | | KEYC_ANY, |
355 | | |
356 | | /* Paste brackets. */ |
357 | | KEYC_PASTE_START, |
358 | | KEYC_PASTE_END, |
359 | | |
360 | | /* Backspace key. */ |
361 | | KEYC_BSPACE, |
362 | | |
363 | | /* Function keys. */ |
364 | | KEYC_F1, |
365 | | KEYC_F2, |
366 | | KEYC_F3, |
367 | | KEYC_F4, |
368 | | KEYC_F5, |
369 | | KEYC_F6, |
370 | | KEYC_F7, |
371 | | KEYC_F8, |
372 | | KEYC_F9, |
373 | | KEYC_F10, |
374 | | KEYC_F11, |
375 | | KEYC_F12, |
376 | | KEYC_IC, |
377 | | KEYC_DC, |
378 | | KEYC_HOME, |
379 | | KEYC_END, |
380 | | KEYC_NPAGE, |
381 | | KEYC_PPAGE, |
382 | | KEYC_BTAB, |
383 | | |
384 | | /* Arrow keys. */ |
385 | | KEYC_UP, |
386 | | KEYC_DOWN, |
387 | | KEYC_LEFT, |
388 | | KEYC_RIGHT, |
389 | | |
390 | | /* Numeric keypad. */ |
391 | | KEYC_KP_SLASH, |
392 | | KEYC_KP_STAR, |
393 | | KEYC_KP_MINUS, |
394 | | KEYC_KP_SEVEN, |
395 | | KEYC_KP_EIGHT, |
396 | | KEYC_KP_NINE, |
397 | | KEYC_KP_PLUS, |
398 | | KEYC_KP_FOUR, |
399 | | KEYC_KP_FIVE, |
400 | | KEYC_KP_SIX, |
401 | | KEYC_KP_ONE, |
402 | | KEYC_KP_TWO, |
403 | | KEYC_KP_THREE, |
404 | | KEYC_KP_ENTER, |
405 | | KEYC_KP_ZERO, |
406 | | KEYC_KP_PERIOD, |
407 | | |
408 | | /* Theme reporting. */ |
409 | | KEYC_REPORT_DARK_THEME, |
410 | | KEYC_REPORT_LIGHT_THEME, |
411 | | |
412 | | /* Mouse state. */ |
413 | | KEYC_MOUSE, /* unclassified mouse event */ |
414 | | KEYC_DRAGGING, /* dragging in progress */ |
415 | | KEYC_DOUBLECLICK, /* double click complete */ |
416 | | |
417 | | /* Mouse key code ranges. Must be at the end. */ |
418 | | KEYC_MOUSE_KEYS(MOUSEMOVE), |
419 | | KEYC_MOUSE_KEYS(WHEELDOWN), |
420 | | KEYC_MOUSE_KEYS(WHEELUP), |
421 | | KEYC_MOUSE_KEYS(MOUSEDOWN), |
422 | | KEYC_MOUSE_KEYS(MOUSEUP), |
423 | | KEYC_MOUSE_KEYS(MOUSEDRAG), |
424 | | KEYC_MOUSE_KEYS(MOUSEDRAGEND), |
425 | | KEYC_MOUSE_KEYS(SECONDCLICK), |
426 | | KEYC_MOUSE_KEYS(DOUBLECLICK), |
427 | | KEYC_MOUSE_KEYS(TRIPLECLICK), |
428 | | }; |
429 | | |
430 | | /* Termcap codes. */ |
431 | | enum tty_code_code { |
432 | | TTYC_ACSC, |
433 | | TTYC_AM, |
434 | | TTYC_AX, |
435 | | TTYC_BCE, |
436 | | TTYC_BEL, |
437 | | TTYC_BIDI, |
438 | | TTYC_BLINK, |
439 | | TTYC_BOLD, |
440 | | TTYC_CIVIS, |
441 | | TTYC_CLEAR, |
442 | | TTYC_CLMG, |
443 | | TTYC_CMG, |
444 | | TTYC_CNORM, |
445 | | TTYC_COLORS, |
446 | | TTYC_CR, |
447 | | TTYC_CS, |
448 | | TTYC_CSR, |
449 | | TTYC_CUB, |
450 | | TTYC_CUB1, |
451 | | TTYC_CUD, |
452 | | TTYC_CUD1, |
453 | | TTYC_CUF, |
454 | | TTYC_CUF1, |
455 | | TTYC_CUP, |
456 | | TTYC_CUU, |
457 | | TTYC_CUU1, |
458 | | TTYC_CVVIS, |
459 | | TTYC_DCH, |
460 | | TTYC_DCH1, |
461 | | TTYC_DIM, |
462 | | TTYC_DL, |
463 | | TTYC_DL1, |
464 | | TTYC_DSBP, |
465 | | TTYC_DSEKS, |
466 | | TTYC_DSFCS, |
467 | | TTYC_DSMG, |
468 | | TTYC_E3, |
469 | | TTYC_ECH, |
470 | | TTYC_ED, |
471 | | TTYC_EL, |
472 | | TTYC_EL1, |
473 | | TTYC_ENACS, |
474 | | TTYC_ENBP, |
475 | | TTYC_ENEKS, |
476 | | TTYC_ENFCS, |
477 | | TTYC_ENMG, |
478 | | TTYC_FSL, |
479 | | TTYC_HLS, |
480 | | TTYC_HOME, |
481 | | TTYC_HPA, |
482 | | TTYC_ICH, |
483 | | TTYC_ICH1, |
484 | | TTYC_IL, |
485 | | TTYC_IL1, |
486 | | TTYC_IND, |
487 | | TTYC_INDN, |
488 | | TTYC_INVIS, |
489 | | TTYC_KCBT, |
490 | | TTYC_KCUB1, |
491 | | TTYC_KCUD1, |
492 | | TTYC_KCUF1, |
493 | | TTYC_KCUU1, |
494 | | TTYC_KDC2, |
495 | | TTYC_KDC3, |
496 | | TTYC_KDC4, |
497 | | TTYC_KDC5, |
498 | | TTYC_KDC6, |
499 | | TTYC_KDC7, |
500 | | TTYC_KDCH1, |
501 | | TTYC_KDN2, |
502 | | TTYC_KDN3, |
503 | | TTYC_KDN4, |
504 | | TTYC_KDN5, |
505 | | TTYC_KDN6, |
506 | | TTYC_KDN7, |
507 | | TTYC_KEND, |
508 | | TTYC_KEND2, |
509 | | TTYC_KEND3, |
510 | | TTYC_KEND4, |
511 | | TTYC_KEND5, |
512 | | TTYC_KEND6, |
513 | | TTYC_KEND7, |
514 | | TTYC_KF1, |
515 | | TTYC_KF10, |
516 | | TTYC_KF11, |
517 | | TTYC_KF12, |
518 | | TTYC_KF13, |
519 | | TTYC_KF14, |
520 | | TTYC_KF15, |
521 | | TTYC_KF16, |
522 | | TTYC_KF17, |
523 | | TTYC_KF18, |
524 | | TTYC_KF19, |
525 | | TTYC_KF2, |
526 | | TTYC_KF20, |
527 | | TTYC_KF21, |
528 | | TTYC_KF22, |
529 | | TTYC_KF23, |
530 | | TTYC_KF24, |
531 | | TTYC_KF25, |
532 | | TTYC_KF26, |
533 | | TTYC_KF27, |
534 | | TTYC_KF28, |
535 | | TTYC_KF29, |
536 | | TTYC_KF3, |
537 | | TTYC_KF30, |
538 | | TTYC_KF31, |
539 | | TTYC_KF32, |
540 | | TTYC_KF33, |
541 | | TTYC_KF34, |
542 | | TTYC_KF35, |
543 | | TTYC_KF36, |
544 | | TTYC_KF37, |
545 | | TTYC_KF38, |
546 | | TTYC_KF39, |
547 | | TTYC_KF4, |
548 | | TTYC_KF40, |
549 | | TTYC_KF41, |
550 | | TTYC_KF42, |
551 | | TTYC_KF43, |
552 | | TTYC_KF44, |
553 | | TTYC_KF45, |
554 | | TTYC_KF46, |
555 | | TTYC_KF47, |
556 | | TTYC_KF48, |
557 | | TTYC_KF49, |
558 | | TTYC_KF5, |
559 | | TTYC_KF50, |
560 | | TTYC_KF51, |
561 | | TTYC_KF52, |
562 | | TTYC_KF53, |
563 | | TTYC_KF54, |
564 | | TTYC_KF55, |
565 | | TTYC_KF56, |
566 | | TTYC_KF57, |
567 | | TTYC_KF58, |
568 | | TTYC_KF59, |
569 | | TTYC_KF6, |
570 | | TTYC_KF60, |
571 | | TTYC_KF61, |
572 | | TTYC_KF62, |
573 | | TTYC_KF63, |
574 | | TTYC_KF7, |
575 | | TTYC_KF8, |
576 | | TTYC_KF9, |
577 | | TTYC_KHOM2, |
578 | | TTYC_KHOM3, |
579 | | TTYC_KHOM4, |
580 | | TTYC_KHOM5, |
581 | | TTYC_KHOM6, |
582 | | TTYC_KHOM7, |
583 | | TTYC_KHOME, |
584 | | TTYC_KIC2, |
585 | | TTYC_KIC3, |
586 | | TTYC_KIC4, |
587 | | TTYC_KIC5, |
588 | | TTYC_KIC6, |
589 | | TTYC_KIC7, |
590 | | TTYC_KICH1, |
591 | | TTYC_KIND, |
592 | | TTYC_KLFT2, |
593 | | TTYC_KLFT3, |
594 | | TTYC_KLFT4, |
595 | | TTYC_KLFT5, |
596 | | TTYC_KLFT6, |
597 | | TTYC_KLFT7, |
598 | | TTYC_KMOUS, |
599 | | TTYC_KNP, |
600 | | TTYC_KNXT2, |
601 | | TTYC_KNXT3, |
602 | | TTYC_KNXT4, |
603 | | TTYC_KNXT5, |
604 | | TTYC_KNXT6, |
605 | | TTYC_KNXT7, |
606 | | TTYC_KPP, |
607 | | TTYC_KPRV2, |
608 | | TTYC_KPRV3, |
609 | | TTYC_KPRV4, |
610 | | TTYC_KPRV5, |
611 | | TTYC_KPRV6, |
612 | | TTYC_KPRV7, |
613 | | TTYC_KRI, |
614 | | TTYC_KRIT2, |
615 | | TTYC_KRIT3, |
616 | | TTYC_KRIT4, |
617 | | TTYC_KRIT5, |
618 | | TTYC_KRIT6, |
619 | | TTYC_KRIT7, |
620 | | TTYC_KUP2, |
621 | | TTYC_KUP3, |
622 | | TTYC_KUP4, |
623 | | TTYC_KUP5, |
624 | | TTYC_KUP6, |
625 | | TTYC_KUP7, |
626 | | TTYC_MS, |
627 | | TTYC_NOBR, |
628 | | TTYC_OL, |
629 | | TTYC_OP, |
630 | | TTYC_RECT, |
631 | | TTYC_REV, |
632 | | TTYC_RGB, |
633 | | TTYC_RI, |
634 | | TTYC_RIN, |
635 | | TTYC_RMACS, |
636 | | TTYC_RMCUP, |
637 | | TTYC_RMKX, |
638 | | TTYC_SE, |
639 | | TTYC_SETAB, |
640 | | TTYC_SETAF, |
641 | | TTYC_SETAL, |
642 | | TTYC_SETRGBB, |
643 | | TTYC_SETRGBF, |
644 | | TTYC_SETULC, |
645 | | TTYC_SETULC1, |
646 | | TTYC_SGR0, |
647 | | TTYC_SITM, |
648 | | TTYC_SMACS, |
649 | | TTYC_SMCUP, |
650 | | TTYC_SMKX, |
651 | | TTYC_SMOL, |
652 | | TTYC_SMSO, |
653 | | TTYC_SMUL, |
654 | | TTYC_SMULX, |
655 | | TTYC_SMXX, |
656 | | TTYC_SPB, |
657 | | TTYC_SXL, |
658 | | TTYC_SS, |
659 | | TTYC_SWD, |
660 | | TTYC_SYNC, |
661 | | TTYC_TC, |
662 | | TTYC_TSL, |
663 | | TTYC_U8, |
664 | | TTYC_VPA, |
665 | | TTYC_XT |
666 | | }; |
667 | | |
668 | | /* Character classes. */ |
669 | 0 | #define WHITESPACE "\t " |
670 | | |
671 | | /* Mode keys. */ |
672 | 0 | #define MODEKEY_EMACS 0 |
673 | 0 | #define MODEKEY_VI 1 |
674 | | |
675 | | /* Modes. */ |
676 | 2.55k | #define MODE_CURSOR 0x1 |
677 | 0 | #define MODE_INSERT 0x2 |
678 | 2.55k | #define MODE_KCURSOR 0x4 |
679 | 0 | #define MODE_KKEYPAD 0x8 |
680 | 2.55k | #define MODE_WRAP 0x10 |
681 | 2.55k | #define MODE_MOUSE_STANDARD 0x20 |
682 | 2.55k | #define MODE_MOUSE_BUTTON 0x40 |
683 | 2.55k | #define MODE_CURSOR_BLINKING 0x80 |
684 | 2.55k | #define MODE_MOUSE_UTF8 0x100 |
685 | 2.55k | #define MODE_MOUSE_SGR 0x200 |
686 | 2.55k | #define MODE_BRACKETPASTE 0x400 |
687 | 2.55k | #define MODE_FOCUSON 0x800 |
688 | 2.55k | #define MODE_MOUSE_ALL 0x1000 |
689 | 2.55k | #define MODE_ORIGIN 0x2000 |
690 | 0 | #define MODE_CRLF 0x4000 |
691 | 0 | #define MODE_KEYS_EXTENDED 0x8000 |
692 | 0 | #define MODE_CURSOR_VERY_VISIBLE 0x10000 |
693 | 0 | #define MODE_CURSOR_BLINKING_SET 0x20000 |
694 | 0 | #define MODE_KEYS_EXTENDED_2 0x40000 |
695 | 2.55k | #define MODE_THEME_UPDATES 0x80000 |
696 | 2.55k | #define MODE_SYNC 0x100000 |
697 | | |
698 | 0 | #define ALL_MODES 0xffffff |
699 | 0 | #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL) |
700 | 0 | #define MOTION_MOUSE_MODES (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL) |
701 | 0 | #define CURSOR_MODES (MODE_CURSOR|MODE_CURSOR_BLINKING|MODE_CURSOR_VERY_VISIBLE) |
702 | 0 | #define EXTENDED_KEY_MODES (MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2) |
703 | | |
704 | | /* Mouse protocol constants. */ |
705 | 0 | #define MOUSE_PARAM_MAX 0xff |
706 | 0 | #define MOUSE_PARAM_UTF8_MAX 0x7ff |
707 | 0 | #define MOUSE_PARAM_BTN_OFF 0x20 |
708 | 0 | #define MOUSE_PARAM_POS_OFF 0x21 |
709 | | |
710 | | /* A single UTF-8 character. */ |
711 | | typedef u_int utf8_char; |
712 | | |
713 | | /* |
714 | | * An expanded UTF-8 character. UTF8_SIZE must be big enough to hold combining |
715 | | * characters as well. It can't be more than 32 bytes without changes to how |
716 | | * characters are stored. |
717 | | */ |
718 | 0 | #define UTF8_SIZE 32 |
719 | | struct utf8_data { |
720 | | u_char data[UTF8_SIZE]; |
721 | | |
722 | | u_char have; |
723 | | u_char size; |
724 | | |
725 | | u_char width; /* 0xff if invalid */ |
726 | | }; |
727 | | enum utf8_state { |
728 | | UTF8_MORE, |
729 | | UTF8_DONE, |
730 | | UTF8_ERROR |
731 | | }; |
732 | | |
733 | | /* State for processing of Korean characters. */ |
734 | | enum hanguljamo_state { |
735 | | HANGULJAMO_STATE_NOT_HANGULJAMO, |
736 | | HANGULJAMO_STATE_CHOSEONG, |
737 | | HANGULJAMO_STATE_COMPOSABLE, |
738 | | HANGULJAMO_STATE_NOT_COMPOSABLE |
739 | | }; |
740 | | |
741 | | /* Colour flags. */ |
742 | 35.0k | #define COLOUR_FLAG_256 0x01000000 |
743 | 70.3k | #define COLOUR_FLAG_RGB 0x02000000 |
744 | 12.4k | #define COLOUR_FLAG_THEME 0x04000000 |
745 | | |
746 | | /* Special colours. */ |
747 | 0 | #define COLOUR_DEFAULT(c) ((c) == 8 || (c) == 9) |
748 | | |
749 | | /* Theme colours. */ |
750 | | enum colour_theme { |
751 | | COLOUR_THEME_BLACK, |
752 | | COLOUR_THEME_WHITE, |
753 | | COLOUR_THEME_LIGHT_GREY, |
754 | | COLOUR_THEME_DARK_GREY, |
755 | | COLOUR_THEME_GREEN, |
756 | | COLOUR_THEME_YELLOW, |
757 | | COLOUR_THEME_RED, |
758 | | COLOUR_THEME_BLUE, |
759 | | COLOUR_THEME_CYAN, |
760 | | COLOUR_THEME_MAGENTA |
761 | | }; |
762 | 0 | #define COLOUR_THEME_COUNT 10 |
763 | | |
764 | | /* Replacement palette. */ |
765 | | struct colour_palette { |
766 | | int fg; |
767 | | int bg; |
768 | | |
769 | | int *palette; |
770 | | int *default_palette; |
771 | | }; |
772 | | |
773 | | /* Grid attributes. Anything above 0xff is stored in an extended cell. */ |
774 | 13.7k | #define GRID_ATTR_BRIGHT 0x1 |
775 | 6.85k | #define GRID_ATTR_DIM 0x2 |
776 | 6.85k | #define GRID_ATTR_UNDERSCORE 0x4 |
777 | 6.85k | #define GRID_ATTR_BLINK 0x8 |
778 | 6.85k | #define GRID_ATTR_REVERSE 0x10 |
779 | 6.85k | #define GRID_ATTR_HIDDEN 0x20 |
780 | 6.85k | #define GRID_ATTR_ITALICS 0x40 |
781 | 6.85k | #define GRID_ATTR_CHARSET 0x80 /* alternative character set */ |
782 | 6.85k | #define GRID_ATTR_STRIKETHROUGH 0x100 |
783 | 6.85k | #define GRID_ATTR_UNDERSCORE_2 0x200 |
784 | 6.85k | #define GRID_ATTR_UNDERSCORE_3 0x400 |
785 | 6.85k | #define GRID_ATTR_UNDERSCORE_4 0x800 |
786 | 6.85k | #define GRID_ATTR_UNDERSCORE_5 0x1000 |
787 | 6.85k | #define GRID_ATTR_OVERLINE 0x2000 |
788 | 0 | #define GRID_ATTR_NOATTR 0x4000 |
789 | | |
790 | | /* All underscore attributes. */ |
791 | | #define GRID_ATTR_ALL_UNDERSCORE \ |
792 | 0 | (GRID_ATTR_UNDERSCORE| \ |
793 | 0 | GRID_ATTR_UNDERSCORE_2| \ |
794 | 0 | GRID_ATTR_UNDERSCORE_3| \ |
795 | 0 | GRID_ATTR_UNDERSCORE_4| \ |
796 | 0 | GRID_ATTR_UNDERSCORE_5) |
797 | | |
798 | | /* Grid flags. */ |
799 | 0 | #define GRID_FLAG_FG256 0x1 |
800 | 0 | #define GRID_FLAG_BG256 0x2 |
801 | 0 | #define GRID_FLAG_PADDING 0x4 |
802 | 0 | #define GRID_FLAG_EXTENDED 0x8 |
803 | 0 | #define GRID_FLAG_SELECTED 0x10 |
804 | 0 | #define GRID_FLAG_NOPALETTE 0x20 |
805 | 0 | #define GRID_FLAG_CLEARED 0x40 |
806 | 0 | #define GRID_FLAG_TAB 0x80 |
807 | | |
808 | | /* Grid line flags. */ |
809 | 0 | #define GRID_LINE_WRAPPED 0x1 |
810 | 0 | #define GRID_LINE_EXTENDED 0x2 |
811 | 0 | #define GRID_LINE_DEAD 0x4 |
812 | 0 | #define GRID_LINE_START_PROMPT 0x8 |
813 | 0 | #define GRID_LINE_SECOND_PROMPT 0x10 |
814 | 0 | #define GRID_LINE_START_COMMAND 0x20 |
815 | 0 | #define GRID_LINE_START_OUTPUT 0x40 |
816 | 0 | #define GRID_LINE_END_OUTPUT 0x80 |
817 | 0 | #define GRID_LINE_HYPERLINK 0x100 |
818 | | |
819 | | /* All OSC 133 flags. */ |
820 | | #define GRID_LINE_OSC133_FLAGS \ |
821 | 0 | (GRID_LINE_START_PROMPT| \ |
822 | 0 | GRID_LINE_SECOND_PROMPT| \ |
823 | 0 | GRID_LINE_START_COMMAND| \ |
824 | 0 | GRID_LINE_START_OUTPUT| \ |
825 | 0 | GRID_LINE_END_OUTPUT) |
826 | | |
827 | | /* Grid string flags. */ |
828 | 0 | #define GRID_STRING_WITH_SEQUENCES 0x1 |
829 | 0 | #define GRID_STRING_ESCAPE_SEQUENCES 0x2 |
830 | 0 | #define GRID_STRING_TRIM_SPACES 0x4 |
831 | | #define GRID_STRING_USED_ONLY 0x8 |
832 | 0 | #define GRID_STRING_EMPTY_CELLS 0x10 |
833 | | |
834 | | /* |
835 | | * Cell border characters. Border cells are named for the directions they |
836 | | * connect to: U for up, D for down, L for left and R for right. |
837 | | */ |
838 | | #define CELL_INSIDE 0 |
839 | 0 | #define CELL_UD 1 |
840 | 0 | #define CELL_LR 2 |
841 | 0 | #define CELL_RD 3 |
842 | 0 | #define CELL_LD 4 |
843 | 0 | #define CELL_RU 5 |
844 | 0 | #define CELL_LU 6 |
845 | 0 | #define CELL_LRD 7 |
846 | 0 | #define CELL_LRU 8 |
847 | 0 | #define CELL_URD 9 |
848 | 0 | #define CELL_ULD 10 |
849 | 0 | #define CELL_LRUD 11 |
850 | 0 | #define CELL_NONE 12 |
851 | | #define CELL_SCROLLBAR 13 |
852 | | |
853 | | /* Cell borders. */ |
854 | 0 | #define CELL_BORDERS " xqlkmjwvtun~" |
855 | 0 | #define SIMPLE_BORDERS " |-+++++++++." |
856 | 0 | #define PADDED_BORDERS " " |
857 | | |
858 | | /* Grid cell data. */ |
859 | | struct grid_cell { |
860 | | struct utf8_data data; |
861 | | u_short attr; |
862 | | u_char flags; |
863 | | int fg; |
864 | | int bg; |
865 | | int us; |
866 | | u_int link; |
867 | | }; |
868 | | |
869 | | /* Grid extended cell entry. */ |
870 | | struct grid_extd_entry { |
871 | | utf8_char data; |
872 | | u_short attr; |
873 | | u_char flags; |
874 | | int fg; |
875 | | int bg; |
876 | | int us; |
877 | | u_int link; |
878 | | } __packed; |
879 | | |
880 | | /* Grid cell entry. */ |
881 | | struct grid_cell_entry { |
882 | | union { |
883 | | u_int offset; |
884 | | struct { |
885 | | u_char attr; |
886 | | u_char fg; |
887 | | u_char bg; |
888 | | u_char data; |
889 | | } data; |
890 | | }; |
891 | | u_char flags; |
892 | | } __packed; |
893 | | |
894 | | /* OSC 133 data for a grid line. */ |
895 | | struct osc133_data { |
896 | | u_short prompt_col; |
897 | | u_short cmd_col; |
898 | | u_short out_start_col; |
899 | | u_short out_end_col; |
900 | | u_char exit_status; |
901 | | }; |
902 | | |
903 | | /* Grid line. */ |
904 | | struct grid_line { |
905 | | struct grid_cell_entry *celldata; |
906 | | struct grid_extd_entry *extddata; |
907 | | |
908 | | u_short cellused; |
909 | | u_short cellsize; |
910 | | u_int extdsize; |
911 | | |
912 | | u_int time; |
913 | | struct osc133_data osc133_data; |
914 | | u_short flags; |
915 | | }; |
916 | | |
917 | | /* Entire grid of cells. */ |
918 | | struct grid { |
919 | | int flags; |
920 | 0 | #define GRID_HISTORY 0x1 /* scroll lines into history */ |
921 | | |
922 | | u_int sx; |
923 | | u_int sy; |
924 | | |
925 | | u_int hscrolled; |
926 | | u_int hsize; |
927 | | u_int hlimit; |
928 | | |
929 | | u_int scroll_added; |
930 | | u_int scroll_collected; |
931 | | u_int scroll_generation; |
932 | | |
933 | | struct grid_line *linedata; |
934 | | }; |
935 | | |
936 | | /* Virtual cursor in a grid. */ |
937 | | struct grid_reader { |
938 | | struct grid *gd; |
939 | | u_int cx; |
940 | | u_int cy; |
941 | | }; |
942 | | |
943 | | /* Style alignment. */ |
944 | | enum style_align { |
945 | | STYLE_ALIGN_DEFAULT, |
946 | | STYLE_ALIGN_LEFT, |
947 | | STYLE_ALIGN_CENTRE, |
948 | | STYLE_ALIGN_RIGHT, |
949 | | STYLE_ALIGN_ABSOLUTE_CENTRE |
950 | | }; |
951 | | |
952 | | /* Style list. */ |
953 | | enum style_list { |
954 | | STYLE_LIST_OFF, |
955 | | STYLE_LIST_ON, |
956 | | STYLE_LIST_FOCUS, |
957 | | STYLE_LIST_LEFT_MARKER, |
958 | | STYLE_LIST_RIGHT_MARKER, |
959 | | }; |
960 | | |
961 | | /* Style range. */ |
962 | | enum style_range_type { |
963 | | STYLE_RANGE_NONE, |
964 | | STYLE_RANGE_LEFT, |
965 | | STYLE_RANGE_RIGHT, |
966 | | STYLE_RANGE_PANE, |
967 | | STYLE_RANGE_WINDOW, |
968 | | STYLE_RANGE_SESSION, |
969 | | STYLE_RANGE_USER, |
970 | | STYLE_RANGE_CONTROL |
971 | | }; |
972 | | struct style_range { |
973 | | enum style_range_type type; |
974 | | u_int argument; |
975 | | char string[16]; |
976 | | |
977 | | u_int start; |
978 | | u_int end; /* not included */ |
979 | | |
980 | | TAILQ_ENTRY(style_range) entry; |
981 | | }; |
982 | | TAILQ_HEAD(style_ranges, style_range); |
983 | | |
984 | | /* Ranges connected with a status line. */ |
985 | | struct style_line_entry { |
986 | | char *expanded; |
987 | | struct style_ranges ranges; |
988 | | }; |
989 | | |
990 | | /* Default style width and pad. */ |
991 | | #define STYLE_WIDTH_DEFAULT -1 |
992 | | #define STYLE_PAD_DEFAULT -1 |
993 | | |
994 | | /* Style default. */ |
995 | | enum style_default_type { |
996 | | STYLE_DEFAULT_BASE, |
997 | | STYLE_DEFAULT_PUSH, |
998 | | STYLE_DEFAULT_POP, |
999 | | STYLE_DEFAULT_SET |
1000 | | }; |
1001 | | |
1002 | | /* Style option. */ |
1003 | | struct style { |
1004 | | struct grid_cell gc; |
1005 | | int ignore; |
1006 | | int dim; |
1007 | | |
1008 | | int fill; |
1009 | | enum style_align align; |
1010 | | enum style_list list; |
1011 | | |
1012 | | enum style_range_type range_type; |
1013 | | u_int range_argument; |
1014 | | char range_string[16]; |
1015 | | |
1016 | | int width; |
1017 | | int width_percentage; |
1018 | | int pad; |
1019 | | |
1020 | | enum style_default_type default_type; |
1021 | | |
1022 | | u_int link; |
1023 | | }; |
1024 | | |
1025 | | #ifdef ENABLE_SIXEL |
1026 | | /* Image. */ |
1027 | | struct image { |
1028 | | struct screen *s; |
1029 | | struct sixel_image *data; |
1030 | | char *fallback; |
1031 | | |
1032 | | u_int px; |
1033 | | u_int py; |
1034 | | u_int sx; |
1035 | | u_int sy; |
1036 | | |
1037 | | struct images *list; |
1038 | | TAILQ_ENTRY (image) entry; |
1039 | | |
1040 | | TAILQ_ENTRY (image) all_entry; |
1041 | | }; |
1042 | | TAILQ_HEAD(images, image); |
1043 | | #endif |
1044 | | |
1045 | | /* Cursor style. */ |
1046 | | enum screen_cursor_style { |
1047 | | SCREEN_CURSOR_DEFAULT, |
1048 | | SCREEN_CURSOR_BLOCK, |
1049 | | SCREEN_CURSOR_UNDERLINE, |
1050 | | SCREEN_CURSOR_BAR |
1051 | | }; |
1052 | | |
1053 | | |
1054 | | /* Progress bar, OSC 9;4. */ |
1055 | | enum progress_bar_state { |
1056 | | PROGRESS_BAR_HIDDEN = 0, |
1057 | | PROGRESS_BAR_NORMAL = 1, |
1058 | | PROGRESS_BAR_ERROR = 2, |
1059 | | PROGRESS_BAR_INDETERMINATE = 3, |
1060 | | PROGRESS_BAR_PAUSED = 4 |
1061 | | }; |
1062 | | struct progress_bar { |
1063 | | enum progress_bar_state state; |
1064 | | int progress; |
1065 | | }; |
1066 | | |
1067 | | /* Virtual screen. */ |
1068 | | struct screen_sel; |
1069 | | struct screen_titles; |
1070 | | struct screen { |
1071 | | char *title; |
1072 | | char *path; |
1073 | | struct screen_titles *titles; |
1074 | | u_int ntitles; |
1075 | | |
1076 | | struct grid *grid; /* grid data */ |
1077 | | |
1078 | | u_int cx; /* cursor x */ |
1079 | | u_int cy; /* cursor y */ |
1080 | | |
1081 | | enum screen_cursor_style cstyle; /* cursor style */ |
1082 | | enum screen_cursor_style default_cstyle; |
1083 | | int ccolour; /* cursor colour */ |
1084 | | int default_ccolour; |
1085 | | |
1086 | | u_int rupper; /* scroll region top */ |
1087 | | u_int rlower; /* scroll region bottom */ |
1088 | | |
1089 | | int mode; |
1090 | | int default_mode; |
1091 | | |
1092 | | u_int saved_cx; |
1093 | | u_int saved_cy; |
1094 | | struct grid *saved_grid; |
1095 | | struct grid_cell saved_cell; |
1096 | | int saved_flags; |
1097 | | |
1098 | | bitstr_t *tabs; |
1099 | | struct screen_sel *sel; |
1100 | | |
1101 | | #ifdef ENABLE_SIXEL |
1102 | | struct images images; |
1103 | | struct images saved_images; |
1104 | | #endif |
1105 | | |
1106 | | struct screen_write_cline *write_list; |
1107 | | |
1108 | | struct hyperlinks *hyperlinks; |
1109 | | struct progress_bar progress_bar; |
1110 | | }; |
1111 | | |
1112 | | /* Screen write context. */ |
1113 | | typedef void (*screen_write_init_ctx_cb)(struct screen_write_ctx *, |
1114 | | struct tty_ctx *); |
1115 | | struct screen_write_ctx { |
1116 | | struct window_pane *wp; |
1117 | | struct screen *s; |
1118 | | |
1119 | | int flags; |
1120 | 0 | #define SCREEN_WRITE_SYNC 0x1 |
1121 | 0 | #define SCREEN_WRITE_OBSCURED 0x2 |
1122 | 0 | #define SCREEN_WRITE_CHECKED_IF_OBSCURED 0x4 |
1123 | | |
1124 | | screen_write_init_ctx_cb init_ctx_cb; |
1125 | | void *arg; |
1126 | | |
1127 | | struct screen_write_citem *item; |
1128 | | u_int scrolled; |
1129 | | u_int bg; |
1130 | | }; |
1131 | | |
1132 | | /* Box border lines option. */ |
1133 | | enum box_lines { |
1134 | | BOX_LINES_DEFAULT = -1, |
1135 | | BOX_LINES_SINGLE, |
1136 | | BOX_LINES_DOUBLE, |
1137 | | BOX_LINES_HEAVY, |
1138 | | BOX_LINES_SIMPLE, |
1139 | | BOX_LINES_ROUNDED, |
1140 | | BOX_LINES_PADDED, |
1141 | | BOX_LINES_NONE |
1142 | | }; |
1143 | | |
1144 | | /* Pane border lines option. */ |
1145 | | enum pane_lines { |
1146 | | PANE_LINES_SINGLE, |
1147 | | PANE_LINES_DOUBLE, |
1148 | | PANE_LINES_HEAVY, |
1149 | | PANE_LINES_SIMPLE, |
1150 | | PANE_LINES_NUMBER, |
1151 | | PANE_LINES_SPACES, |
1152 | | PANE_LINES_NONE |
1153 | | }; |
1154 | | |
1155 | | /* Pane border indicator option. */ |
1156 | | #define PANE_BORDER_OFF 0 |
1157 | 0 | #define PANE_BORDER_COLOUR 1 |
1158 | 0 | #define PANE_BORDER_ARROWS 2 |
1159 | 0 | #define PANE_BORDER_BOTH 3 |
1160 | | |
1161 | | /* Mode returned by window_pane_mode function. */ |
1162 | 0 | #define WINDOW_PANE_NO_MODE 0 |
1163 | 0 | #define WINDOW_PANE_COPY_MODE 1 |
1164 | 0 | #define WINDOW_PANE_VIEW_MODE 2 |
1165 | | |
1166 | | /* Screen size. */ |
1167 | 0 | #define screen_size_x(s) ((s)->grid->sx) |
1168 | 0 | #define screen_size_y(s) ((s)->grid->sy) |
1169 | 0 | #define screen_hsize(s) ((s)->grid->hsize) |
1170 | 0 | #define screen_hlimit(s) ((s)->grid->hlimit) |
1171 | | |
1172 | | /* Menu. */ |
1173 | | struct menu_item { |
1174 | | const char *name; |
1175 | | key_code key; |
1176 | | const char *command; |
1177 | | }; |
1178 | | struct menu { |
1179 | | const char *title; |
1180 | | struct menu_item *items; |
1181 | | u_int count; |
1182 | | u_int width; |
1183 | | }; |
1184 | | typedef void (*menu_choice_cb)(struct menu *, u_int, key_code, void *); |
1185 | | |
1186 | | /* |
1187 | | * Window mode. Windows can be in several modes and this is used to call the |
1188 | | * right function to handle input and output. |
1189 | | */ |
1190 | | struct window_mode_entry; |
1191 | | struct window_mode { |
1192 | | const char *name; |
1193 | | const char *default_format; |
1194 | | |
1195 | | int flags; |
1196 | 0 | #define WINDOW_MODE_HIDE_PANE_STATUS 0x1 |
1197 | 0 | #define WINDOW_MODE_NO_STACK 0x2 |
1198 | | #define WINDOW_MODE_FILL_WINDOW 0x4 |
1199 | 0 | #define WINDOW_MODE_HIDE_SCROLLBARS 0x8 |
1200 | | |
1201 | | struct screen *(*init)(struct window_mode_entry *, |
1202 | | struct cmdq_item *, struct cmd_find_state *, |
1203 | | struct args *); |
1204 | | void (*free)(struct window_mode_entry *); |
1205 | | void (*resize)(struct window_mode_entry *, u_int, u_int); |
1206 | | void (*update)(struct window_mode_entry *); |
1207 | | void (*style_changed)(struct window_mode_entry *); |
1208 | | void (*key)(struct window_mode_entry *, struct client *, |
1209 | | struct session *, struct winlink *, key_code, |
1210 | | struct mouse_event *); |
1211 | | |
1212 | | const char *(*key_table)(struct window_mode_entry *); |
1213 | | void (*command)(struct window_mode_entry *, struct client *, |
1214 | | struct session *, struct winlink *, struct args *, |
1215 | | struct mouse_event *); |
1216 | | void (*formats)(struct window_mode_entry *, |
1217 | | struct format_tree *); |
1218 | | struct screen *(*get_screen)(struct window_mode_entry *); |
1219 | | }; |
1220 | | |
1221 | | /* Active window mode. */ |
1222 | | struct window_mode_entry { |
1223 | | struct window_pane *wp; |
1224 | | struct window_pane *swp; |
1225 | | |
1226 | | const struct window_mode *mode; |
1227 | | void *data; |
1228 | | |
1229 | | struct screen *screen; |
1230 | | u_int prefix; |
1231 | | |
1232 | | int kill; |
1233 | | |
1234 | | TAILQ_ENTRY(window_mode_entry) entry; |
1235 | | }; |
1236 | | |
1237 | | /* Type of request to client. */ |
1238 | | enum input_request_type { |
1239 | | INPUT_REQUEST_PALETTE, |
1240 | | INPUT_REQUEST_CLIPBOARD, |
1241 | | INPUT_REQUEST_QUEUE |
1242 | | }; |
1243 | | |
1244 | | /* Palette request reply data. */ |
1245 | | struct input_request_palette_data { |
1246 | | int idx; |
1247 | | int c; |
1248 | | }; |
1249 | | |
1250 | | /* Clipboard request reply data. */ |
1251 | | struct input_request_clipboard_data { |
1252 | | char *buf; |
1253 | | size_t len; |
1254 | | char clip; |
1255 | | }; |
1256 | | |
1257 | | /* Request sent to client on behalf of pane. */ |
1258 | | TAILQ_HEAD(input_requests, input_request); |
1259 | | |
1260 | | /* Offsets into pane buffer. */ |
1261 | | struct window_pane_offset { |
1262 | | size_t used; |
1263 | | }; |
1264 | | |
1265 | | /* Queued pane resize. */ |
1266 | | struct window_pane_resize { |
1267 | | u_int sx; |
1268 | | u_int sy; |
1269 | | |
1270 | | u_int osx; |
1271 | | u_int osy; |
1272 | | |
1273 | | TAILQ_ENTRY(window_pane_resize) entry; |
1274 | | }; |
1275 | | TAILQ_HEAD(window_pane_resizes, window_pane_resize); |
1276 | | |
1277 | | /* |
1278 | | * Client theme, this is worked out from the background colour if not reported |
1279 | | * by terminal. |
1280 | | */ |
1281 | | enum client_theme { |
1282 | | THEME_UNKNOWN, |
1283 | | THEME_LIGHT, |
1284 | | THEME_DARK |
1285 | | }; |
1286 | | |
1287 | | /* Visible range array element. */ |
1288 | | struct visible_range { |
1289 | | u_int px; /* start */ |
1290 | | u_int nx; /* length */ |
1291 | | }; |
1292 | | |
1293 | | /* Visible areas not obstructed. */ |
1294 | | struct visible_ranges { |
1295 | | struct visible_range *ranges; /* dynamically allocated array */ |
1296 | | u_int used; /* number of entries in ranges */ |
1297 | | u_int size; /* allocated capacity of ranges */ |
1298 | | }; |
1299 | | |
1300 | | /* Child window structure. */ |
1301 | | struct window_pane { |
1302 | | u_int id; |
1303 | | int references; |
1304 | | u_int active_point; |
1305 | | |
1306 | | struct window *window; |
1307 | | struct options *options; |
1308 | | |
1309 | | struct layout_cell *layout_cell; |
1310 | | struct layout_cell *saved_layout_cell; |
1311 | | |
1312 | | u_int sx; |
1313 | | u_int sy; |
1314 | | |
1315 | | int xoff; |
1316 | | int yoff; |
1317 | | |
1318 | | int flags; |
1319 | 0 | #define PANE_REDRAW 0x1 |
1320 | 0 | #define PANE_DROP 0x2 |
1321 | 0 | #define PANE_FOCUSED 0x4 |
1322 | 0 | #define PANE_VISITED 0x8 |
1323 | 0 | #define PANE_ZOOMED 0x10 |
1324 | 0 | #define PANE_NEWSTATUS 0x20 |
1325 | 0 | #define PANE_INPUTOFF 0x40 |
1326 | 0 | #define PANE_CHANGED 0x80 |
1327 | 0 | #define PANE_EXITED 0x100 |
1328 | 0 | #define PANE_STATUSREADY 0x200 |
1329 | 0 | #define PANE_STATUSDRAWN 0x400 |
1330 | 0 | #define PANE_EMPTY 0x800 |
1331 | 0 | #define PANE_STYLECHANGED 0x1000 |
1332 | 0 | #define PANE_THEMECHANGED 0x2000 |
1333 | 0 | #define PANE_UNSEENCHANGES 0x4000 |
1334 | 0 | #define PANE_REDRAWSCROLLBAR 0x8000 |
1335 | 0 | #define PANE_DESTROYED 0x10000 |
1336 | 0 | #define PANE_CMDRUNNING 0x20000 |
1337 | 0 | #define PANE_ACTIVITY 0x40000 |
1338 | 0 | #define PANE_CLOSEONCLICK 0x80000 |
1339 | 0 | #define PANE_CAPTUREALLKEYS 0x100000 |
1340 | 0 | #define PANE_FLOATOVERZOOM 0x200000 |
1341 | | |
1342 | | bitstr_t *sync_dirty; |
1343 | | u_int sync_dirty_size; |
1344 | | |
1345 | | u_int sb_slider_y; |
1346 | | u_int sb_slider_h; |
1347 | | int sb_auto_visible; |
1348 | | int sb_auto_hover; |
1349 | | struct event sb_auto_timer; |
1350 | | |
1351 | | int argc; |
1352 | | char **argv; |
1353 | | char *shell; |
1354 | | char *cwd; |
1355 | | |
1356 | | pid_t pid; |
1357 | | char tty[TTY_NAME_MAX]; |
1358 | | int status; |
1359 | | struct timeval dead_time; |
1360 | | struct cmdq_item *wait_item; /* new-pane -W: waiting for pane exit */ |
1361 | | struct spawn_editor_state *editor; |
1362 | | |
1363 | | time_t last_output_time; |
1364 | | time_t last_prompt_time; |
1365 | | time_t cmd_start_time; |
1366 | | time_t cmd_end_time; |
1367 | | int cmd_status; |
1368 | | |
1369 | | int fd; |
1370 | | struct bufferevent *event; |
1371 | | |
1372 | | struct window_pane_offset offset; |
1373 | | size_t base_offset; |
1374 | | |
1375 | | struct window_pane_resizes resize_queue; |
1376 | | struct event resize_timer; |
1377 | | struct event sync_timer; |
1378 | | |
1379 | | struct input_ctx *ictx; |
1380 | | |
1381 | | struct grid_cell cached_gc; |
1382 | | struct grid_cell cached_active_gc; |
1383 | | u_int cached_dim; |
1384 | | u_int cached_active_dim; |
1385 | | struct colour_palette palette; |
1386 | | enum client_theme last_theme; |
1387 | | struct style_line_entry border_status_line; |
1388 | | |
1389 | | int pipe_fd; |
1390 | | pid_t pipe_pid; |
1391 | | struct bufferevent *pipe_event; |
1392 | | struct window_pane_offset pipe_offset; |
1393 | | |
1394 | | struct screen *screen; |
1395 | | struct screen base; |
1396 | | |
1397 | | struct screen status_screen; |
1398 | | |
1399 | | TAILQ_HEAD(, window_mode_entry) modes; |
1400 | | |
1401 | | char *searchstr; |
1402 | | int searchregex; |
1403 | | |
1404 | | struct prompt *prompt; |
1405 | | struct window_pane_prompt *prompt_data; |
1406 | | u_int prompt_cx; |
1407 | | |
1408 | | int border_gc_set; |
1409 | | struct grid_cell border_gc; |
1410 | | int active_border_gc_set; |
1411 | | struct grid_cell active_border_gc; |
1412 | | |
1413 | | int control_bg; |
1414 | | int control_fg; |
1415 | | |
1416 | | struct style scrollbar_style; |
1417 | | |
1418 | | struct visible_ranges r; |
1419 | | |
1420 | | TAILQ_ENTRY(window_pane) entry; /* link in list of all panes */ |
1421 | | TAILQ_ENTRY(window_pane) sentry; /* link in list of last visited */ |
1422 | | TAILQ_ENTRY(window_pane) zentry; /* z-index link in list of all panes */ |
1423 | | RB_ENTRY(window_pane) tree_entry; |
1424 | | }; |
1425 | | TAILQ_HEAD(window_panes, window_pane); |
1426 | | TAILQ_HEAD(window_panes_zindex, window_pane); |
1427 | | RB_HEAD(window_pane_tree, window_pane); |
1428 | | |
1429 | | /* Window structure. */ |
1430 | | struct window { |
1431 | | u_int id; |
1432 | | void *latest; |
1433 | | |
1434 | | char *name; |
1435 | | struct event name_event; |
1436 | | struct timeval name_time; |
1437 | | |
1438 | | struct event alerts_timer; |
1439 | | struct event offset_timer; |
1440 | | |
1441 | | struct timeval activity_time; |
1442 | | struct timeval creation_time; |
1443 | | |
1444 | | struct window_pane *active; |
1445 | | struct window_pane *modal; |
1446 | | struct window_pane *modal_last; |
1447 | | struct window_pane *was_zoomed; |
1448 | | struct window_panes last_panes; |
1449 | | struct window_panes z_index; |
1450 | | struct window_panes panes; |
1451 | | |
1452 | | int lastlayout; |
1453 | | struct layout_cell *layout_root; |
1454 | | struct layout_cell *saved_layout_root; |
1455 | | char *old_layout; |
1456 | | |
1457 | | u_int sx; |
1458 | | u_int sy; |
1459 | | u_int manual_sx; |
1460 | | u_int manual_sy; |
1461 | | u_int xpixel; |
1462 | | u_int ypixel; |
1463 | | |
1464 | | u_int new_sx; |
1465 | | u_int new_sy; |
1466 | | u_int new_xpixel; |
1467 | | u_int new_ypixel; |
1468 | | |
1469 | | uint64_t redraw_scene_generation; |
1470 | | |
1471 | | struct menu_data *menu; |
1472 | | u_int menu_last_px; |
1473 | | u_int menu_last_py; |
1474 | | |
1475 | | u_int last_new_pane_x; |
1476 | | u_int last_new_pane_y; |
1477 | | |
1478 | | int sb; |
1479 | | int sb_pos; |
1480 | | |
1481 | | struct grid_cell inside_cell; |
1482 | | struct grid_cell outside_cell; |
1483 | | int flags; |
1484 | 0 | #define WINDOW_BELL 0x1 |
1485 | 0 | #define WINDOW_ACTIVITY 0x2 |
1486 | 0 | #define WINDOW_SILENCE 0x4 |
1487 | 0 | #define WINDOW_ZOOMED 0x8 |
1488 | 0 | #define WINDOW_WASZOOMED 0x10 |
1489 | 0 | #define WINDOW_RESIZE 0x20 |
1490 | 0 | #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) |
1491 | | |
1492 | | int alerts_queued; |
1493 | | TAILQ_ENTRY(window) alerts_entry; |
1494 | | |
1495 | | struct options *options; |
1496 | | |
1497 | | u_int references; |
1498 | | TAILQ_HEAD(, winlink) winlinks; |
1499 | | |
1500 | | RB_ENTRY(window) entry; |
1501 | | }; |
1502 | | RB_HEAD(windows, window); |
1503 | | |
1504 | | /* Entry on local window list. */ |
1505 | | struct winlink { |
1506 | | int idx; |
1507 | | struct session *session; |
1508 | | struct window *window; |
1509 | | |
1510 | | int flags; |
1511 | 0 | #define WINLINK_BELL 0x1 |
1512 | 0 | #define WINLINK_ACTIVITY 0x2 |
1513 | 0 | #define WINLINK_SILENCE 0x4 |
1514 | 0 | #define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE) |
1515 | 0 | #define WINLINK_VISITED 0x8 |
1516 | | |
1517 | | RB_ENTRY(winlink) entry; |
1518 | | TAILQ_ENTRY(winlink) wentry; |
1519 | | TAILQ_ENTRY(winlink) sentry; |
1520 | | }; |
1521 | | RB_HEAD(winlinks, winlink); |
1522 | | TAILQ_HEAD(winlink_stack, winlink); |
1523 | | |
1524 | | /* Window size option. */ |
1525 | 0 | #define WINDOW_SIZE_LARGEST 0 |
1526 | 0 | #define WINDOW_SIZE_SMALLEST 1 |
1527 | 0 | #define WINDOW_SIZE_MANUAL 2 |
1528 | 0 | #define WINDOW_SIZE_LATEST 3 |
1529 | | |
1530 | | /* Pane border status option. */ |
1531 | 0 | #define PANE_STATUS_OFF 0 |
1532 | 0 | #define PANE_STATUS_TOP 1 |
1533 | 0 | #define PANE_STATUS_BOTTOM 2 |
1534 | 0 | #define PANE_STATUS_TOP_FLOATING 3 |
1535 | 0 | #define PANE_STATUS_BOTTOM_FLOATING 4 |
1536 | | |
1537 | | /* Pane scrollbars option. */ |
1538 | | #define PANE_SCROLLBARS_OFF 0 |
1539 | 0 | #define PANE_SCROLLBARS_MODAL 1 |
1540 | 0 | #define PANE_SCROLLBARS_ALWAYS 2 |
1541 | 0 | #define PANE_SCROLLBARS_AUTOHIDE 3 |
1542 | | |
1543 | | /* Pane scrollbars position option. */ |
1544 | 0 | #define PANE_SCROLLBARS_RIGHT 0 |
1545 | 0 | #define PANE_SCROLLBARS_LEFT 1 |
1546 | | |
1547 | | /* Pane scrollbars width, padding and fill character. */ |
1548 | 0 | #define PANE_SCROLLBARS_DEFAULT_PADDING 0 |
1549 | 0 | #define PANE_SCROLLBARS_DEFAULT_WIDTH 1 |
1550 | 0 | #define PANE_SCROLLBARS_CHARACTER ' ' |
1551 | | |
1552 | | /* True if screen in alternate screen. */ |
1553 | 0 | #define SCREEN_IS_ALTERNATE(s) ((s)->saved_grid != NULL) |
1554 | | |
1555 | | /* Layout direction. */ |
1556 | | enum layout_type { |
1557 | | LAYOUT_LEFTRIGHT, |
1558 | | LAYOUT_TOPBOTTOM, |
1559 | | LAYOUT_WINDOWPANE |
1560 | | }; |
1561 | | |
1562 | | /* Layout cell sizes and position. */ |
1563 | | struct layout_geometry { |
1564 | | u_int sx; |
1565 | | u_int sy; |
1566 | | int xoff; |
1567 | | int yoff; |
1568 | | }; |
1569 | | |
1570 | | /* Layout cells queue. */ |
1571 | | TAILQ_HEAD(layout_cells, layout_cell); |
1572 | | |
1573 | | /* Layout cell. */ |
1574 | | struct layout_cell { |
1575 | | enum layout_type type; |
1576 | | |
1577 | | int flags; |
1578 | 0 | #define LAYOUT_CELL_FLOATING 0x1 |
1579 | | |
1580 | | struct layout_cell *parent; |
1581 | | |
1582 | | struct layout_geometry g; |
1583 | | struct layout_geometry fg; /* saved floating pane */ |
1584 | | |
1585 | | struct window_pane *wp; |
1586 | | struct layout_cells cells; |
1587 | | |
1588 | | TAILQ_ENTRY(layout_cell) entry; |
1589 | | }; |
1590 | | |
1591 | | /* Environment variable. */ |
1592 | | struct environ_entry { |
1593 | | char *name; |
1594 | | char *value; |
1595 | | |
1596 | | int flags; |
1597 | 0 | #define ENVIRON_HIDDEN 0x1 |
1598 | | |
1599 | | RB_ENTRY(environ_entry) entry; |
1600 | | }; |
1601 | | |
1602 | | /* Client session. */ |
1603 | | struct session_group { |
1604 | | const char *name; |
1605 | | TAILQ_HEAD(, session) sessions; |
1606 | | |
1607 | | RB_ENTRY(session_group) entry; |
1608 | | }; |
1609 | | RB_HEAD(session_groups, session_group); |
1610 | | |
1611 | | struct session { |
1612 | | u_int id; |
1613 | | |
1614 | | char *name; |
1615 | | const char *cwd; |
1616 | | |
1617 | | struct timeval creation_time; |
1618 | | struct timeval last_attached_time; |
1619 | | struct timeval activity_time; |
1620 | | struct timeval last_activity_time; |
1621 | | |
1622 | | struct event lock_timer; |
1623 | | |
1624 | | struct winlink *curw; |
1625 | | struct winlink_stack lastw; |
1626 | | struct winlinks windows; |
1627 | | |
1628 | | int statusat; |
1629 | | u_int statuslines; |
1630 | | |
1631 | | struct options *options; |
1632 | | |
1633 | 0 | #define SESSION_ALERTED 0x1 |
1634 | | int flags; |
1635 | | |
1636 | | u_int attached; |
1637 | | |
1638 | | struct termios *tio; |
1639 | | |
1640 | | struct environ *environ; |
1641 | | |
1642 | | int references; |
1643 | | |
1644 | | TAILQ_ENTRY(session) gentry; |
1645 | | RB_ENTRY(session) entry; |
1646 | | }; |
1647 | | RB_HEAD(sessions, session); |
1648 | | |
1649 | | /* Mouse button masks. */ |
1650 | 0 | #define MOUSE_MASK_BUTTONS 195 |
1651 | 0 | #define MOUSE_MASK_SHIFT 4 |
1652 | 0 | #define MOUSE_MASK_META 8 |
1653 | 0 | #define MOUSE_MASK_CTRL 16 |
1654 | 0 | #define MOUSE_MASK_DRAG 32 |
1655 | 0 | #define MOUSE_MASK_MODIFIERS (MOUSE_MASK_SHIFT|MOUSE_MASK_META|MOUSE_MASK_CTRL) |
1656 | | |
1657 | | /* Mouse wheel type. */ |
1658 | 0 | #define MOUSE_WHEEL_UP 64 |
1659 | 0 | #define MOUSE_WHEEL_DOWN 65 |
1660 | | |
1661 | | /* Mouse button type. */ |
1662 | 0 | #define MOUSE_BUTTON_1 0 |
1663 | 0 | #define MOUSE_BUTTON_2 1 |
1664 | 0 | #define MOUSE_BUTTON_3 2 |
1665 | 0 | #define MOUSE_BUTTON_6 66 |
1666 | 0 | #define MOUSE_BUTTON_7 67 |
1667 | 0 | #define MOUSE_BUTTON_8 128 |
1668 | 0 | #define MOUSE_BUTTON_9 129 |
1669 | 0 | #define MOUSE_BUTTON_10 130 |
1670 | 0 | #define MOUSE_BUTTON_11 131 |
1671 | | |
1672 | | /* Mouse helpers. */ |
1673 | 0 | #define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS) |
1674 | | #define MOUSE_WHEEL(b) \ |
1675 | 0 | (((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_UP || \ |
1676 | 0 | ((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_DOWN) |
1677 | 0 | #define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG) |
1678 | 0 | #define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3) |
1679 | | |
1680 | | /* Mouse input. */ |
1681 | | struct mouse_event { |
1682 | | int valid; |
1683 | | int ignore; |
1684 | | |
1685 | | key_code key; |
1686 | | |
1687 | | int statusat; |
1688 | | u_int statuslines; |
1689 | | |
1690 | | u_int x; |
1691 | | u_int y; |
1692 | | u_int b; |
1693 | | |
1694 | | u_int lx; |
1695 | | u_int ly; |
1696 | | u_int lb; |
1697 | | |
1698 | | u_int ox; |
1699 | | u_int oy; |
1700 | | |
1701 | | int s; |
1702 | | int w; |
1703 | | int wp; |
1704 | | |
1705 | | u_int sgr_type; |
1706 | | u_int sgr_b; |
1707 | | }; |
1708 | | |
1709 | | /* Key event. */ |
1710 | | struct key_event { |
1711 | | struct client *client; |
1712 | | |
1713 | | key_code key; |
1714 | | struct mouse_event m; |
1715 | | |
1716 | | char *buf; |
1717 | | size_t len; |
1718 | | }; |
1719 | | |
1720 | | /* Terminal definition. */ |
1721 | | struct tty_term { |
1722 | | char *name; |
1723 | | struct tty *tty; |
1724 | | int applied_features; |
1725 | | |
1726 | | char acs[UCHAR_MAX + 1][2]; |
1727 | | |
1728 | | struct tty_code *codes; |
1729 | | |
1730 | 13.9k | #define TERM_256COLOURS 0x1 |
1731 | 0 | #define TERM_NOAM 0x2 |
1732 | 0 | #define TERM_DECSLRM 0x4 |
1733 | 0 | #define TERM_DECFRA 0x8 |
1734 | 13.9k | #define TERM_RGBCOLOURS 0x10 |
1735 | 0 | #define TERM_VT100LIKE 0x20 |
1736 | 0 | #define TERM_SIXEL 0x40 |
1737 | 0 | #define TERM_INVALIDMS 0x80 |
1738 | | int flags; |
1739 | | |
1740 | | LIST_ENTRY(tty_term) entry; |
1741 | | }; |
1742 | | LIST_HEAD(tty_terms, tty_term); |
1743 | | |
1744 | | /* Terminal style context. */ |
1745 | | struct tty_style_ctx { |
1746 | | const struct grid_cell *defaults; |
1747 | | struct colour_palette *palette; |
1748 | | u_int dim; |
1749 | | struct hyperlinks *hyperlinks; |
1750 | | }; |
1751 | | |
1752 | | /* Client terminal. */ |
1753 | | struct tty { |
1754 | | struct client *client; |
1755 | | struct event start_timer; |
1756 | | struct event clipboard_timer; |
1757 | | time_t last_requests; |
1758 | | |
1759 | | u_int sx; |
1760 | | u_int sy; |
1761 | | /* Cell size in pixels. */ |
1762 | | u_int xpixel; |
1763 | | u_int ypixel; |
1764 | | |
1765 | | u_int cx; |
1766 | | u_int cy; |
1767 | | enum screen_cursor_style cstyle; |
1768 | | int ccolour; |
1769 | | |
1770 | | /* Properties of the area being drawn on. */ |
1771 | | /* When true, the drawing area is bigger than the terminal. */ |
1772 | | int oflag; |
1773 | | u_int oox; |
1774 | | u_int ooy; |
1775 | | u_int osx; |
1776 | | u_int osy; |
1777 | | |
1778 | | int mode; |
1779 | | int fg; |
1780 | | int bg; |
1781 | | |
1782 | | u_int rlower; |
1783 | | u_int rupper; |
1784 | | |
1785 | | u_int rleft; |
1786 | | u_int rright; |
1787 | | |
1788 | | struct event event_in; |
1789 | | struct evbuffer *in; |
1790 | | struct event event_out; |
1791 | | struct evbuffer *out; |
1792 | | struct event timer; |
1793 | | size_t discarded; |
1794 | | |
1795 | | struct termios tio; |
1796 | | struct visible_ranges r; |
1797 | | |
1798 | | struct grid_cell cell; |
1799 | | struct grid_cell last_cell; |
1800 | | |
1801 | 0 | #define TTY_NOCURSOR 0x1 |
1802 | 0 | #define TTY_FREEZE 0x2 |
1803 | 0 | #define TTY_TIMER 0x4 |
1804 | 0 | #define TTY_NOBLOCK 0x8 |
1805 | 0 | #define TTY_STARTED 0x10 |
1806 | 0 | #define TTY_OPENED 0x20 |
1807 | 0 | #define TTY_OSC52QUERY 0x40 |
1808 | 0 | #define TTY_BLOCK 0x80 |
1809 | 0 | #define TTY_HAVEDA 0x100 |
1810 | 0 | #define TTY_HAVEXDA 0x200 |
1811 | 0 | #define TTY_SYNCING 0x400 |
1812 | 0 | #define TTY_HAVEDA2 0x800 |
1813 | 0 | #define TTY_WINSIZEQUERY 0x1000 |
1814 | 0 | #define TTY_WAITFG 0x2000 |
1815 | 0 | #define TTY_WAITBG 0x4000 |
1816 | 0 | #define TTY_BRACKETPASTE 0x8000 |
1817 | 0 | #define TTY_HAVESYNC 0x10000 |
1818 | | #define TTY_ALL_REQUEST_FLAGS \ |
1819 | 0 | (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVESYNC) |
1820 | | int flags; |
1821 | | |
1822 | | struct tty_term *term; |
1823 | | |
1824 | | u_int mouse_last_x; |
1825 | | u_int mouse_last_y; |
1826 | | u_int mouse_last_b; |
1827 | | int mouse_drag_flag; |
1828 | | u_int mouse_drag_x; |
1829 | | u_int mouse_drag_y; |
1830 | | int mouse_scrolling_flag; |
1831 | | int mouse_slider_mpos; |
1832 | | int mouse_last_pane; |
1833 | | void (*mouse_drag_update)(struct client *, |
1834 | | struct mouse_event *); |
1835 | | void (*mouse_drag_release)(struct client *, |
1836 | | struct mouse_event *); |
1837 | | |
1838 | | struct event key_timer; |
1839 | | struct tty_key *key_tree; |
1840 | | }; |
1841 | | |
1842 | | /* Terminal command context. */ |
1843 | | typedef void (*tty_ctx_redraw_cb)(const struct tty_ctx *); |
1844 | | typedef int (*tty_ctx_set_client_cb)(struct tty_ctx *, struct client *); |
1845 | | struct tty_ctx { |
1846 | | struct screen *s; |
1847 | | |
1848 | | tty_ctx_redraw_cb redraw_cb; |
1849 | | tty_ctx_set_client_cb set_client_cb; |
1850 | | void *arg; |
1851 | | |
1852 | | const struct grid_cell *cell; |
1853 | | int flags; |
1854 | 0 | #define TTY_CTX_WRAPPED 0x1 |
1855 | 0 | #define TTY_CTX_INVISIBLE_PANES 0x2 |
1856 | 0 | #define TTY_CTX_WINDOW_BIGGER 0x4 |
1857 | 0 | #define TTY_CTX_SYNC 0x8 |
1858 | 0 | #define TTY_CTX_OVERLAY_SYNC 0x10 |
1859 | 0 | #define TTY_CTX_CELL_INVALIDATE 0x20 |
1860 | 0 | #define TTY_CTX_PANE_OBSCURED 0x40 |
1861 | | |
1862 | | union { |
1863 | | u_int n; |
1864 | | |
1865 | | struct { |
1866 | | const char *data; |
1867 | | size_t size; |
1868 | | } data; |
1869 | | |
1870 | | struct { |
1871 | | const char *clip; |
1872 | | const char *data; |
1873 | | size_t size; |
1874 | | } sel; |
1875 | | |
1876 | | #ifdef ENABLE_SIXEL |
1877 | | struct image *image; |
1878 | | #endif |
1879 | | }; |
1880 | | |
1881 | | /* |
1882 | | * Cursor and region position before the screen was updated - this is |
1883 | | * where the command should be applied; the values in the screen have |
1884 | | * already been updated. |
1885 | | */ |
1886 | | u_int ocx; |
1887 | | u_int ocy; |
1888 | | |
1889 | | u_int orupper; |
1890 | | u_int orlower; |
1891 | | |
1892 | | /* Target region (usually pane) offset and size. */ |
1893 | | int xoff; |
1894 | | int yoff; |
1895 | | int rxoff; |
1896 | | int ryoff; |
1897 | | u_int sx; |
1898 | | u_int sy; |
1899 | | |
1900 | | /* The background colour used for clearing (erasing). */ |
1901 | | u_int bg; |
1902 | | |
1903 | | /* The default colours and palette. */ |
1904 | | struct grid_cell defaults; |
1905 | | struct tty_style_ctx style_ctx; |
1906 | | |
1907 | | /* Containing region (usually window) offset and size. */ |
1908 | | u_int wox; |
1909 | | u_int woy; |
1910 | | u_int wsx; |
1911 | | u_int wsy; |
1912 | | }; |
1913 | | |
1914 | | /* Saved message entry. */ |
1915 | | struct message_entry { |
1916 | | char *msg; |
1917 | | u_int msg_num; |
1918 | | struct timeval msg_time; |
1919 | | |
1920 | | TAILQ_ENTRY(message_entry) entry; |
1921 | | }; |
1922 | | TAILQ_HEAD(message_list, message_entry); |
1923 | | |
1924 | | /* Argument type. */ |
1925 | | enum args_type { |
1926 | | ARGS_NONE, |
1927 | | ARGS_STRING, |
1928 | | ARGS_COMMANDS |
1929 | | }; |
1930 | | |
1931 | | /* Argument value. */ |
1932 | | struct args_value { |
1933 | | enum args_type type; |
1934 | | union { |
1935 | | char *string; |
1936 | | struct cmd_list *cmdlist; |
1937 | | }; |
1938 | | char *cached; |
1939 | | TAILQ_ENTRY(args_value) entry; |
1940 | | }; |
1941 | | |
1942 | | /* Arguments set. */ |
1943 | | struct args_entry; |
1944 | | RB_HEAD(args_tree, args_entry); |
1945 | | |
1946 | | /* Arguments parsing type. */ |
1947 | | enum args_parse_type { |
1948 | | ARGS_PARSE_INVALID, |
1949 | | ARGS_PARSE_STRING, |
1950 | | ARGS_PARSE_COMMANDS_OR_STRING, |
1951 | | ARGS_PARSE_COMMANDS |
1952 | | }; |
1953 | | |
1954 | | /* Arguments parsing state. */ |
1955 | | typedef enum args_parse_type (*args_parse_cb)(struct args *, u_int, char **); |
1956 | | struct args_parse { |
1957 | | const char *template; |
1958 | | int lower; |
1959 | | int upper; |
1960 | | args_parse_cb cb; |
1961 | | }; |
1962 | | |
1963 | | /* Command find structures. */ |
1964 | | enum cmd_find_type { |
1965 | | CMD_FIND_PANE, |
1966 | | CMD_FIND_WINDOW, |
1967 | | CMD_FIND_SESSION, |
1968 | | }; |
1969 | | struct cmd_find_state { |
1970 | | int flags; |
1971 | | struct cmd_find_state *current; |
1972 | | |
1973 | | struct session *s; |
1974 | | struct winlink *wl; |
1975 | | struct window *w; |
1976 | | struct window_pane *wp; |
1977 | | int idx; |
1978 | | }; |
1979 | | |
1980 | | /* Command find flags. */ |
1981 | 0 | #define CMD_FIND_PREFER_UNATTACHED 0x1 |
1982 | 0 | #define CMD_FIND_QUIET 0x2 |
1983 | 0 | #define CMD_FIND_WINDOW_INDEX 0x4 |
1984 | 0 | #define CMD_FIND_DEFAULT_MARKED 0x8 |
1985 | 0 | #define CMD_FIND_EXACT_SESSION 0x10 |
1986 | 0 | #define CMD_FIND_EXACT_WINDOW 0x20 |
1987 | 0 | #define CMD_FIND_CANFAIL 0x40 |
1988 | | |
1989 | | /* List of commands. */ |
1990 | | struct cmd_list { |
1991 | | int references; |
1992 | | u_int group; |
1993 | | struct cmds *list; |
1994 | | }; |
1995 | | |
1996 | | /* Command return values. */ |
1997 | | enum cmd_retval { |
1998 | | CMD_RETURN_ERROR = -1, |
1999 | | CMD_RETURN_NORMAL = 0, |
2000 | | CMD_RETURN_WAIT, |
2001 | | CMD_RETURN_STOP |
2002 | | }; |
2003 | | |
2004 | | /* Command parse result. */ |
2005 | | enum cmd_parse_status { |
2006 | | CMD_PARSE_ERROR, |
2007 | | CMD_PARSE_SUCCESS |
2008 | | }; |
2009 | | struct cmd_parse_result { |
2010 | | enum cmd_parse_status status; |
2011 | | struct cmd_list *cmdlist; |
2012 | | char *error; |
2013 | | }; |
2014 | | struct cmd_parse_input { |
2015 | | int flags; |
2016 | 0 | #define CMD_PARSE_QUIET 0x1 |
2017 | 0 | #define CMD_PARSE_PARSEONLY 0x2 |
2018 | 2 | #define CMD_PARSE_NOALIAS 0x4 |
2019 | 0 | #define CMD_PARSE_VERBOSE 0x8 |
2020 | 4 | #define CMD_PARSE_ONEGROUP 0x10 |
2021 | | |
2022 | | const char *file; |
2023 | | u_int line; |
2024 | | |
2025 | | struct cmdq_item *item; |
2026 | | struct client *c; |
2027 | | struct cmd_find_state fs; |
2028 | | }; |
2029 | | |
2030 | | /* Command queue flags. */ |
2031 | 0 | #define CMDQ_STATE_REPEAT 0x1 |
2032 | 0 | #define CMDQ_STATE_CONTROL 0x2 |
2033 | 0 | #define CMDQ_STATE_NOHOOKS 0x4 |
2034 | | |
2035 | | /* Command queue callback. */ |
2036 | | typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *); |
2037 | | |
2038 | | /* Command definition flag. */ |
2039 | | struct cmd_entry_flag { |
2040 | | char flag; |
2041 | | enum cmd_find_type type; |
2042 | | int flags; |
2043 | | }; |
2044 | | |
2045 | | /* Command definition. */ |
2046 | | struct cmd_entry { |
2047 | | const char *name; |
2048 | | const char *alias; |
2049 | | |
2050 | | struct args_parse args; |
2051 | | const char *usage; |
2052 | | |
2053 | | struct cmd_entry_flag source; |
2054 | | struct cmd_entry_flag target; |
2055 | | |
2056 | 0 | #define CMD_STARTSERVER 0x1 |
2057 | 0 | #define CMD_READONLY 0x2 |
2058 | 0 | #define CMD_AFTERHOOK 0x4 |
2059 | 0 | #define CMD_CLIENT_CFLAG 0x8 |
2060 | 0 | #define CMD_CLIENT_TFLAG 0x10 |
2061 | 0 | #define CMD_CLIENT_CANFAIL 0x20 |
2062 | | int flags; |
2063 | | |
2064 | | enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *); |
2065 | | }; |
2066 | | |
2067 | | /* Status line. */ |
2068 | | #define STATUS_LINES_LIMIT 5 |
2069 | | struct status_line { |
2070 | | struct event timer; |
2071 | | |
2072 | | struct screen screen; |
2073 | | struct screen *active; |
2074 | | int references; |
2075 | | |
2076 | | u_int prompt_cx; |
2077 | | |
2078 | | struct grid_cell style; |
2079 | | struct style_line_entry entries[STATUS_LINES_LIMIT]; |
2080 | | }; |
2081 | | |
2082 | | /* File in client. */ |
2083 | | typedef void (*client_file_cb) (struct client *, const char *, int, int, |
2084 | | struct evbuffer *, void *); |
2085 | | struct client_file { |
2086 | | struct client *c; |
2087 | | struct tmuxpeer *peer; |
2088 | | struct client_files *tree; |
2089 | | int references; |
2090 | | int stream; |
2091 | | |
2092 | | char *path; |
2093 | | struct evbuffer *buffer; |
2094 | | struct bufferevent *event; |
2095 | | |
2096 | | int fd; |
2097 | | int error; |
2098 | | int closed; |
2099 | | |
2100 | | client_file_cb cb; |
2101 | | void *data; |
2102 | | |
2103 | | RB_ENTRY(client_file) entry; |
2104 | | }; |
2105 | | RB_HEAD(client_files, client_file); |
2106 | | |
2107 | | /* Maximum time to be pasting. */ |
2108 | 0 | #define CLIENT_PASTE_TIME_LIMIT 5 |
2109 | | |
2110 | | /* Prompt type. */ |
2111 | 0 | #define PROMPT_NTYPES 2 |
2112 | | enum prompt_type { |
2113 | | PROMPT_TYPE_COMMAND, |
2114 | | PROMPT_TYPE_SEARCH, |
2115 | | PROMPT_TYPE_INVALID = 0xff |
2116 | | }; |
2117 | | |
2118 | | /* Prompt result. */ |
2119 | | enum prompt_result { |
2120 | | PROMPT_CONTINUE, |
2121 | | PROMPT_CLOSE |
2122 | | }; |
2123 | | |
2124 | | /* Prompt key result. */ |
2125 | | enum prompt_key_result { |
2126 | | PROMPT_KEY_NOT_HANDLED, |
2127 | | PROMPT_KEY_HANDLED, |
2128 | | PROMPT_KEY_CLOSE, |
2129 | | PROMPT_KEY_MOVE |
2130 | | }; |
2131 | | |
2132 | | /* Prompt callbacks. */ |
2133 | | typedef enum prompt_result (*prompt_input_cb)(void *, const char *, |
2134 | | enum prompt_key_result); |
2135 | | typedef enum prompt_result (*status_prompt_input_cb)(struct client *, void *, |
2136 | | const char *, enum prompt_key_result); |
2137 | | typedef enum prompt_result (*mode_tree_prompt_input_cb)(struct client *, void *, |
2138 | | const char *, enum prompt_key_result); |
2139 | | typedef void (*prompt_free_cb)(void *); |
2140 | | |
2141 | | /* Prompt flags. */ |
2142 | 0 | #define PROMPT_SINGLE 0x1 |
2143 | 0 | #define PROMPT_NUMERIC 0x2 |
2144 | 0 | #define PROMPT_INCREMENTAL 0x4 |
2145 | 0 | #define PROMPT_NOFORMAT 0x8 |
2146 | 0 | #define PROMPT_KEY 0x10 |
2147 | 0 | #define PROMPT_ACCEPT 0x20 |
2148 | 0 | #define PROMPT_QUOTENEXT 0x40 |
2149 | 0 | #define PROMPT_BSPACE_EXIT 0x80 |
2150 | 0 | #define PROMPT_NOFREEZE 0x100 |
2151 | 0 | #define PROMPT_COMMANDMODE 0x200 |
2152 | 0 | #define PROMPT_ISPANE 0x400 |
2153 | 0 | #define PROMPT_ISMODE 0x800 |
2154 | 0 | #define PROMPT_EDITARROWS 0x1000 |
2155 | | |
2156 | | /* Prompt create data. */ |
2157 | | struct prompt_create_data { |
2158 | | struct cmd_find_state *fs; |
2159 | | const char *prompt; |
2160 | | const char *input; |
2161 | | enum prompt_type type; |
2162 | | int flags; |
2163 | | |
2164 | | struct grid_cell style; |
2165 | | struct grid_cell command_style; |
2166 | | const char *style_str; |
2167 | | const char *command_style_str; |
2168 | | enum screen_cursor_style cstyle; |
2169 | | enum screen_cursor_style command_cstyle; |
2170 | | int ccolour; |
2171 | | int command_ccolour; |
2172 | | int cmode; |
2173 | | int command_cmode; |
2174 | | const char *message_format; |
2175 | | int keys; |
2176 | | const char *word_separators; |
2177 | | |
2178 | | prompt_input_cb inputcb; |
2179 | | prompt_free_cb freecb; |
2180 | | void *data; |
2181 | | }; |
2182 | | |
2183 | | /* Prompt draw data. */ |
2184 | | struct prompt_draw_data { |
2185 | | struct screen_write_ctx *ctx; |
2186 | | u_int *cursor_x; |
2187 | | |
2188 | | u_int area_x; |
2189 | | u_int area_width; |
2190 | | u_int prompt_line; |
2191 | | }; |
2192 | | |
2193 | | /* Overlay callbacks */ |
2194 | | typedef struct visible_ranges *(*overlay_check_cb)(struct client *, void *, |
2195 | | u_int, u_int, u_int); |
2196 | | typedef struct screen *(*overlay_mode_cb)(struct client *, void *, u_int *, |
2197 | | u_int *); |
2198 | | typedef void (*overlay_draw_cb)(struct client *, void *); |
2199 | | typedef int (*overlay_key_cb)(struct client *, void *, struct key_event *); |
2200 | | typedef void (*overlay_free_cb)(struct client *, void *); |
2201 | | typedef void (*overlay_resize_cb)(struct client *, void *); |
2202 | | |
2203 | | /* Client connection. */ |
2204 | | struct client { |
2205 | | const char *name; |
2206 | | struct tmuxpeer *peer; |
2207 | | const char *user; |
2208 | | struct cmdq_list *queue; |
2209 | | |
2210 | | struct control_state *control_state; |
2211 | | u_int pause_age; |
2212 | | |
2213 | | pid_t pid; |
2214 | | int fd; |
2215 | | int out_fd; |
2216 | | struct event event; |
2217 | | int retval; |
2218 | | |
2219 | | struct timeval creation_time; |
2220 | | struct timeval activity_time; |
2221 | | struct timeval last_activity_time; |
2222 | | |
2223 | | struct environ *environ; |
2224 | | struct format_job_tree *jobs; |
2225 | | |
2226 | | char *title; |
2227 | | char *path; |
2228 | | const char *cwd; |
2229 | | struct progress_bar progress_bar; |
2230 | | |
2231 | | char *term_name; |
2232 | | int term_features; |
2233 | | int term_nofeatures; |
2234 | | char *term_type; |
2235 | | char **term_caps; |
2236 | | u_int term_ncaps; |
2237 | | |
2238 | | char *ttyname; |
2239 | | struct tty tty; |
2240 | | |
2241 | | size_t written; |
2242 | | size_t discarded; |
2243 | | size_t redraw; |
2244 | | |
2245 | | struct redraw_scene *redraw_scene; |
2246 | | |
2247 | | struct event repeat_timer; |
2248 | | |
2249 | | struct event click_timer; |
2250 | | int click_loc; |
2251 | | int click_wp; |
2252 | | |
2253 | | struct event exit_timer; |
2254 | | u_int click_button; |
2255 | | struct mouse_event click_event; |
2256 | | |
2257 | | struct status_line status; |
2258 | | struct event cycle_timer; |
2259 | | enum client_theme theme; |
2260 | | |
2261 | | struct input_requests input_requests; |
2262 | | |
2263 | 0 | #define CLIENT_TERMINAL 0x1 |
2264 | 0 | #define CLIENT_LOGIN 0x2 |
2265 | 0 | #define CLIENT_EXIT 0x4 |
2266 | 0 | #define CLIENT_REDRAWWINDOW 0x8 |
2267 | 0 | #define CLIENT_REDRAWSTATUS 0x10 |
2268 | 0 | #define CLIENT_REPEAT 0x20 |
2269 | 0 | #define CLIENT_SUSPENDED 0x40 |
2270 | 0 | #define CLIENT_ATTACHED 0x80 |
2271 | 0 | #define CLIENT_EXITED 0x100 |
2272 | 0 | #define CLIENT_DEAD 0x200 |
2273 | 0 | #define CLIENT_REDRAWBORDERS 0x400 |
2274 | 0 | #define CLIENT_READONLY 0x800 |
2275 | 0 | #define CLIENT_NOSTARTSERVER 0x1000 |
2276 | 0 | #define CLIENT_CONTROL 0x2000 |
2277 | 0 | #define CLIENT_CONTROLCONTROL 0x4000 |
2278 | 0 | #define CLIENT_FOCUSED 0x8000 |
2279 | 0 | #define CLIENT_UTF8 0x10000 |
2280 | 0 | #define CLIENT_IGNORESIZE 0x20000 |
2281 | 0 | #define CLIENT_IDENTIFIED 0x40000 |
2282 | 0 | #define CLIENT_STATUSFORCE 0x80000 |
2283 | 0 | #define CLIENT_DOUBLECLICK 0x100000 |
2284 | 0 | #define CLIENT_TRIPLECLICK 0x200000 |
2285 | 0 | #define CLIENT_SIZECHANGED 0x400000 |
2286 | 0 | #define CLIENT_STATUSOFF 0x800000 |
2287 | 0 | #define CLIENT_REDRAWSTATUSALWAYS 0x1000000 |
2288 | 0 | #define CLIENT_REDRAWOVERLAY 0x2000000 |
2289 | 0 | #define CLIENT_CONTROL_NOOUTPUT 0x4000000 |
2290 | 0 | #define CLIENT_DEFAULTSOCKET 0x8000000 |
2291 | 0 | #define CLIENT_STARTSERVER 0x10000000 |
2292 | 0 | #define CLIENT_REDRAWMENU 0x20000000 |
2293 | 0 | #define CLIENT_NOFORK 0x40000000 |
2294 | 0 | #define CLIENT_REDRAWSCROLLBARS 0x80000000ULL |
2295 | 0 | #define CLIENT_CONTROL_PAUSEAFTER 0x100000000ULL |
2296 | 0 | #define CLIENT_CONTROL_WAITEXIT 0x200000000ULL |
2297 | 0 | #define CLIENT_WINDOWSIZECHANGED 0x400000000ULL |
2298 | | /* 0x800000000ULL unused */ |
2299 | 0 | #define CLIENT_BRACKETPASTING 0x1000000000ULL |
2300 | 0 | #define CLIENT_ASSUMEPASTING 0x2000000000ULL |
2301 | 0 | #define CLIENT_WRITE_ACK 0x4000000000ULL |
2302 | 0 | #define CLIENT_NO_DETACH_ON_DESTROY 0x8000000000ULL |
2303 | | #define CLIENT_ALLREDRAWFLAGS \ |
2304 | 0 | (CLIENT_REDRAWWINDOW| \ |
2305 | 0 | CLIENT_REDRAWSTATUS| \ |
2306 | 0 | CLIENT_REDRAWSTATUSALWAYS| \ |
2307 | 0 | CLIENT_REDRAWBORDERS| \ |
2308 | 0 | CLIENT_REDRAWOVERLAY| \ |
2309 | 0 | CLIENT_REDRAWMENU) |
2310 | | #define CLIENT_UNATTACHEDFLAGS \ |
2311 | 0 | (CLIENT_DEAD| \ |
2312 | 0 | CLIENT_SUSPENDED| \ |
2313 | 0 | CLIENT_EXIT) |
2314 | | #define CLIENT_NODETACHFLAGS \ |
2315 | 0 | (CLIENT_DEAD| \ |
2316 | 0 | CLIENT_EXIT) |
2317 | | #define CLIENT_NOSIZEFLAGS \ |
2318 | 0 | (CLIENT_DEAD| \ |
2319 | 0 | CLIENT_SUSPENDED| \ |
2320 | 0 | CLIENT_EXIT) |
2321 | | uint64_t flags; |
2322 | | |
2323 | | enum { |
2324 | | CLIENT_EXIT_RETURN, |
2325 | | CLIENT_EXIT_SHUTDOWN, |
2326 | | CLIENT_EXIT_DETACH |
2327 | | } exit_type; |
2328 | | enum msgtype exit_msgtype; |
2329 | | char *exit_session; |
2330 | | char *exit_message; |
2331 | | |
2332 | | struct key_table *keytable; |
2333 | | key_code last_key; |
2334 | | time_t paste_time; |
2335 | | |
2336 | | int message_ignore_keys; |
2337 | | int message_ignore_styles; |
2338 | | char *message_string; |
2339 | | struct event message_timer; |
2340 | | |
2341 | | struct prompt *prompt; |
2342 | | |
2343 | | struct session *session; |
2344 | | struct session *last_session; |
2345 | | |
2346 | | int references; |
2347 | | |
2348 | | int theme_colours[COLOUR_THEME_COUNT]; |
2349 | | |
2350 | | void *pan_window; |
2351 | | u_int pan_ox; |
2352 | | u_int pan_oy; |
2353 | | |
2354 | | overlay_check_cb overlay_check; |
2355 | | overlay_mode_cb overlay_mode; |
2356 | | overlay_draw_cb overlay_draw; |
2357 | | overlay_key_cb overlay_key; |
2358 | | overlay_free_cb overlay_free; |
2359 | | overlay_resize_cb overlay_resize; |
2360 | | void *overlay_data; |
2361 | | struct event overlay_timer; |
2362 | | |
2363 | | struct client_files files; |
2364 | | u_int source_file_depth; |
2365 | | |
2366 | | u_int *clipboard_panes; |
2367 | | u_int clipboard_npanes; |
2368 | | |
2369 | | TAILQ_ENTRY(client) entry; |
2370 | | }; |
2371 | | TAILQ_HEAD(clients, client); |
2372 | | |
2373 | | /* Monitor. */ |
2374 | | enum monitor_type { |
2375 | | MONITOR_SESSION, |
2376 | | MONITOR_PANE, |
2377 | | MONITOR_ALL_PANES, |
2378 | | MONITOR_WINDOW, |
2379 | | MONITOR_ALL_WINDOWS |
2380 | | }; |
2381 | 0 | #define MONITOR_NOTIFY_INITIAL 0x1 |
2382 | 0 | #define MONITOR_NOTIFY_TRUE 0x2 |
2383 | | struct monitor_change { |
2384 | | const char *name; |
2385 | | const char *value; |
2386 | | const char *last; |
2387 | | |
2388 | | struct client *c; |
2389 | | struct session *s; |
2390 | | struct winlink *wl; |
2391 | | struct window_pane *wp; |
2392 | | }; |
2393 | | typedef void (*monitor_cb)(struct monitor_change *, void *); |
2394 | | |
2395 | | /* Event payload type. */ |
2396 | | enum event_payload_type { |
2397 | | EVENT_PAYLOAD_STRING, |
2398 | | EVENT_PAYLOAD_TIME, |
2399 | | EVENT_PAYLOAD_INT, |
2400 | | EVENT_PAYLOAD_UINT, |
2401 | | EVENT_PAYLOAD_CLIENT, |
2402 | | EVENT_PAYLOAD_SESSION, |
2403 | | EVENT_PAYLOAD_WINDOW, |
2404 | | EVENT_PAYLOAD_PANE, |
2405 | | EVENT_PAYLOAD_POINTER |
2406 | | }; |
2407 | | |
2408 | | /* Event payload callbacks. */ |
2409 | | typedef void (*event_payload_free_cb)(void *); |
2410 | | typedef void (*event_payload_print_cb)(void *, struct evbuffer *); |
2411 | | |
2412 | | /* Key binding and key table. */ |
2413 | | struct key_binding { |
2414 | | key_code key; |
2415 | | struct cmd_list *cmdlist; |
2416 | | const char *note; |
2417 | | const char *tablename; |
2418 | | |
2419 | | int flags; |
2420 | 0 | #define KEY_BINDING_REPEAT 0x1 |
2421 | | |
2422 | | RB_ENTRY(key_binding) entry; |
2423 | | }; |
2424 | | RB_HEAD(key_bindings, key_binding); |
2425 | | |
2426 | | struct key_table { |
2427 | | const char *name; |
2428 | | struct timeval activity_time; |
2429 | | struct key_bindings key_bindings; |
2430 | | struct key_bindings default_key_bindings; |
2431 | | |
2432 | | u_int references; |
2433 | | |
2434 | | RB_ENTRY(key_table) entry; |
2435 | | }; |
2436 | | RB_HEAD(key_tables, key_table); |
2437 | | |
2438 | | /* Option data. */ |
2439 | | RB_HEAD(options_array, options_array_item); |
2440 | | union options_value { |
2441 | | char *string; |
2442 | | long long number; |
2443 | | struct style style; |
2444 | | struct options_array array; |
2445 | | struct cmd_list *cmdlist; |
2446 | | }; |
2447 | | |
2448 | | /* Option table entries. */ |
2449 | | enum options_table_type { |
2450 | | OPTIONS_TABLE_STRING, |
2451 | | OPTIONS_TABLE_NUMBER, |
2452 | | OPTIONS_TABLE_KEY, |
2453 | | OPTIONS_TABLE_COLOUR, |
2454 | | OPTIONS_TABLE_FLAG, |
2455 | | OPTIONS_TABLE_CHOICE, |
2456 | | OPTIONS_TABLE_COMMAND |
2457 | | }; |
2458 | | |
2459 | 0 | #define OPTIONS_TABLE_NONE 0 |
2460 | 544 | #define OPTIONS_TABLE_SERVER 0x1 |
2461 | 544 | #define OPTIONS_TABLE_SESSION 0x2 |
2462 | 544 | #define OPTIONS_TABLE_WINDOW 0x4 |
2463 | 0 | #define OPTIONS_TABLE_PANE 0x8 |
2464 | | |
2465 | 114k | #define OPTIONS_TABLE_IS_ARRAY 0x1 |
2466 | 23.0k | #define OPTIONS_TABLE_IS_HOOK 0x2 |
2467 | 0 | #define OPTIONS_TABLE_IS_STYLE 0x4 |
2468 | 0 | #define OPTIONS_TABLE_IS_COLOUR 0x8 |
2469 | | |
2470 | | struct options_table_entry { |
2471 | | const char *name; |
2472 | | const char *alternative_name; |
2473 | | enum options_table_type type; |
2474 | | int scope; |
2475 | | int flags; |
2476 | | |
2477 | | u_int minimum; |
2478 | | u_int maximum; |
2479 | | const char **choices; |
2480 | | |
2481 | | const char *default_str; |
2482 | | long long default_num; |
2483 | | const char **default_arr; |
2484 | | |
2485 | | const char *separator; |
2486 | | const char *pattern; |
2487 | | |
2488 | | const char *text; |
2489 | | const char *unit; |
2490 | | }; |
2491 | | |
2492 | | struct options_name_map { |
2493 | | const char *from; |
2494 | | const char *to; |
2495 | | }; |
2496 | | |
2497 | | /* Common command usages. */ |
2498 | | #define CMD_TARGET_PANE_USAGE "[-t target-pane]" |
2499 | | #define CMD_TARGET_WINDOW_USAGE "[-t target-window]" |
2500 | | #define CMD_TARGET_SESSION_USAGE "[-t target-session]" |
2501 | | #define CMD_TARGET_CLIENT_USAGE "[-t target-client]" |
2502 | | #define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]" |
2503 | | #define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]" |
2504 | | #define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]" |
2505 | | #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]" |
2506 | | #define CMD_BUFFER_USAGE "[-b buffer-name]" |
2507 | | |
2508 | | /* Spawn common context. */ |
2509 | | struct spawn_context { |
2510 | | struct cmdq_item *item; |
2511 | | |
2512 | | struct session *s; |
2513 | | struct winlink *wl; |
2514 | | struct client *tc; |
2515 | | |
2516 | | struct window_pane *wp0; |
2517 | | struct layout_cell *lc; |
2518 | | |
2519 | | const char *name; |
2520 | | char **argv; |
2521 | | int argc; |
2522 | | struct environ *environ; |
2523 | | |
2524 | | int idx; |
2525 | | const char *cwd; |
2526 | | |
2527 | | int flags; |
2528 | 0 | #define SPAWN_KILL 0x1 |
2529 | 0 | #define SPAWN_DETACHED 0x2 |
2530 | 0 | #define SPAWN_RESPAWN 0x4 |
2531 | 0 | #define SPAWN_BEFORE 0x8 |
2532 | 0 | #define SPAWN_NONOTIFY 0x10 |
2533 | 0 | #define SPAWN_FULLSIZE 0x20 |
2534 | 0 | #define SPAWN_EMPTY 0x40 |
2535 | 0 | #define SPAWN_ZOOM 0x80 |
2536 | 0 | #define SPAWN_FLOATING 0x100 |
2537 | 0 | #define SPAWN_HORIZONTAL 0x200 |
2538 | 0 | #define SPAWN_SPLIT 0x400 |
2539 | 0 | #define SPAWN_MODAL 0x800 |
2540 | 0 | #define SPAWN_FLOATOVERZOOM 0x1000 |
2541 | | }; |
2542 | | |
2543 | | /* Paste buffer. */ |
2544 | | struct paste_buffer { |
2545 | | char *data; |
2546 | | size_t size; |
2547 | | |
2548 | | char *name; |
2549 | | time_t created; |
2550 | | int automatic; |
2551 | | u_int order; |
2552 | | |
2553 | | RB_ENTRY(paste_buffer) name_entry; |
2554 | | RB_ENTRY(paste_buffer) time_entry; |
2555 | | }; |
2556 | | |
2557 | | /* Sort orders. */ |
2558 | | enum sort_order { |
2559 | | SORT_ACTIVITY, |
2560 | | SORT_CREATION, |
2561 | | SORT_INDEX, |
2562 | | SORT_MODIFIER, |
2563 | | SORT_NAME, |
2564 | | SORT_ORDER, |
2565 | | SORT_SIZE, |
2566 | | SORT_Z, |
2567 | | SORT_END, |
2568 | | }; |
2569 | | |
2570 | | /* Sort criteria. */ |
2571 | | struct sort_criteria { |
2572 | | enum sort_order order; |
2573 | | int reversed; |
2574 | | enum sort_order *order_seq; /* available sort orders */ |
2575 | | }; |
2576 | | |
2577 | | /* tmux.c */ |
2578 | | extern struct options *global_options; |
2579 | | extern struct options *global_s_options; |
2580 | | extern struct options *global_w_options; |
2581 | | extern struct environ *global_environ; |
2582 | | extern struct timeval start_time; |
2583 | | extern const char *socket_path; |
2584 | | extern const char *shell_command; |
2585 | | extern int ptm_fd; |
2586 | | extern const char *shell_command; |
2587 | | int checkshell(const char *); |
2588 | | void setblocking(int, int); |
2589 | | char *shell_argv0(const char *, int); |
2590 | | uint64_t get_timer(void); |
2591 | | char *clean_name(const char *, int); |
2592 | | int check_name(const char *); |
2593 | | const char *sig2name(int); |
2594 | | const char *find_cwd(void); |
2595 | | const char *find_home(void); |
2596 | | const char *getversion(void); |
2597 | | |
2598 | | /* proc.c */ |
2599 | | struct imsg; |
2600 | | int proc_send(struct tmuxpeer *, enum msgtype, int, const void *, size_t); |
2601 | | struct tmuxproc *proc_start(const char *); |
2602 | | void proc_loop(struct tmuxproc *, int (*)(void)); |
2603 | | void proc_exit(struct tmuxproc *); |
2604 | | void proc_set_signals(struct tmuxproc *, void(*)(int)); |
2605 | | void proc_clear_signals(struct tmuxproc *, int); |
2606 | | struct tmuxpeer *proc_add_peer(struct tmuxproc *, int, |
2607 | | void (*)(struct imsg *, void *), void *); |
2608 | | void proc_remove_peer(struct tmuxpeer *); |
2609 | | void proc_kill_peer(struct tmuxpeer *); |
2610 | | void proc_flush_peer(struct tmuxpeer *); |
2611 | | void proc_toggle_log(struct tmuxproc *); |
2612 | | pid_t proc_fork_and_daemon(int *); |
2613 | | uid_t proc_get_peer_uid(struct tmuxpeer *); |
2614 | | gid_t proc_get_peer_gid(struct tmuxpeer *); |
2615 | | |
2616 | | /* cfg.c */ |
2617 | | extern int cfg_finished; |
2618 | | extern struct client *cfg_client; |
2619 | | extern char **cfg_files; |
2620 | | extern u_int cfg_nfiles; |
2621 | | extern int cfg_quiet; |
2622 | | void start_cfg(void); |
2623 | | int load_cfg(const char *, struct client *, struct cmdq_item *, |
2624 | | struct cmd_find_state *, int, struct cmdq_item **); |
2625 | | int load_cfg_from_buffer(const void *, size_t, const char *, |
2626 | | struct client *, struct cmdq_item *, struct cmd_find_state *, |
2627 | | int, struct cmdq_item **); |
2628 | | void printflike(1, 2) cfg_add_cause(const char *, ...); |
2629 | | void cfg_print_causes(struct cmdq_item *); |
2630 | | void cfg_show_causes(struct session *); |
2631 | | |
2632 | | /* paste.c */ |
2633 | | const char *paste_buffer_name(struct paste_buffer *); |
2634 | | u_int paste_buffer_order(struct paste_buffer *); |
2635 | | time_t paste_buffer_created(struct paste_buffer *); |
2636 | | const char *paste_buffer_data(struct paste_buffer *, size_t *); |
2637 | | struct paste_buffer *paste_walk(struct paste_buffer *); |
2638 | | int paste_is_empty(void); |
2639 | | struct paste_buffer *paste_get_top(char **); |
2640 | | struct paste_buffer *paste_get_name(const char *); |
2641 | | void paste_free(struct paste_buffer *); |
2642 | | void paste_add(const char *, char *, size_t); |
2643 | | int paste_rename(const char *, const char *, char **); |
2644 | | int paste_set(char *, size_t, const char *, char **); |
2645 | | void paste_replace(struct paste_buffer *, char *, size_t); |
2646 | | char *paste_make_sample(struct paste_buffer *); |
2647 | | |
2648 | | /* sort.c */ |
2649 | | void sort_next_order(struct sort_criteria *); |
2650 | | enum sort_order sort_order_from_string(const char *); |
2651 | | const char *sort_order_to_string(enum sort_order); |
2652 | | int sort_would_window_tree_swap(struct sort_criteria *, |
2653 | | struct winlink *, struct winlink *); |
2654 | | struct paste_buffer **sort_get_buffers(u_int *, struct sort_criteria *); |
2655 | | struct client **sort_get_clients(u_int *, struct sort_criteria *); |
2656 | | struct session **sort_get_sessions(u_int *, struct sort_criteria *); |
2657 | | struct window_pane **sort_get_panes(u_int *, struct sort_criteria *); |
2658 | | struct window_pane **sort_get_panes_session(struct session *, u_int *, |
2659 | | struct sort_criteria *); |
2660 | | struct window_pane **sort_get_panes_window(struct window *, u_int *, |
2661 | | struct sort_criteria *); |
2662 | | struct winlink **sort_get_winlinks(u_int *, struct sort_criteria *); |
2663 | | struct winlink **sort_get_winlinks_session(struct session *, u_int *, |
2664 | | struct sort_criteria *); |
2665 | | struct key_binding **sort_get_key_bindings(u_int *, |
2666 | | struct sort_criteria *); |
2667 | | struct key_binding **sort_get_key_bindings_table(struct key_table *, |
2668 | | u_int *, struct sort_criteria *); |
2669 | | |
2670 | | /* format.c */ |
2671 | 1.44k | #define FORMAT_STATUS 0x1 |
2672 | 0 | #define FORMAT_FORCE 0x2 |
2673 | 4.96k | #define FORMAT_NOJOBS 0x4 |
2674 | 6.58M | #define FORMAT_VERBOSE 0x8 |
2675 | | #define FORMAT_LAST 0x10 |
2676 | 23.0k | #define FORMAT_NONE 0 |
2677 | 0 | #define FORMAT_PANE 0x80000000U |
2678 | 0 | #define FORMAT_WINDOW 0x40000000U |
2679 | | struct format_tree; |
2680 | | struct format_modifier; |
2681 | | typedef void *(*format_cb)(struct format_tree *); |
2682 | | void format_tidy_jobs(void); |
2683 | | const char *format_skip(const char *, const char *); |
2684 | | int format_true(const char *); |
2685 | | struct format_tree *format_create(struct client *, struct cmdq_item *, int, |
2686 | | int); |
2687 | | void format_free(struct format_tree *); |
2688 | | void format_merge(struct format_tree *, struct format_tree *); |
2689 | | struct window_pane *format_get_pane(struct format_tree *); |
2690 | | void printflike(3, 4) format_add(struct format_tree *, const char *, |
2691 | | const char *, ...); |
2692 | | void format_add_tv(struct format_tree *, const char *, |
2693 | | struct timeval *); |
2694 | | void format_add_cb(struct format_tree *, const char *, format_cb); |
2695 | | void format_log_debug(struct format_tree *, const char *); |
2696 | | void format_each(struct format_tree *, void (*)(const char *, |
2697 | | const char *, void *), void *); |
2698 | | char *format_pretty_time(time_t, int); |
2699 | | char *format_expand_time(struct format_tree *, const char *); |
2700 | | char *format_expand(struct format_tree *, const char *); |
2701 | | char *format_single(struct cmdq_item *, const char *, |
2702 | | struct client *, struct session *, struct winlink *, |
2703 | | struct window_pane *); |
2704 | | char *format_single_from_state(struct cmdq_item *, const char *, |
2705 | | struct client *, struct cmd_find_state *); |
2706 | | char *format_single_from_target(struct cmdq_item *, const char *); |
2707 | | struct format_tree *format_create_defaults(struct cmdq_item *, struct client *, |
2708 | | struct session *, struct winlink *, struct window_pane *); |
2709 | | struct format_tree *format_create_from_state(struct cmdq_item *, |
2710 | | struct client *, struct cmd_find_state *); |
2711 | | struct format_tree *format_create_from_target(struct cmdq_item *); |
2712 | | void format_defaults(struct format_tree *, struct client *, |
2713 | | struct session *, struct winlink *, struct window_pane *); |
2714 | | void format_defaults_window(struct format_tree *, struct window *); |
2715 | | void format_defaults_pane(struct format_tree *, |
2716 | | struct window_pane *); |
2717 | | void format_defaults_paste_buffer(struct format_tree *, |
2718 | | struct paste_buffer *); |
2719 | | void format_lost_client(struct client *); |
2720 | | char *format_grid_word(struct grid *, u_int, u_int); |
2721 | | char *format_grid_hyperlink(struct grid *, u_int, u_int, |
2722 | | struct screen *); |
2723 | | char *format_grid_line(struct grid *, u_int); |
2724 | | |
2725 | | /* events-payload.c */ |
2726 | | struct event_payload *event_payload_create(void); |
2727 | | void event_payload_free(struct event_payload *); |
2728 | | void printflike(2, 3) event_payload_log(struct event_payload *, const char *, |
2729 | | ...); |
2730 | | char *event_payload_item_print(struct event_payload_item *); |
2731 | | void event_payload_set_target(struct event_payload *, |
2732 | | struct cmd_find_state *); |
2733 | | int event_payload_get_target(struct event_payload *, |
2734 | | struct cmd_find_state *); |
2735 | | void printflike(3, 4) event_payload_set_string(struct event_payload *, |
2736 | | const char *, const char *, ...); |
2737 | | void event_payload_set_time(struct event_payload *, const char *, time_t); |
2738 | | void event_payload_set_int(struct event_payload *, const char *, int); |
2739 | | void event_payload_set_uint(struct event_payload *, const char *, u_int); |
2740 | | void event_payload_set_client(struct event_payload *, const char *, |
2741 | | struct client *); |
2742 | | void event_payload_set_session(struct event_payload *, const char *, |
2743 | | struct session *); |
2744 | | void event_payload_set_window(struct event_payload *, const char *, |
2745 | | struct window *); |
2746 | | void event_payload_set_pane(struct event_payload *, const char *, |
2747 | | struct window_pane *); |
2748 | | void event_payload_set_pointer(struct event_payload *, const char *, void *, |
2749 | | event_payload_free_cb, event_payload_print_cb); |
2750 | | const char *event_payload_get_string(struct event_payload *, const char *); |
2751 | | char *event_payload_print(struct event_payload *, const char *); |
2752 | | void event_payload_add_formats(struct event_payload *, |
2753 | | struct format_tree *, const char *); |
2754 | | struct event_payload_item *event_payload_first(struct event_payload *); |
2755 | | struct event_payload_item *event_payload_next(struct event_payload_item *); |
2756 | | const char *event_payload_item_name(struct event_payload_item *); |
2757 | | enum event_payload_type event_payload_item_type(struct event_payload_item *); |
2758 | | time_t event_payload_get_time(struct event_payload *, const char *); |
2759 | | int event_payload_get_int(struct event_payload *, const char *, int *); |
2760 | | int event_payload_get_uint(struct event_payload *, const char *, u_int *); |
2761 | | struct client *event_payload_get_client(struct event_payload *, const char *); |
2762 | | struct session *event_payload_get_session(struct event_payload *, const char *); |
2763 | | struct window *event_payload_get_window(struct event_payload *, const char *); |
2764 | | struct window_pane *event_payload_get_pane(struct event_payload *, |
2765 | | const char *); |
2766 | | void *event_payload_get_pointer(struct event_payload *, const char *); |
2767 | | |
2768 | | /* events.c */ |
2769 | | typedef void (*events_cb)(const char *, struct event_payload *, void *); |
2770 | | struct events_sink *events_add_sink(const char *, events_cb, void *); |
2771 | | void events_remove_sink(struct events_sink *); |
2772 | | void events_fire(const char *, struct event_payload *); |
2773 | | void events_fire_client(const char *, struct client *); |
2774 | | void events_fire_session(const char *, struct session *); |
2775 | | void events_fire_window(const char *, struct window *); |
2776 | | void events_fire_pane(const char *, struct window_pane *); |
2777 | | void events_fire_winlink(const char *, struct winlink *); |
2778 | | |
2779 | | /* format-draw.c */ |
2780 | | void format_draw(struct screen_write_ctx *, const struct grid_cell *, |
2781 | | u_int, const char *, struct style_ranges *, int); |
2782 | | u_int format_width(const char *); |
2783 | | char *format_trim_left(const char *, u_int); |
2784 | | char *format_trim_right(const char *, u_int); |
2785 | | |
2786 | | /* hooks.c */ |
2787 | | void hooks_add_event(const char *); |
2788 | | int hooks_is_event(const char *); |
2789 | | int hooks_valid_event_name(const char *); |
2790 | | void hooks_build_events(void); |
2791 | | void hooks_run(struct cmdq_item *, const char *); |
2792 | | void hooks_monitor_add(struct cmdq_item *, struct options *, |
2793 | | const char *, enum monitor_type, int, const char *, |
2794 | | int, struct cmd_find_state *, struct session *); |
2795 | | void hooks_monitor_remove(struct options *, const char *); |
2796 | | void hooks_monitor_free(void *); |
2797 | | char *hooks_monitor_to_string(struct options_entry *); |
2798 | | int hooks_monitor_get(struct options_entry *, enum monitor_type *, int *, |
2799 | | const char **); |
2800 | | u_int hooks_monitor_get_fire_count(struct options_entry *); |
2801 | | time_t hooks_monitor_get_fire_time(struct options_entry *); |
2802 | | |
2803 | | /* options.c */ |
2804 | | struct options *options_create(struct options *); |
2805 | | void options_free(struct options *); |
2806 | | struct options *options_get_parent(struct options *); |
2807 | | void options_set_parent(struct options *, struct options *); |
2808 | | struct options_entry *options_first(struct options *); |
2809 | | struct options_entry *options_next(struct options_entry *); |
2810 | | struct options_entry *options_empty(struct options *, |
2811 | | const struct options_table_entry *); |
2812 | | struct options_entry *options_default(struct options *, |
2813 | | const struct options_table_entry *); |
2814 | | char *options_default_to_string(const struct options_table_entry *); |
2815 | | const char *options_name(struct options_entry *); |
2816 | | struct options *options_owner(struct options_entry *); |
2817 | | void *options_get_monitor_data(struct options_entry *); |
2818 | | void options_set_monitor_data(struct options_entry *, void *); |
2819 | | void options_hook_fired(struct options_entry *); |
2820 | | u_int options_get_fire_count(struct options_entry *); |
2821 | | time_t options_get_fire_time(struct options_entry *); |
2822 | | const struct options_table_entry *options_table_entry(struct options_entry *); |
2823 | | struct options_entry *options_get_only(struct options *, const char *); |
2824 | | struct options_entry *options_get(struct options *, const char *); |
2825 | | void options_array_clear(struct options_entry *); |
2826 | | union options_value *options_array_get(struct options_entry *, const char *); |
2827 | | union options_value * printflike(2, 3) options_array_getv( |
2828 | | struct options_entry *, const char *, ...); |
2829 | | int options_array_set(struct options_entry *, const char *, |
2830 | | const char *, int, char **); |
2831 | | int options_array_assign(struct options_entry *, const char *, |
2832 | | char **); |
2833 | | struct options_array_item *options_array_first(struct options_entry *); |
2834 | | struct options_array_item *options_array_next(struct options_array_item *); |
2835 | | const char *options_array_item_key(struct options_array_item *); |
2836 | | union options_value *options_array_item_value(struct options_array_item *); |
2837 | | int options_is_array(struct options_entry *); |
2838 | | int options_is_string(struct options_entry *); |
2839 | | char *options_to_string(struct options_entry *, const char *, int); |
2840 | | char *options_parse(const char *, char **); |
2841 | | struct options_entry *options_parse_get(struct options *, const char *, |
2842 | | char **, int); |
2843 | | const struct options_table_entry *options_search(const char *); |
2844 | | char *options_match(const char *, char **, int *); |
2845 | | struct options_entry *options_match_get(struct options *, const char *, |
2846 | | char **, int, int *); |
2847 | | const char *options_get_string(struct options *, const char *); |
2848 | | long long options_get_number(struct options *, const char *); |
2849 | | struct cmd_list *options_get_command(struct options *, const char *); |
2850 | | struct options_entry * printflike(4, 5) options_set_string(struct options *, |
2851 | | const char *, int, const char *, ...); |
2852 | | struct options_entry *options_set_number(struct options *, const char *, |
2853 | | long long); |
2854 | | struct options_entry *options_set_command(struct options *, const char *, |
2855 | | struct cmd_list *); |
2856 | | int options_scope_from_name(struct args *, int, |
2857 | | const char *, struct cmd_find_state *, struct options **, |
2858 | | char **); |
2859 | | int options_scope_from_flags(struct args *, int, |
2860 | | struct cmd_find_state *, struct options **, char **); |
2861 | | struct style *options_string_to_style(struct options *, const char *, |
2862 | | struct format_tree *); |
2863 | | int options_from_string(struct options *, |
2864 | | const struct options_table_entry *, const char *, |
2865 | | const char *, int, char **); |
2866 | | int options_find_choice(const struct options_table_entry *, |
2867 | | const char *, char **); |
2868 | | void options_push_changes(const char *); |
2869 | | int options_remove_or_default(struct options_entry *, const char *, |
2870 | | char **); |
2871 | | |
2872 | | /* options-table.c */ |
2873 | | extern const struct options_table_entry options_table[]; |
2874 | | extern const struct options_name_map options_other_names[]; |
2875 | | |
2876 | | /* job.c */ |
2877 | | typedef void (*job_update_cb) (struct job *); |
2878 | | typedef void (*job_complete_cb) (struct job *); |
2879 | | typedef void (*job_free_cb) (void *); |
2880 | 0 | #define JOB_NOWAIT 0x1 |
2881 | 0 | #define JOB_KEEPWRITE 0x2 |
2882 | 0 | #define JOB_PTY 0x4 |
2883 | 0 | #define JOB_DEFAULTSHELL 0x8 |
2884 | 0 | #define JOB_SHOWSTDERR 0x10 |
2885 | | struct job *job_run(const char *, int, char **, struct environ *, |
2886 | | struct session *, const char *, job_update_cb, |
2887 | | job_complete_cb, job_free_cb, void *, int, int, int); |
2888 | | void job_free(struct job *); |
2889 | | int job_transfer(struct job *, pid_t *, char *, size_t); |
2890 | | void job_resize(struct job *, u_int, u_int); |
2891 | | void job_check_died(pid_t, int); |
2892 | | int job_get_status(struct job *); |
2893 | | void *job_get_data(struct job *); |
2894 | | struct bufferevent *job_get_event(struct job *); |
2895 | | void job_kill_all(void); |
2896 | | int job_still_running(void); |
2897 | | void job_print_summary(struct cmdq_item *, int); |
2898 | | |
2899 | | /* environ.c */ |
2900 | | struct environ *environ_create(void); |
2901 | | void environ_free(struct environ *); |
2902 | | struct environ_entry *environ_first(struct environ *); |
2903 | | struct environ_entry *environ_next(struct environ_entry *); |
2904 | | void environ_copy(struct environ *, struct environ *); |
2905 | | struct environ_entry *environ_find(struct environ *, const char *); |
2906 | | void printflike(4, 5) environ_set(struct environ *, const char *, int, |
2907 | | const char *, ...); |
2908 | | void environ_clear(struct environ *, const char *); |
2909 | | void environ_put(struct environ *, const char *, int); |
2910 | | void environ_unset(struct environ *, const char *); |
2911 | | void environ_update(struct options *, struct environ *, struct environ *); |
2912 | | void environ_push(struct environ *); |
2913 | | void printflike(2, 3) environ_log(struct environ *, const char *, ...); |
2914 | | struct environ *environ_for_session(struct session *, int); |
2915 | | |
2916 | | /* tty-draw.c */ |
2917 | | void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int, |
2918 | | u_int, u_int, const struct tty_style_ctx *); |
2919 | | |
2920 | | /* tty.c */ |
2921 | | void tty_create_log(void); |
2922 | | int tty_window_bigger(struct tty *); |
2923 | | int tty_window_offset(struct tty *, u_int *, u_int *, u_int *, u_int *); |
2924 | | void tty_update_window_offset(struct window *); |
2925 | | void tty_update_client_offset(struct client *); |
2926 | | void tty_raw(struct tty *, const char *); |
2927 | | void tty_attributes(struct tty *, const struct grid_cell *, |
2928 | | const struct tty_style_ctx *); |
2929 | | void tty_reset(struct tty *); |
2930 | | void tty_region_off(struct tty *); |
2931 | | void tty_margin_off(struct tty *); |
2932 | | void tty_cursor(struct tty *, u_int, u_int); |
2933 | | int tty_fake_bce(const struct tty *, const struct grid_cell *, u_int); |
2934 | | void tty_repeat_space(struct tty *, u_int); |
2935 | | void tty_clipboard_query(struct tty *); |
2936 | | void tty_putcode(struct tty *, enum tty_code_code); |
2937 | | void tty_putcode_i(struct tty *, enum tty_code_code, int); |
2938 | | void tty_putcode_ii(struct tty *, enum tty_code_code, int, int); |
2939 | | void tty_putcode_iii(struct tty *, enum tty_code_code, int, int, int); |
2940 | | void tty_putcode_s(struct tty *, enum tty_code_code, const char *); |
2941 | | void tty_putcode_ss(struct tty *, enum tty_code_code, const char *, |
2942 | | const char *); |
2943 | | void tty_puts(struct tty *, const char *); |
2944 | | void tty_putc(struct tty *, u_char); |
2945 | | void tty_putn(struct tty *, const void *, size_t, u_int); |
2946 | | void tty_cell(struct tty *, const struct grid_cell *, |
2947 | | const struct tty_style_ctx *); |
2948 | | int tty_init(struct tty *, struct client *); |
2949 | | void tty_resize(struct tty *); |
2950 | | void tty_set_size(struct tty *, u_int, u_int, u_int, u_int); |
2951 | | void tty_invalidate(struct tty *); |
2952 | | void tty_start_tty(struct tty *); |
2953 | | void tty_send_requests(struct tty *); |
2954 | | void tty_repeat_requests(struct tty *, int); |
2955 | | void tty_stop_tty(struct tty *); |
2956 | | void tty_set_title(struct tty *, const char *); |
2957 | | void tty_set_path(struct tty *, const char *); |
2958 | | void tty_set_progress_bar(struct tty *, struct progress_bar *); |
2959 | | void tty_default_attributes(struct tty *, u_int, |
2960 | | const struct tty_style_ctx *); |
2961 | | void tty_update_mode(struct tty *, int, struct screen *); |
2962 | | const struct grid_cell *tty_check_codeset(struct tty *, |
2963 | | const struct grid_cell *); |
2964 | | struct visible_ranges *tty_check_overlay_range(struct tty *, u_int, u_int, |
2965 | | u_int); |
2966 | | void tty_sync_start(struct tty *); |
2967 | | void tty_sync_end(struct tty *); |
2968 | | int tty_open(struct tty *, char **); |
2969 | | void tty_close(struct tty *); |
2970 | | void tty_free(struct tty *); |
2971 | | void tty_update_features(struct tty *); |
2972 | | void tty_set_selection(struct tty *, const char *, const char *, size_t); |
2973 | | void tty_write(void (*)(struct tty *, const struct tty_ctx *), |
2974 | | struct tty_ctx *); |
2975 | | void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *); |
2976 | | void tty_cmd_cell(struct tty *, const struct tty_ctx *); |
2977 | | void tty_cmd_cells(struct tty *, const struct tty_ctx *); |
2978 | | void tty_cmd_redrawline(struct tty *, const struct tty_ctx *); |
2979 | | void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *); |
2980 | | void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *); |
2981 | | void tty_cmd_clearline(struct tty *, const struct tty_ctx *); |
2982 | | void tty_cmd_clearscreen(struct tty *, const struct tty_ctx *); |
2983 | | void tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *); |
2984 | | void tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *); |
2985 | | void tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *); |
2986 | | void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *); |
2987 | | void tty_cmd_deleteline(struct tty *, const struct tty_ctx *); |
2988 | | void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *); |
2989 | | void tty_cmd_insertline(struct tty *, const struct tty_ctx *); |
2990 | | void tty_cmd_linefeed(struct tty *, const struct tty_ctx *); |
2991 | | void tty_cmd_scrollup(struct tty *, const struct tty_ctx *); |
2992 | | void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *); |
2993 | | void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *); |
2994 | | void tty_cmd_setselection(struct tty *, const struct tty_ctx *); |
2995 | | void tty_cmd_rawstring(struct tty *, const struct tty_ctx *); |
2996 | | #ifdef ENABLE_SIXEL |
2997 | | void tty_cmd_sixelimage(struct tty *, const struct tty_ctx *); |
2998 | | void tty_draw_images(struct client *, struct window_pane *); |
2999 | | #endif |
3000 | | void tty_cmd_syncstart(struct tty *, const struct tty_ctx *); |
3001 | | void tty_default_colours(struct grid_cell *, struct window_pane *, u_int *); |
3002 | | |
3003 | | /* tty-term.c */ |
3004 | | extern struct tty_terms tty_terms; |
3005 | | u_int tty_term_ncodes(void); |
3006 | | void tty_term_apply(struct tty_term *, const char *, int); |
3007 | | void tty_term_apply_overrides(struct tty_term *); |
3008 | | struct tty_term *tty_term_create(struct tty *, char *, char **, u_int, char **); |
3009 | | void tty_term_free(struct tty_term *); |
3010 | | int tty_term_read_list(const char *, int, char ***, u_int *, |
3011 | | char **); |
3012 | | void tty_term_free_list(char **, u_int); |
3013 | | int tty_term_has(struct tty_term *, enum tty_code_code); |
3014 | | int tty_term_has_name(struct tty_term *, const char *); |
3015 | | const char *tty_term_string(struct tty_term *, enum tty_code_code); |
3016 | | const char *tty_term_string_i(struct tty_term *, enum tty_code_code, int); |
3017 | | const char *tty_term_string_ii(struct tty_term *, enum tty_code_code, int, |
3018 | | int); |
3019 | | const char *tty_term_string_iii(struct tty_term *, enum tty_code_code, int, |
3020 | | int, int); |
3021 | | const char *tty_term_string_s(struct tty_term *, enum tty_code_code, |
3022 | | const char *); |
3023 | | const char *tty_term_string_ss(struct tty_term *, enum tty_code_code, |
3024 | | const char *, const char *); |
3025 | | int tty_term_number(struct tty_term *, enum tty_code_code); |
3026 | | int tty_term_flag(struct tty_term *, enum tty_code_code); |
3027 | | const char *tty_term_describe(struct tty_term *, enum tty_code_code); |
3028 | | |
3029 | | /* tty-features.c */ |
3030 | | void tty_parse_client_features(struct client *, const char *, |
3031 | | const char *); |
3032 | | void tty_parse_features(const char *, const char *, int *, int *); |
3033 | | const char *tty_get_features(int); |
3034 | | int tty_feature_present(struct tty_term *, const char *); |
3035 | | int tty_apply_features(struct tty_term *); |
3036 | | void tty_default_features(struct client *, const char *, u_int); |
3037 | | |
3038 | | /* tty-acs.c */ |
3039 | | int tty_acs_needed(struct tty *); |
3040 | | const char *tty_acs_get(struct tty *, u_char); |
3041 | | int tty_acs_reverse_get(struct tty *, const char *, size_t); |
3042 | | const struct utf8_data *tty_acs_double_borders(int); |
3043 | | const struct utf8_data *tty_acs_heavy_borders(int); |
3044 | | const struct utf8_data *tty_acs_rounded_borders(int); |
3045 | | |
3046 | | /* tty-keys.c */ |
3047 | | void tty_keys_build(struct tty *); |
3048 | | void tty_keys_free(struct tty *); |
3049 | | int tty_keys_next(struct tty *); |
3050 | | int tty_keys_colours(struct tty *, const char *, size_t, size_t *, |
3051 | | int *, int *); |
3052 | | |
3053 | | /* arguments.c */ |
3054 | | void args_set(struct args *, u_char, struct args_value *, int); |
3055 | | struct args *args_create(void); |
3056 | | struct args *args_parse(const struct args_parse *, struct args_value *, |
3057 | | u_int, char **); |
3058 | | struct args *args_copy(struct args *, int, char **); |
3059 | | void args_to_vector(struct args *, int *, char ***); |
3060 | | struct args_value *args_from_vector(int, char **); |
3061 | | void args_free_value(struct args_value *); |
3062 | | void args_free_values(struct args_value *, u_int); |
3063 | | void args_free(struct args *); |
3064 | | char *args_print(struct args *); |
3065 | | char *args_escape(const char *); |
3066 | | int args_has(struct args *, u_char); |
3067 | | const char *args_get(struct args *, u_char); |
3068 | | u_char args_first(struct args *, struct args_entry **); |
3069 | | u_char args_next(struct args_entry **); |
3070 | | u_int args_count(struct args *); |
3071 | | struct args_value *args_values(struct args *); |
3072 | | struct args_value *args_value(struct args *, u_int); |
3073 | | const char *args_string(struct args *, u_int); |
3074 | | struct cmd_list *args_make_commands_now(struct cmd *, struct cmdq_item *, |
3075 | | u_int, int); |
3076 | | struct args_command_state *args_make_commands_prepare(struct cmd *, |
3077 | | struct cmdq_item *, u_int, const char *, int, int); |
3078 | | struct cmd_list *args_make_commands(struct args_command_state *, int, char **, |
3079 | | char **); |
3080 | | void args_make_commands_free(struct args_command_state *); |
3081 | | char *args_make_commands_get_command(struct args_command_state *); |
3082 | | struct args_value *args_first_value(struct args *, u_char); |
3083 | | struct args_value *args_next_value(struct args_value *); |
3084 | | long long args_strtonum(struct args *, u_char, long long, long long, |
3085 | | char **); |
3086 | | long long args_strtonum_and_expand(struct args *, u_char, long long, |
3087 | | long long, struct cmdq_item *, char **); |
3088 | | long long args_percentage(struct args *, u_char, long long, |
3089 | | long long, long long, char **); |
3090 | | long long args_string_percentage(const char *, long long, long long, |
3091 | | long long, char **); |
3092 | | long long args_percentage_and_expand(struct args *, u_char, long long, |
3093 | | long long, long long, struct cmdq_item *, char **); |
3094 | | long long args_string_percentage_and_expand(const char *, long long, |
3095 | | long long, long long, struct cmdq_item *, char **); |
3096 | | |
3097 | | /* cmd-find.c */ |
3098 | | int cmd_find_target(struct cmd_find_state *, struct cmdq_item *, |
3099 | | const char *, enum cmd_find_type, int); |
3100 | | struct client *cmd_find_best_client(struct session *); |
3101 | | struct client *cmd_find_client(struct cmdq_item *, const char *, int); |
3102 | | void cmd_find_clear_state(struct cmd_find_state *, int); |
3103 | | int cmd_find_empty_state(struct cmd_find_state *); |
3104 | | int cmd_find_valid_state(struct cmd_find_state *); |
3105 | | void cmd_find_copy_state(struct cmd_find_state *, |
3106 | | struct cmd_find_state *); |
3107 | | void cmd_find_from_session(struct cmd_find_state *, |
3108 | | struct session *, int); |
3109 | | void cmd_find_from_winlink(struct cmd_find_state *, |
3110 | | struct winlink *, int); |
3111 | | int cmd_find_from_session_window(struct cmd_find_state *, |
3112 | | struct session *, struct window *, int); |
3113 | | int cmd_find_from_window(struct cmd_find_state *, struct window *, |
3114 | | int); |
3115 | | void cmd_find_from_winlink_pane(struct cmd_find_state *, |
3116 | | struct winlink *, struct window_pane *, int); |
3117 | | int cmd_find_from_pane(struct cmd_find_state *, |
3118 | | struct window_pane *, int); |
3119 | | int cmd_find_from_client(struct cmd_find_state *, struct client *, |
3120 | | int); |
3121 | | int cmd_find_from_mouse(struct cmd_find_state *, |
3122 | | struct mouse_event *, int); |
3123 | | int cmd_find_from_nothing(struct cmd_find_state *, int); |
3124 | | |
3125 | | /* cmd.c */ |
3126 | | extern const struct cmd_entry *cmd_table[]; |
3127 | | const struct cmd_entry *cmd_find(const char *, char **); |
3128 | | void printflike(3, 4) cmd_log_argv(int, char **, const char *, ...); |
3129 | | void cmd_prepend_argv(int *, char ***, const char *); |
3130 | | void cmd_append_argv(int *, char ***, const char *); |
3131 | | int cmd_pack_argv(int, char **, char *, size_t); |
3132 | | int cmd_unpack_argv(char *, size_t, int, char ***); |
3133 | | char **cmd_copy_argv(int, char **); |
3134 | | void cmd_free_argv(int, char **); |
3135 | | char *cmd_stringify_argv(int, char **); |
3136 | | char *cmd_get_alias(const char *); |
3137 | | const struct cmd_entry *cmd_get_entry(struct cmd *); |
3138 | | struct args *cmd_get_args(struct cmd *); |
3139 | | u_int cmd_get_group(struct cmd *); |
3140 | | void cmd_get_source(struct cmd *, const char **, u_int *); |
3141 | | int cmd_get_parse_flags(struct cmd *); |
3142 | | struct cmd *cmd_parse(struct args_value *, u_int, const char *, u_int, int, |
3143 | | char **); |
3144 | | struct cmd *cmd_copy(struct cmd *, int, char **); |
3145 | | void cmd_free(struct cmd *); |
3146 | | char *cmd_print(struct cmd *); |
3147 | | struct cmd_list *cmd_list_new(void); |
3148 | | struct cmd_list *cmd_list_copy(const struct cmd_list *, int, char **); |
3149 | | void cmd_list_append(struct cmd_list *, struct cmd *); |
3150 | | void cmd_list_append_all(struct cmd_list *, struct cmd_list *); |
3151 | | void cmd_list_move(struct cmd_list *, struct cmd_list *); |
3152 | | void cmd_list_free(struct cmd_list *); |
3153 | 326 | #define CMD_LIST_PRINT_ESCAPED 0x1 |
3154 | 326 | #define CMD_LIST_PRINT_NO_GROUPS 0x2 |
3155 | | char *cmd_list_print(const struct cmd_list *, int); |
3156 | | struct cmd *cmd_list_first(struct cmd_list *); |
3157 | | struct cmd *cmd_list_next(struct cmd *); |
3158 | | int cmd_list_all_have(struct cmd_list *, int); |
3159 | | int cmd_list_any_have(struct cmd_list *, int); |
3160 | | int cmd_mouse_at(struct window_pane *, struct mouse_event *, |
3161 | | u_int *, u_int *, int); |
3162 | | struct winlink *cmd_mouse_window(struct mouse_event *, struct session **); |
3163 | | struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **, |
3164 | | struct winlink **); |
3165 | | char *cmd_template_replace(const char *, const char *, int); |
3166 | | |
3167 | | /* cmd-attach-session.c */ |
3168 | | enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int, |
3169 | | int, const char *, int, const char *); |
3170 | | |
3171 | | /* cmd-parse.c */ |
3172 | | struct cmd_parse_result *cmd_parse_from_file(FILE *, struct cmd_parse_input *); |
3173 | | struct cmd_parse_result *cmd_parse_from_string(const char *, |
3174 | | struct cmd_parse_input *); |
3175 | | enum cmd_parse_status cmd_parse_and_insert(const char *, |
3176 | | struct cmd_parse_input *, struct cmdq_item *, |
3177 | | struct cmdq_state *, char **); |
3178 | | enum cmd_parse_status cmd_parse_and_append(const char *, |
3179 | | struct cmd_parse_input *, struct client *, |
3180 | | struct cmdq_state *, char **); |
3181 | | struct cmd_parse_result *cmd_parse_from_buffer(const void *, size_t, |
3182 | | struct cmd_parse_input *); |
3183 | | struct cmd_parse_result *cmd_parse_from_arguments(struct args_value *, u_int, |
3184 | | struct cmd_parse_input *); |
3185 | | |
3186 | | /* cmd-queue.c */ |
3187 | | struct cmdq_state *cmdq_new_state(struct cmd_find_state *, struct key_event *, |
3188 | | int); |
3189 | | struct cmdq_state *cmdq_link_state(struct cmdq_state *); |
3190 | | struct cmdq_state *cmdq_copy_state(struct cmdq_state *, |
3191 | | struct cmd_find_state *); |
3192 | | void cmdq_free_state(struct cmdq_state *); |
3193 | | void printflike(3, 4) cmdq_add_format(struct cmdq_state *, const char *, |
3194 | | const char *, ...); |
3195 | | void cmdq_add_formats(struct cmdq_state *, struct format_tree *); |
3196 | | void cmdq_merge_formats(struct cmdq_item *, struct format_tree *); |
3197 | | struct cmdq_list *cmdq_new(void); |
3198 | | void cmdq_free(struct cmdq_list *); |
3199 | | const char *cmdq_get_name(struct cmdq_item *); |
3200 | | struct cmd *cmdq_get_cmd(struct cmdq_item *); |
3201 | | struct client *cmdq_get_client(struct cmdq_item *); |
3202 | | struct client *cmdq_get_target_client(struct cmdq_item *); |
3203 | | struct cmdq_state *cmdq_get_state(struct cmdq_item *); |
3204 | | struct cmd_find_state *cmdq_get_target(struct cmdq_item *); |
3205 | | struct cmd_find_state *cmdq_get_source(struct cmdq_item *); |
3206 | | struct key_event *cmdq_get_event(struct cmdq_item *); |
3207 | | struct cmd_find_state *cmdq_get_current(struct cmdq_item *); |
3208 | | int cmdq_get_flags(struct cmdq_item *); |
3209 | | struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmdq_state *); |
3210 | 0 | #define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data) |
3211 | | struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *); |
3212 | | struct cmdq_item *cmdq_get_error(const char *); |
3213 | | struct cmdq_item *cmdq_insert_after(struct cmdq_item *, struct cmdq_item *); |
3214 | | struct cmdq_item *cmdq_append(struct client *, struct cmdq_item *); |
3215 | | void printflike(4, 5) cmdq_insert_hook(struct session *, struct cmdq_item *, |
3216 | | struct cmd_find_state *, const char *, ...); |
3217 | | void cmdq_continue(struct cmdq_item *); |
3218 | | u_int cmdq_next(struct client *); |
3219 | | struct cmdq_item *cmdq_running(struct client *); |
3220 | | void cmdq_guard(struct cmdq_item *, const char *, int); |
3221 | | void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...); |
3222 | | void cmdq_print_data(struct cmdq_item *, struct evbuffer *); |
3223 | | void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...); |
3224 | | |
3225 | | /* cmd-wait-for.c */ |
3226 | | void cmd_wait_for_flush(void); |
3227 | | |
3228 | | /* client.c */ |
3229 | | int client_main(struct event_base *, int, char **, uint64_t, int); |
3230 | | |
3231 | | /* key-bindings.c */ |
3232 | | struct key_table *key_bindings_get_table(const char *, int); |
3233 | | struct key_table *key_bindings_first_table(void); |
3234 | | struct key_table *key_bindings_next_table(struct key_table *); |
3235 | | void key_bindings_unref_table(struct key_table *); |
3236 | | struct key_binding *key_bindings_get(struct key_table *, key_code); |
3237 | | struct key_binding *key_bindings_get_default(struct key_table *, key_code); |
3238 | | struct key_binding *key_bindings_first(struct key_table *); |
3239 | | struct key_binding *key_bindings_next(struct key_table *, struct key_binding *); |
3240 | | void key_bindings_add(const char *, key_code, const char *, int, |
3241 | | struct cmd_list *); |
3242 | | void key_bindings_remove(const char *, key_code); |
3243 | | void key_bindings_reset(const char *, key_code); |
3244 | | void key_bindings_remove_table(const char *); |
3245 | | void key_bindings_reset_table(const char *); |
3246 | | void key_bindings_init(void); |
3247 | | int key_bindings_has_repeat(struct key_binding **, u_int); |
3248 | | struct cmdq_item *key_bindings_dispatch(struct key_binding *, |
3249 | | struct cmdq_item *, struct client *, struct key_event *, |
3250 | | struct cmd_find_state *); |
3251 | | |
3252 | | /* key-string.c */ |
3253 | | key_code key_string_lookup_string(const char *); |
3254 | | const char *key_string_lookup_key(key_code, int); |
3255 | | |
3256 | | /* alerts.c */ |
3257 | | void alerts_reset_all(void); |
3258 | | void alerts_queue(struct window *, int); |
3259 | | void alerts_check_session(struct session *); |
3260 | | |
3261 | | /* file.c */ |
3262 | | int file_cmp(struct client_file *, struct client_file *); |
3263 | | RB_PROTOTYPE(client_files, client_file, entry, file_cmp); |
3264 | | struct client_file *file_create_with_peer(struct tmuxpeer *, |
3265 | | struct client_files *, int, client_file_cb, void *); |
3266 | | struct client_file *file_create_with_client(struct client *, int, |
3267 | | client_file_cb, void *); |
3268 | | void file_free(struct client_file *); |
3269 | | void file_fire_done(struct client_file *); |
3270 | | void file_fire_read(struct client_file *); |
3271 | | int file_can_print(struct client *); |
3272 | | void printflike(2, 3) file_print(struct client *, const char *, ...); |
3273 | | void printflike(2, 0) file_vprint(struct client *, const char *, va_list); |
3274 | | void file_print_buffer(struct client *, void *, size_t); |
3275 | | void printflike(2, 3) file_error(struct client *, const char *, ...); |
3276 | | void file_write(struct client *, const char *, int, const void *, size_t, |
3277 | | client_file_cb, void *); |
3278 | | struct client_file *file_read(struct client *, const char *, client_file_cb, |
3279 | | void *); |
3280 | | void file_cancel(struct client_file *); |
3281 | | void file_push(struct client_file *); |
3282 | | int file_write_left(struct client_files *); |
3283 | | void file_write_open(struct client_files *, struct tmuxpeer *, |
3284 | | struct imsg *, int, int, client_file_cb, void *); |
3285 | | void file_write_data(struct client_files *, struct imsg *); |
3286 | | void file_write_close(struct client_files *, struct imsg *); |
3287 | | void file_read_open(struct client_files *, struct tmuxpeer *, struct imsg *, |
3288 | | int, int, client_file_cb, void *); |
3289 | | int file_write_ready(struct client_files *, struct imsg *); |
3290 | | int file_write_done(struct client_files *, struct imsg *); |
3291 | | int file_read_data(struct client_files *, struct imsg *); |
3292 | | int file_read_done(struct client_files *, struct imsg *); |
3293 | | void file_read_cancel(struct client_files *, struct imsg *); |
3294 | | |
3295 | | /* server.c */ |
3296 | | extern struct tmuxproc *server_proc; |
3297 | | extern struct clients clients; |
3298 | | extern struct cmd_find_state marked_pane; |
3299 | | extern struct message_list message_log; |
3300 | | extern time_t current_time; |
3301 | | void server_set_marked(struct session *, struct winlink *, |
3302 | | struct window_pane *); |
3303 | | void server_clear_marked(void); |
3304 | | int server_is_marked(struct session *, struct winlink *, |
3305 | | struct window_pane *); |
3306 | | int server_check_marked(void); |
3307 | | int server_start(struct tmuxproc *, uint64_t, struct event_base *, int, |
3308 | | char *); |
3309 | | void server_update_socket(void); |
3310 | | void server_add_accept(int); |
3311 | | void printflike(1, 2) server_add_message(const char *, ...); |
3312 | | int server_create_socket(uint64_t, char **); |
3313 | | |
3314 | | /* server-client.c */ |
3315 | | u_int server_client_how_many(void); |
3316 | | void server_client_set_overlay(struct client *, u_int, overlay_check_cb, |
3317 | | overlay_mode_cb, overlay_draw_cb, overlay_key_cb, |
3318 | | overlay_free_cb, overlay_resize_cb, void *); |
3319 | | void server_client_clear_overlay(struct client *); |
3320 | | void server_client_ensure_ranges(struct visible_ranges *, u_int); |
3321 | | int server_client_ranges_is_empty(struct visible_ranges *); |
3322 | | void server_client_overlay_range(u_int, u_int, u_int, u_int, u_int, u_int, |
3323 | | u_int, struct visible_ranges *); |
3324 | | void server_client_set_key_table(struct client *, const char *); |
3325 | | const char *server_client_get_key_table(struct client *); |
3326 | | int server_client_check_nested(struct client *); |
3327 | | int server_client_handle_key(struct client *, struct key_event *); |
3328 | | int server_client_handle_key_after(struct client *, struct key_event *, |
3329 | | struct cmdq_item *, struct cmdq_item **); |
3330 | | struct client *server_client_create(int); |
3331 | | int server_client_open(struct client *, char **); |
3332 | | void server_client_unref(struct client *); |
3333 | | void server_client_set_session(struct client *, struct session *); |
3334 | | void server_client_lost(struct client *); |
3335 | | void server_client_suspend(struct client *); |
3336 | | void server_client_detach(struct client *, enum msgtype); |
3337 | | void server_client_exec(struct client *, const char *); |
3338 | | void server_client_loop(void); |
3339 | | const char *server_client_get_cwd(struct client *, struct session *); |
3340 | | void server_client_set_flags(struct client *, const char *); |
3341 | | const char *server_client_get_flags(struct client *); |
3342 | | void server_client_remove_pane(struct window_pane *); |
3343 | | void server_client_print(struct client *, int, struct evbuffer *); |
3344 | | |
3345 | | /* server-fn.c */ |
3346 | | void server_redraw_client(struct client *); |
3347 | | void server_client_update_theme_colours(struct client *); |
3348 | | void server_status_client(struct client *); |
3349 | | void server_redraw_session(struct session *); |
3350 | | void server_redraw_session_group(struct session *); |
3351 | | void server_status_session(struct session *); |
3352 | | void server_status_session_group(struct session *); |
3353 | | void server_redraw_window(struct window *); |
3354 | | void server_redraw_window_menu(struct window *); |
3355 | | void server_redraw_window_borders(struct window *); |
3356 | | void server_status_window(struct window *); |
3357 | | void server_lock(void); |
3358 | | void server_lock_session(struct session *); |
3359 | | void server_lock_client(struct client *); |
3360 | | void server_kill_pane(struct window_pane *); |
3361 | | void server_kill_window(struct window *, int); |
3362 | | void server_renumber_session(struct session *); |
3363 | | void server_renumber_all(void); |
3364 | | int server_link_window(struct session *, |
3365 | | struct winlink *, struct session *, int, int, int, char **); |
3366 | | void server_unlink_window(struct session *, struct winlink *); |
3367 | | void server_destroy_pane(struct window_pane *, int); |
3368 | | void server_destroy_session(struct session *); |
3369 | | void server_check_unattached(void); |
3370 | | void server_unzoom_window(struct window *); |
3371 | | |
3372 | | /* status.c */ |
3373 | | void status_timer_start(struct client *); |
3374 | | void status_timer_start_all(void); |
3375 | | void status_update_cache(struct session *); |
3376 | | u_int status_prompt_line_at(struct client *); |
3377 | | int status_at_line(struct client *); |
3378 | | u_int status_line_size(struct client *); |
3379 | | struct style_range *status_get_range(struct client *, u_int, u_int); |
3380 | | void status_init(struct client *); |
3381 | | void status_free(struct client *); |
3382 | | int status_redraw(struct client *); |
3383 | | void printflike(6, 7) status_message_set(struct client *, int, int, int, int, |
3384 | | const char *, ...); |
3385 | | void status_message_clear(struct client *); |
3386 | | int status_message_redraw(struct client *); |
3387 | | void status_prompt_set(struct client *, struct cmd_find_state *, |
3388 | | const char *, const char *, status_prompt_input_cb, prompt_free_cb, |
3389 | | void *, int, enum prompt_type); |
3390 | | void status_prompt_clear(struct client *); |
3391 | | int status_prompt_redraw(struct client *); |
3392 | | void status_prompt_cursor(struct client *, u_int *, u_int *); |
3393 | | enum prompt_key_result status_prompt_key(struct client *, key_code, |
3394 | | struct mouse_event *); |
3395 | | void status_prompt_update(struct client *, const char *, const char *); |
3396 | | |
3397 | | /* prompt.c */ |
3398 | | void prompt_set_options(struct prompt_create_data *, struct session *); |
3399 | | struct prompt *prompt_create(const struct prompt_create_data *); |
3400 | | void prompt_free(struct prompt *); |
3401 | | void prompt_incremental_start(struct prompt *); |
3402 | | void prompt_draw(struct prompt *, struct prompt_draw_data *); |
3403 | | enum prompt_key_result prompt_key(struct prompt *, key_code, int *); |
3404 | | enum prompt_key_result prompt_mouse(struct prompt *, u_int, u_int, u_int, |
3405 | | int *); |
3406 | | void prompt_update(struct prompt *, const char *, const char *); |
3407 | | int prompt_closed(struct prompt *); |
3408 | | enum prompt_type prompt_type(const char *); |
3409 | | const char *prompt_type_string(enum prompt_type); |
3410 | | |
3411 | | /* prompt-history.c */ |
3412 | | const char *prompt_up_history(u_int *, u_int); |
3413 | | const char *prompt_down_history(u_int *, u_int); |
3414 | | void prompt_add_history(const char *, u_int); |
3415 | | u_int prompt_history_size(enum prompt_type); |
3416 | | const char *prompt_history_get(enum prompt_type, u_int); |
3417 | | void prompt_history_clear(enum prompt_type); |
3418 | | void prompt_load_history(void); |
3419 | | void prompt_save_history(void); |
3420 | | |
3421 | | /* resize.c */ |
3422 | | void resize_window(struct window *, u_int, u_int, int, int); |
3423 | | void default_window_size(struct client *, struct session *, struct window *, |
3424 | | u_int *, u_int *, u_int *, u_int *, int); |
3425 | | void recalculate_size(struct window *, int); |
3426 | | void recalculate_sizes(void); |
3427 | | void recalculate_sizes_now(int); |
3428 | | |
3429 | | /* input.c */ |
3430 | | #define INPUT_BUF_DEFAULT_SIZE 1048576 |
3431 | | struct input_ctx *input_init(struct window_pane *, struct bufferevent *, |
3432 | | struct colour_palette *, struct client *); |
3433 | | void input_free(struct input_ctx *); |
3434 | | void input_reset(struct input_ctx *, int); |
3435 | | struct evbuffer *input_pending(struct input_ctx *); |
3436 | | void input_parse_pane(struct window_pane *); |
3437 | | void input_parse_buffer(struct window_pane *, const u_char *, size_t); |
3438 | | void input_parse_screen(struct input_ctx *, struct screen *, |
3439 | | screen_write_init_ctx_cb, void *, const u_char *, size_t); |
3440 | | void input_reply_clipboard(struct bufferevent *, const char *, size_t, |
3441 | | const char *, char); |
3442 | | void input_set_buffer_size(size_t); |
3443 | | void input_request_reply(struct client *, enum input_request_type, void *); |
3444 | | void input_cancel_requests(struct client *); |
3445 | | |
3446 | | /* input-key.c */ |
3447 | | void input_key_build(void); |
3448 | | int input_key_pane(struct window_pane *, key_code, struct mouse_event *); |
3449 | | int input_key(struct screen *, struct bufferevent *, key_code); |
3450 | | int input_key_get_mouse(struct screen *, struct mouse_event *, u_int, |
3451 | | u_int, const char **, size_t *); |
3452 | | |
3453 | | /* colour.c */ |
3454 | | int colour_find_rgb(u_char, u_char, u_char); |
3455 | | int colour_join_rgb(u_char, u_char, u_char); |
3456 | | void colour_split_rgb(int, u_char *, u_char *, u_char *); |
3457 | | int colour_force_rgb(int); |
3458 | | int colour_dim(int, u_int); |
3459 | | const char *colour_tostring(int); |
3460 | | const char *colour_toescape(struct client *, int, int); |
3461 | | enum client_theme colour_totheme(int); |
3462 | | int colour_fromstring(const char *); |
3463 | | const char *colour_theme_option(u_int, enum client_theme); |
3464 | | int colour_theme_terminal_colour(u_int); |
3465 | | int colour_256toRGB(int); |
3466 | | int colour_256to16(int); |
3467 | | int colour_byname(const char *); |
3468 | | int colour_parseX11(const char *); |
3469 | | void colour_palette_init(struct colour_palette *); |
3470 | | void colour_palette_clear(struct colour_palette *); |
3471 | | void colour_palette_free(struct colour_palette *); |
3472 | | int colour_palette_get(struct colour_palette *, int); |
3473 | | int colour_palette_set(struct colour_palette *, int, int); |
3474 | | void colour_palette_from_option(struct colour_palette *, struct options *); |
3475 | | |
3476 | | /* attributes.c */ |
3477 | | const char *attributes_tostring(int); |
3478 | | int attributes_fromstring(const char *); |
3479 | | |
3480 | | /* fuzzy.c */ |
3481 | | bitstr_t *fuzzy_match(const char *, const char *, u_int, u_int *); |
3482 | | |
3483 | | /* grid.c */ |
3484 | | extern const struct grid_cell grid_default_cell; |
3485 | | void grid_check_is_clear(struct grid *); |
3486 | | void grid_empty_line(struct grid *, u_int, u_int); |
3487 | | void grid_set_tab(struct grid_cell *, u_int); |
3488 | | int grid_cells_equal(const struct grid_cell *, const struct grid_cell *); |
3489 | | int grid_cells_look_equal(const struct grid_cell *, |
3490 | | const struct grid_cell *); |
3491 | | struct grid *grid_create(u_int, u_int, u_int); |
3492 | | void grid_destroy(struct grid *); |
3493 | | void grid_free_lines(struct grid *, u_int, u_int); |
3494 | | int grid_compare(struct grid *, struct grid *); |
3495 | | const char *grid_line_flags_string(int); |
3496 | | const char *grid_cell_flags_string(int); |
3497 | | const char *grid_cell_attr_string(int); |
3498 | | time_t grid_line_time(const struct grid_line *); |
3499 | | void grid_collect_history(struct grid *, int); |
3500 | | void grid_remove_history(struct grid *, u_int ); |
3501 | | void grid_scroll_history(struct grid *, u_int); |
3502 | | void grid_scroll_history_region(struct grid *, u_int, u_int, u_int); |
3503 | | void grid_clear_history(struct grid *); |
3504 | | const struct grid_line *grid_peek_line(struct grid *, u_int); |
3505 | | void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *); |
3506 | | void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *); |
3507 | | void grid_set_padding(struct grid *, u_int, u_int, int); |
3508 | | void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *, |
3509 | | const char *, size_t); |
3510 | | struct grid_line *grid_get_line(struct grid *, u_int); |
3511 | | void grid_adjust_lines(struct grid *, u_int); |
3512 | | void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int); |
3513 | | void grid_clear_lines(struct grid *, u_int, u_int, u_int); |
3514 | | void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int); |
3515 | | void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int, u_int); |
3516 | | char *grid_string_cells(struct grid *, u_int, u_int, u_int, |
3517 | | struct grid_cell **, int, struct screen *); |
3518 | | void grid_duplicate_lines(struct grid *, u_int, struct grid *, u_int, |
3519 | | u_int); |
3520 | | void grid_reflow(struct grid *, u_int); |
3521 | | void grid_wrap_position(struct grid *, u_int, u_int, u_int *, u_int *); |
3522 | | void grid_unwrap_position(struct grid *, u_int *, u_int *, u_int, u_int); |
3523 | | u_int grid_line_length(struct grid *, u_int); |
3524 | | u_int grid_line_limit(struct grid *, u_int); |
3525 | | int grid_in_set(struct grid *, u_int, u_int, const char *); |
3526 | | |
3527 | | /* grid-reader.c */ |
3528 | | void grid_reader_start(struct grid_reader *, struct grid *, u_int, u_int); |
3529 | | void grid_reader_get_cursor(struct grid_reader *, u_int *, u_int *); |
3530 | | u_int grid_reader_line_length(struct grid_reader *); |
3531 | | int grid_reader_in_set(struct grid_reader *, const char *); |
3532 | | void grid_reader_cursor_right(struct grid_reader *, int, int, int); |
3533 | | void grid_reader_cursor_left(struct grid_reader *, int); |
3534 | | void grid_reader_cursor_down(struct grid_reader *); |
3535 | | void grid_reader_cursor_up(struct grid_reader *); |
3536 | | void grid_reader_cursor_start_of_line(struct grid_reader *, int); |
3537 | | void grid_reader_cursor_end_of_line(struct grid_reader *, int, int); |
3538 | | void grid_reader_cursor_next_word(struct grid_reader *, const char *); |
3539 | | void grid_reader_cursor_next_word_end(struct grid_reader *, const char *); |
3540 | | void grid_reader_cursor_previous_word(struct grid_reader *, const char *, |
3541 | | int, int); |
3542 | | int grid_reader_cursor_jump(struct grid_reader *, |
3543 | | const struct utf8_data *); |
3544 | | int grid_reader_cursor_jump_back(struct grid_reader *, |
3545 | | const struct utf8_data *); |
3546 | | void grid_reader_cursor_back_to_indentation(struct grid_reader *); |
3547 | | |
3548 | | /* grid-view.c */ |
3549 | | void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *); |
3550 | | void grid_view_set_cell(struct grid *, u_int, u_int, |
3551 | | const struct grid_cell *); |
3552 | | void grid_view_set_padding(struct grid *, u_int, u_int, int); |
3553 | | void grid_view_set_cells(struct grid *, u_int, u_int, |
3554 | | const struct grid_cell *, const char *, size_t); |
3555 | | void grid_view_clear_history(struct grid *, u_int); |
3556 | | void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int); |
3557 | | void grid_view_scroll_region_up(struct grid *, u_int, u_int, u_int); |
3558 | | void grid_view_scroll_region_down(struct grid *, u_int, u_int, u_int); |
3559 | | void grid_view_insert_lines(struct grid *, u_int, u_int, u_int); |
3560 | | void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int, |
3561 | | u_int); |
3562 | | void grid_view_delete_lines(struct grid *, u_int, u_int, u_int); |
3563 | | void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int, |
3564 | | u_int); |
3565 | | void grid_view_insert_cells(struct grid *, u_int, u_int, u_int, u_int); |
3566 | | void grid_view_delete_cells(struct grid *, u_int, u_int, u_int, u_int); |
3567 | | char *grid_view_string_cells(struct grid *, u_int, u_int, u_int); |
3568 | | |
3569 | | /* screen-write.c */ |
3570 | | void screen_write_make_list(struct screen *); |
3571 | | void screen_write_free_list(struct screen *); |
3572 | | void screen_write_start_pane(struct screen_write_ctx *, |
3573 | | struct window_pane *, struct screen *); |
3574 | | void screen_write_start(struct screen_write_ctx *, struct screen *); |
3575 | | void screen_write_start_callback(struct screen_write_ctx *, struct screen *, |
3576 | | screen_write_init_ctx_cb, void *); |
3577 | | void screen_write_stop(struct screen_write_ctx *); |
3578 | | void screen_write_reset(struct screen_write_ctx *); |
3579 | | size_t printflike(1, 2) screen_write_strlen(const char *, ...); |
3580 | | int printflike(7, 8) screen_write_text(struct screen_write_ctx *, u_int, u_int, |
3581 | | u_int, int, const struct grid_cell *, const char *, ...); |
3582 | | void printflike(3, 4) screen_write_puts(struct screen_write_ctx *, |
3583 | | const struct grid_cell *, const char *, ...); |
3584 | | void printflike(4, 5) screen_write_nputs(struct screen_write_ctx *, |
3585 | | ssize_t, const struct grid_cell *, const char *, ...); |
3586 | | void printflike(4, 0) screen_write_vnputs(struct screen_write_ctx *, ssize_t, |
3587 | | const struct grid_cell *, const char *, va_list); |
3588 | | void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *, |
3589 | | u_char); |
3590 | | void screen_write_fast_copy(struct screen_write_ctx *, struct screen *, |
3591 | | u_int, u_int, u_int, u_int); |
3592 | | void screen_write_hline(struct screen_write_ctx *, u_int, int, int, |
3593 | | enum box_lines, const struct grid_cell *); |
3594 | | void screen_write_vline(struct screen_write_ctx *, u_int, int, int, |
3595 | | const struct grid_cell *); |
3596 | | void screen_write_menu(struct screen_write_ctx *, struct menu *, int, |
3597 | | enum box_lines, const struct grid_cell *, const struct grid_cell *, |
3598 | | const struct grid_cell *); |
3599 | | void screen_write_box(struct screen_write_ctx *, u_int, u_int, |
3600 | | enum box_lines, const struct grid_cell *, const char *); |
3601 | | void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int, |
3602 | | u_int); |
3603 | | void screen_write_backspace(struct screen_write_ctx *); |
3604 | | void screen_write_mode_set(struct screen_write_ctx *, int); |
3605 | | void screen_write_mode_clear(struct screen_write_ctx *, int); |
3606 | | void screen_write_start_sync(struct window_pane *); |
3607 | | void screen_write_stop_sync(struct window_pane *); |
3608 | | void screen_write_end_sync(struct screen_write_ctx *); |
3609 | | void screen_write_clear_dirty(struct window_pane *); |
3610 | | void screen_write_cursorup(struct screen_write_ctx *, u_int); |
3611 | | void screen_write_cursordown(struct screen_write_ctx *, u_int); |
3612 | | void screen_write_cursorright(struct screen_write_ctx *, u_int); |
3613 | | void screen_write_cursorleft(struct screen_write_ctx *, u_int); |
3614 | | void screen_write_alignmenttest(struct screen_write_ctx *); |
3615 | | void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int); |
3616 | | void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int); |
3617 | | void screen_write_clearcharacter(struct screen_write_ctx *, u_int, u_int); |
3618 | | void screen_write_insertline(struct screen_write_ctx *, u_int, u_int); |
3619 | | void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int); |
3620 | | void screen_write_clearline(struct screen_write_ctx *, u_int); |
3621 | | void screen_write_clearendofline(struct screen_write_ctx *, u_int); |
3622 | | void screen_write_clearstartofline(struct screen_write_ctx *, u_int); |
3623 | | void screen_write_cursormove(struct screen_write_ctx *, int, int, int); |
3624 | | void screen_write_reverseindex(struct screen_write_ctx *, u_int); |
3625 | | void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int); |
3626 | | void screen_write_linefeed(struct screen_write_ctx *, int, u_int); |
3627 | | void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int); |
3628 | | void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int); |
3629 | | void screen_write_carriagereturn(struct screen_write_ctx *); |
3630 | | void screen_write_clearendofscreen(struct screen_write_ctx *, u_int); |
3631 | | void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int); |
3632 | | void screen_write_clearscreen(struct screen_write_ctx *, u_int); |
3633 | | void screen_write_clearhistory(struct screen_write_ctx *); |
3634 | | void screen_write_fullredraw(struct screen_write_ctx *); |
3635 | | void screen_write_collect_end(struct screen_write_ctx *); |
3636 | | void screen_write_collect_add(struct screen_write_ctx *, |
3637 | | const struct grid_cell *); |
3638 | | void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *); |
3639 | | void screen_write_setselection(struct screen_write_ctx *, const char *, |
3640 | | u_char *, u_int); |
3641 | | void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int, |
3642 | | int); |
3643 | | #ifdef ENABLE_SIXEL |
3644 | | void screen_write_sixelimage(struct screen_write_ctx *, |
3645 | | struct sixel_image *, u_int); |
3646 | | #endif |
3647 | | void screen_write_alternateon(struct screen_write_ctx *, |
3648 | | struct grid_cell *, int); |
3649 | | void screen_write_alternateoff(struct screen_write_ctx *, |
3650 | | struct grid_cell *, int); |
3651 | | |
3652 | | /* screen-redraw.c */ |
3653 | | void redraw_screen(struct client *); |
3654 | | void redraw_pane(struct client *, struct window_pane *); |
3655 | | void redraw_pane_scrollbar(struct client *, struct window_pane *); |
3656 | | void redraw_free_scene(struct redraw_scene *); |
3657 | | void redraw_invalidate_scene(struct window *); |
3658 | | void redraw_invalidate_all_scenes(void); |
3659 | | int redraw_get_status_border_cell_type(struct redraw_span **, u_int); |
3660 | | |
3661 | | /* screen.c */ |
3662 | | void screen_init(struct screen *, u_int, u_int, u_int); |
3663 | | void screen_reinit(struct screen *, int); |
3664 | | void screen_free(struct screen *); |
3665 | | void screen_reset_tabs(struct screen *); |
3666 | | void screen_reset_hyperlinks(struct screen *); |
3667 | | void screen_set_default_cursor(struct screen *, struct options *); |
3668 | | void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *); |
3669 | | void screen_set_cursor_colour(struct screen *, int); |
3670 | | int screen_set_title(struct screen *, const char *, int); |
3671 | | int screen_set_path(struct screen *, const char *, int); |
3672 | | void screen_push_title(struct screen *); |
3673 | | void screen_pop_title(struct screen *); |
3674 | | void screen_set_progress_bar(struct screen *, enum progress_bar_state, int); |
3675 | | void screen_resize(struct screen *, u_int, u_int, int); |
3676 | | void screen_resize_cursor(struct screen *, u_int, u_int, int, int, int); |
3677 | | void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int, |
3678 | | u_int, u_int, int, struct grid_cell *); |
3679 | | void screen_clear_selection(struct screen *); |
3680 | | void screen_hide_selection(struct screen *); |
3681 | | int screen_check_selection(struct screen *, u_int, u_int); |
3682 | | int screen_select_cell(struct screen *, struct grid_cell *, |
3683 | | const struct grid_cell *); |
3684 | | int screen_alternate_on(struct screen *, struct grid_cell *, int); |
3685 | | int screen_alternate_off(struct screen *, struct grid_cell *, int); |
3686 | | const char *screen_mode_to_string(int); |
3687 | | const char *screen_print(struct screen *, int); |
3688 | | |
3689 | | /* window.c */ |
3690 | | extern struct windows windows; |
3691 | | extern struct window_pane_tree all_window_panes; |
3692 | | int window_cmp(struct window *, struct window *); |
3693 | | RB_PROTOTYPE(windows, window, entry, window_cmp); |
3694 | | int winlink_cmp(struct winlink *, struct winlink *); |
3695 | | RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp); |
3696 | | int window_pane_cmp(struct window_pane *, struct window_pane *); |
3697 | | RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp); |
3698 | | struct winlink *winlink_find_by_index(struct winlinks *, int); |
3699 | | struct winlink *winlink_find_by_window(struct winlinks *, struct window *); |
3700 | | struct winlink *winlink_find_by_window_id(struct winlinks *, u_int); |
3701 | | u_int winlink_count(struct winlinks *); |
3702 | | struct winlink *winlink_add(struct winlinks *, int); |
3703 | | void winlink_set_window(struct winlink *, struct window *); |
3704 | | void winlink_remove(struct winlinks *, struct winlink *); |
3705 | | struct winlink *winlink_next(struct winlink *); |
3706 | | struct winlink *winlink_previous(struct winlink *); |
3707 | | struct winlink *winlink_next_by_number(struct winlink *, struct session *, |
3708 | | int); |
3709 | | struct winlink *winlink_previous_by_number(struct winlink *, struct session *, |
3710 | | int); |
3711 | | void winlink_stack_push(struct winlink_stack *, struct winlink *); |
3712 | | void winlink_stack_remove(struct winlink_stack *, struct winlink *); |
3713 | | struct window *window_find_by_id_str(const char *); |
3714 | | struct window *window_find_by_id(u_int); |
3715 | | void window_update_activity(struct window *); |
3716 | | struct window *window_create(u_int, u_int, u_int, u_int); |
3717 | | void window_pane_set_event(struct window_pane *); |
3718 | | void window_pane_wait_finish(struct window_pane *); |
3719 | | struct window_pane *window_get_active_at(struct window *, u_int, u_int); |
3720 | | struct window_pane *window_find_string(struct window *, const char *); |
3721 | | int window_has_floating_panes(struct window *); |
3722 | | int window_has_pane(struct window *, struct window_pane *); |
3723 | | int window_pane_contains(struct window_pane *, u_int, u_int); |
3724 | | int window_set_active_pane(struct window *, struct window_pane *, |
3725 | | int); |
3726 | | void window_fire_pane_moved(struct window_pane *, struct window *, |
3727 | | int, struct window *, int); |
3728 | | void window_update_focus(struct window *); |
3729 | | void window_pane_update_focus(struct window_pane *); |
3730 | | void window_redraw_active_switch(struct window *, |
3731 | | struct window_pane *); |
3732 | | struct window_pane *window_add_pane(struct window *, struct window_pane *, |
3733 | | u_int, int); |
3734 | | void window_resize(struct window *, u_int, u_int, int, int); |
3735 | | void window_pane_send_resize(struct window_pane *, u_int, u_int); |
3736 | | int window_zoom(struct window_pane *); |
3737 | | int window_unzoom(struct window *, int); |
3738 | | int window_active_pane_is_over_zoom(struct window *); |
3739 | | struct window_pane *window_zoomed_pane(struct window *); |
3740 | | int window_push_zoom(struct window *, int, int); |
3741 | | int window_pop_zoom(struct window *); |
3742 | | void window_lost_pane(struct window *, struct window_pane *); |
3743 | | void window_remove_pane(struct window *, struct window_pane *); |
3744 | | struct window_pane *window_pane_at_index(struct window *, u_int); |
3745 | | struct window_pane *window_pane_next_by_number(struct window *, |
3746 | | struct window_pane *, u_int); |
3747 | | struct window_pane *window_pane_previous_by_number(struct window *, |
3748 | | struct window_pane *, u_int); |
3749 | | int window_pane_index(struct window_pane *, u_int *); |
3750 | | int window_pane_zindex(struct window_pane *, u_int *); |
3751 | | u_int window_count_panes(struct window *, int); |
3752 | | void window_destroy_panes(struct window *); |
3753 | | struct window_pane *window_pane_find_by_id_str(const char *); |
3754 | | struct window_pane *window_pane_find_by_id(u_int); |
3755 | | int window_pane_destroy_ready(struct window_pane *); |
3756 | | void window_pane_resize(struct window_pane *, u_int, u_int); |
3757 | | void window_pane_clear_resizes(struct window_pane *, |
3758 | | struct window_pane_resize *); |
3759 | | int window_pane_set_mode(struct window_pane *, |
3760 | | struct window_pane *, const struct window_mode *, |
3761 | | struct cmdq_item *, struct cmd_find_state *, struct args *); |
3762 | | void window_pane_reset_mode(struct window_pane *); |
3763 | | void window_pane_reset_mode_all(struct window_pane *); |
3764 | | int window_pane_key(struct window_pane *, struct client *, |
3765 | | struct session *, struct winlink *, key_code, |
3766 | | struct mouse_event *); |
3767 | | void window_pane_paste(struct window_pane *, key_code, char *, |
3768 | | size_t); |
3769 | | void window_pane_set_prompt(struct window_pane *, struct client *, |
3770 | | struct cmd_find_state *, const char *, const char *, |
3771 | | status_prompt_input_cb, prompt_free_cb, void *, int, |
3772 | | enum prompt_type); |
3773 | | void window_pane_clear_prompt(struct window_pane *); |
3774 | | int window_pane_has_prompt(struct window_pane *); |
3775 | | void window_pane_update_prompt(struct window_pane *, const char *, |
3776 | | const char *); |
3777 | | enum prompt_key_result window_pane_prompt_key(struct window_pane *, |
3778 | | struct client *, key_code, struct mouse_event *); |
3779 | | int window_pane_is_visible(struct window_pane *); |
3780 | | int window_pane_exited(struct window_pane *); |
3781 | | u_int window_pane_search(struct window_pane *, const char *, int, |
3782 | | int); |
3783 | | const char *window_printable_flags(struct winlink *, int); |
3784 | | const char *window_pane_printable_flags(struct window_pane *); |
3785 | | struct window_pane *window_pane_find_up(struct window_pane *); |
3786 | | struct window_pane *window_pane_find_down(struct window_pane *); |
3787 | | struct window_pane *window_pane_find_left(struct window_pane *); |
3788 | | struct window_pane *window_pane_find_right(struct window_pane *); |
3789 | | void window_pane_stack_push(struct window_panes *, |
3790 | | struct window_pane *); |
3791 | | void window_pane_stack_remove(struct window_panes *, |
3792 | | struct window_pane *); |
3793 | | void window_set_name(struct window *, const char *, int); |
3794 | | void window_add_ref(struct window *, const char *); |
3795 | | void window_remove_ref(struct window *, const char *); |
3796 | | void window_pane_add_ref(struct window_pane *, const char *); |
3797 | | void window_pane_remove_ref(struct window_pane *, const char *); |
3798 | | void winlink_clear_flags(struct winlink *); |
3799 | | int winlink_shuffle_up(struct session *, struct winlink *, int); |
3800 | | int window_pane_start_input(struct window_pane *, |
3801 | | struct cmdq_item *, char **); |
3802 | | void *window_pane_get_new_data(struct window_pane *, |
3803 | | struct window_pane_offset *, size_t *); |
3804 | | void window_pane_update_used_data(struct window_pane *, |
3805 | | struct window_pane_offset *, size_t); |
3806 | | void window_pane_default_cursor(struct window_pane *); |
3807 | | int window_pane_mode(struct window_pane *); |
3808 | | int window_pane_show_scrollbar(struct window_pane *); |
3809 | | int window_pane_scrollbar_reserve(struct window_pane *); |
3810 | | int window_pane_scrollbar_visible(struct window_pane *); |
3811 | | int window_pane_scrollbar_overlay(struct window_pane *); |
3812 | | int window_pane_scrollbar_overlay_visible(struct window_pane *); |
3813 | | void window_pane_scrollbar_show(struct window_pane *, int); |
3814 | | void window_pane_scrollbar_hide(struct window_pane *); |
3815 | | void window_pane_scrollbar_start_timer(struct window_pane *); |
3816 | | void window_pane_scrollbar_redraw(struct window_pane *); |
3817 | | int window_pane_get_bg(struct window_pane *); |
3818 | | int window_pane_get_fg(struct window_pane *); |
3819 | | int window_pane_get_fg_control_client(struct window_pane *); |
3820 | | int window_pane_get_bg_control_client(struct window_pane *); |
3821 | | int window_get_bg_client(struct window_pane *); |
3822 | | enum client_theme window_pane_get_theme(struct window_pane *); |
3823 | | void window_pane_send_theme_update(struct window_pane *); |
3824 | | enum pane_lines window_pane_get_pane_lines(struct window_pane *); |
3825 | | enum pane_lines window_get_pane_lines(struct window *); |
3826 | | int window_get_pane_status(struct window *); |
3827 | | int window_pane_get_pane_status(struct window_pane *); |
3828 | | struct style_range *window_pane_status_get_range(struct window_pane *, u_int, |
3829 | | u_int); |
3830 | | int window_pane_is_floating(struct window_pane *); |
3831 | | |
3832 | | /* window-border.c */ |
3833 | | void window_set_fill_cells(struct window *); |
3834 | | void window_get_border_cell(struct window_pane *, enum pane_lines, |
3835 | | int, struct grid_cell *); |
3836 | | void window_get_fill_cell(struct window *, int, struct grid_cell *); |
3837 | | void window_pane_get_border_cell(struct window_pane *, int, |
3838 | | struct grid_cell *); |
3839 | | void window_pane_get_border_style(struct window_pane *, |
3840 | | struct client *, struct grid_cell *); |
3841 | | int window_make_pane_status(struct window_pane *, struct client *, |
3842 | | u_int, struct redraw_span *); |
3843 | | |
3844 | | /* window-visible.c */ |
3845 | | int window_position_is_visible(struct visible_ranges *, u_int); |
3846 | | struct visible_ranges *window_visible_ranges(struct window_pane *, int, int, |
3847 | | u_int, struct visible_ranges *); |
3848 | | |
3849 | | /* layout.c */ |
3850 | | u_int layout_count_cells(struct layout_cell *); |
3851 | | struct layout_cell *layout_create_cell(struct layout_cell *); |
3852 | | void layout_free_cell(struct layout_cell *, int); |
3853 | | void layout_print_cell(struct layout_cell *, const char *, u_int); |
3854 | | void layout_destroy_cell(struct window *, struct layout_cell *, |
3855 | | struct layout_cell **); |
3856 | | void layout_resize_layout(struct window *, struct layout_cell *, |
3857 | | enum layout_type, int, int); |
3858 | | struct layout_cell *layout_search_by_border(struct layout_cell *, u_int, u_int); |
3859 | | void layout_set_size(struct layout_cell *, u_int, u_int, int, int); |
3860 | | void layout_make_leaf(struct layout_cell *, struct window_pane *); |
3861 | | void layout_make_node(struct layout_cell *, enum layout_type); |
3862 | | void layout_fix_zindexes(struct window *, struct layout_cell *); |
3863 | | int layout_cell_is_tiled(struct layout_cell *); |
3864 | | int layout_add_horizontal_border(struct layout_cell *, |
3865 | | struct layout_cell *, int); |
3866 | | void layout_fix_offsets(struct window *); |
3867 | | void layout_fix_panes(struct window *, struct window_pane *); |
3868 | | void layout_resize_adjust(struct window *, struct layout_cell *, |
3869 | | enum layout_type, int); |
3870 | | void layout_resize_set_size(struct window *, struct layout_cell *, |
3871 | | enum layout_type, u_int); |
3872 | | struct layout_cell *layout_cell_get_neighbour(struct layout_cell *); |
3873 | | void layout_init(struct window *, struct window_pane *); |
3874 | | void layout_free(struct window *, int); |
3875 | | void layout_resize(struct window *, u_int, u_int); |
3876 | | void layout_resize_pane(struct window_pane *, enum layout_type, |
3877 | | int, int); |
3878 | | void layout_resize_pane_to(struct window_pane *, enum layout_type, |
3879 | | u_int); |
3880 | | int layout_resize_floating_pane(struct window_pane *, |
3881 | | enum layout_type, int, int, char **); |
3882 | | int layout_resize_floating_pane_to(struct window_pane *, |
3883 | | enum layout_type, u_int, char **); |
3884 | | void layout_assign_pane(struct layout_cell *, struct window_pane *, |
3885 | | int); |
3886 | | int layout_split_check_space(struct window_pane *, |
3887 | | struct layout_cell *, enum layout_type); |
3888 | | void layout_split_sizes(struct layout_cell *, int, int, |
3889 | | enum layout_type, u_int *, u_int *, u_int *); |
3890 | | struct layout_cell *layout_replace_with_node(struct window *, |
3891 | | struct layout_cell *, enum layout_type); |
3892 | | struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type, |
3893 | | int, int); |
3894 | | struct layout_cell *layout_floating_pane(struct window *, struct window_pane *, |
3895 | | struct layout_geometry *); |
3896 | | void layout_close_pane(struct window_pane *); |
3897 | | int layout_spread_cell(struct window *, struct layout_cell *); |
3898 | | void layout_spread_out(struct window_pane *); |
3899 | | struct layout_cell *layout_get_tiled_cell(struct cmdq_item *, struct args *, |
3900 | | struct window *, struct window_pane *, int, char **); |
3901 | | struct layout_cell *layout_get_floating_cell(struct cmdq_item *, struct args *, |
3902 | | enum pane_lines, struct window *, struct window_pane *, |
3903 | | int, char **); |
3904 | | int layout_floating_args_parse(struct cmdq_item *, struct args *, |
3905 | | enum pane_lines, struct window *, struct layout_geometry *, |
3906 | | char **); |
3907 | | int layout_split_floating_cell(struct layout_cell *, |
3908 | | struct window *, struct layout_geometry *, enum pane_lines, |
3909 | | int, char **); |
3910 | | int layout_remove_tile(struct window *, struct layout_cell *); |
3911 | | int layout_insert_tile(struct window *, struct layout_cell *); |
3912 | | |
3913 | | /* layout-custom.c */ |
3914 | | char *layout_dump(struct window *, struct layout_cell *); |
3915 | | int layout_parse(struct window *, const char *, char **); |
3916 | | |
3917 | | /* layout-set.c */ |
3918 | | int layout_set_lookup(const char *); |
3919 | | u_int layout_set_select(struct window *, u_int); |
3920 | | u_int layout_set_next(struct window *); |
3921 | | u_int layout_set_previous(struct window *); |
3922 | | |
3923 | | /* mode-tree.c */ |
3924 | | typedef void (*mode_tree_build_cb)(void *, struct sort_criteria *, |
3925 | | uint64_t *, const char *); |
3926 | | typedef void (*mode_tree_draw_cb)(void *, void *, struct screen_write_ctx *, |
3927 | | u_int, u_int); |
3928 | | typedef int (*mode_tree_search_cb)(void *, void *, const char *, int); |
3929 | | typedef void (*mode_tree_menu_cb)(void *, struct client *, key_code); |
3930 | | typedef u_int (*mode_tree_height_cb)(void *, u_int); |
3931 | | typedef key_code (*mode_tree_key_cb)(void *, void *, u_int); |
3932 | | typedef int (*mode_tree_swap_cb)(void *, void *, struct sort_criteria *); |
3933 | | typedef void (*mode_tree_sort_cb)(struct sort_criteria *); |
3934 | | typedef void (*mode_tree_each_cb)(void *, void *, struct client *, key_code); |
3935 | | typedef const char** (*mode_tree_help_cb)(u_int *, const char**); |
3936 | | u_int mode_tree_count_tagged(struct mode_tree_data *); |
3937 | | void *mode_tree_get_current(struct mode_tree_data *); |
3938 | | const char *mode_tree_get_current_name(struct mode_tree_data *); |
3939 | | void mode_tree_select_top(struct mode_tree_data *); |
3940 | | void mode_tree_expand_current(struct mode_tree_data *); |
3941 | | void mode_tree_collapse_current(struct mode_tree_data *); |
3942 | | void mode_tree_expand(struct mode_tree_data *, uint64_t); |
3943 | | int mode_tree_set_current(struct mode_tree_data *, uint64_t); |
3944 | | void mode_tree_each_tagged(struct mode_tree_data *, mode_tree_each_cb, |
3945 | | struct client *, key_code, int); |
3946 | | void mode_tree_up(struct mode_tree_data *, int); |
3947 | | int mode_tree_down(struct mode_tree_data *, int); |
3948 | | struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *, |
3949 | | mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb, |
3950 | | mode_tree_menu_cb, mode_tree_height_cb, mode_tree_key_cb, |
3951 | | mode_tree_swap_cb, mode_tree_sort_cb, mode_tree_help_cb, void *, |
3952 | | const struct menu_item *, struct screen **); |
3953 | | void mode_tree_zoom(struct mode_tree_data *, struct args *); |
3954 | | void mode_tree_build(struct mode_tree_data *); |
3955 | | void mode_tree_free(struct mode_tree_data *); |
3956 | | void mode_tree_resize(struct mode_tree_data *, u_int, u_int); |
3957 | | struct mode_tree_item *mode_tree_add(struct mode_tree_data *, |
3958 | | struct mode_tree_item *, void *, uint64_t, const char *, |
3959 | | const char *, int); |
3960 | | void mode_tree_view_name(struct mode_tree_data *, const char *); |
3961 | | void mode_tree_draw_as_parent(struct mode_tree_item *); |
3962 | | void mode_tree_no_tag(struct mode_tree_item *); |
3963 | | void mode_tree_align(struct mode_tree_item *, int); |
3964 | | void mode_tree_remove(struct mode_tree_data *, struct mode_tree_item *); |
3965 | | void mode_tree_draw(struct mode_tree_data *); |
3966 | | int mode_tree_key(struct mode_tree_data *, struct client *, key_code *, |
3967 | | struct mouse_event *, u_int *, u_int *); |
3968 | | void mode_tree_set_prompt(struct mode_tree_data *, struct client *, |
3969 | | const char *, const char *, enum prompt_type, int, |
3970 | | mode_tree_prompt_input_cb, prompt_free_cb, void *); |
3971 | | void mode_tree_clear_prompt(struct mode_tree_data *); |
3972 | | int mode_tree_has_prompt(struct mode_tree_data *); |
3973 | | void mode_tree_run_command(struct client *, struct cmd_find_state *, |
3974 | | const char *, const char *); |
3975 | | |
3976 | | /* window-buffer.c */ |
3977 | | extern const struct window_mode window_buffer_mode; |
3978 | | |
3979 | | /* window-tree.c */ |
3980 | | extern const struct window_mode window_tree_mode; |
3981 | | |
3982 | | /* window-switch.c */ |
3983 | | extern const struct window_mode window_switch_mode; |
3984 | | |
3985 | | /* window-clock.c */ |
3986 | | extern const struct window_mode window_clock_mode; |
3987 | | extern const char window_clock_table[14][5][5]; |
3988 | | |
3989 | | /* window-panes.c */ |
3990 | | extern const struct window_mode window_panes_mode; |
3991 | | |
3992 | | /* window-client.c */ |
3993 | | extern const struct window_mode window_client_mode; |
3994 | | |
3995 | | /* window-copy.c */ |
3996 | | extern const struct window_mode window_copy_mode; |
3997 | | extern const struct window_mode window_view_mode; |
3998 | | void printflike(3, 4) window_copy_add(struct window_pane *, int, const char *, |
3999 | | ...); |
4000 | | void printflike(3, 0) window_copy_vadd(struct window_pane *, int, const char *, |
4001 | | va_list); |
4002 | | void window_copy_scroll(struct window_pane *, int, u_int, u_int, int); |
4003 | | void window_copy_pageup(struct window_pane *, int); |
4004 | | void window_copy_pagedown(struct window_pane *, int, int); |
4005 | | void window_copy_start_drag(struct client *, struct mouse_event *); |
4006 | | char *window_copy_get_word(struct window_pane *, u_int, u_int); |
4007 | | char *window_copy_get_line(struct window_pane *, u_int); |
4008 | | int window_copy_get_current_offset(struct window_pane *, u_int *, |
4009 | | u_int *); |
4010 | | char *window_copy_get_hyperlink(struct window_pane *, u_int, u_int); |
4011 | | void window_copy_set_line_numbers(struct window_pane *, int); |
4012 | | |
4013 | | /* window-customize.c */ |
4014 | | extern const struct window_mode window_customize_mode; |
4015 | | |
4016 | | /* names.c */ |
4017 | | void check_window_name(struct window *); |
4018 | | char *default_window_name(struct window *); |
4019 | | char *parse_window_name(const char *); |
4020 | | |
4021 | | /* monitor.c */ |
4022 | | struct monitor_set *monitor_create_client(struct client *, monitor_cb, void *); |
4023 | | struct monitor_set *monitor_create_session(struct session *, monitor_cb, void *); |
4024 | | void monitor_destroy(struct monitor_set *); |
4025 | | int monitor_parse(const char *, char **, enum monitor_type *, int *, |
4026 | | char **); |
4027 | | void monitor_add(struct monitor_set *, const char *, enum monitor_type, int, |
4028 | | const char *, int); |
4029 | | void monitor_remove(struct monitor_set *, const char *); |
4030 | | u_int monitor_get_fire_count(struct monitor_set *, const char *); |
4031 | | time_t monitor_get_fire_time(struct monitor_set *, const char *); |
4032 | | |
4033 | | /* control.c */ |
4034 | | void control_discard(struct client *); |
4035 | | void control_discard_all(struct client *); |
4036 | | void control_start(struct client *); |
4037 | | void control_ready(struct client *); |
4038 | | void control_stop(struct client *); |
4039 | | void control_wait_exit(int); |
4040 | | void control_set_pane_on(struct client *, struct window_pane *); |
4041 | | void control_set_pane_off(struct client *, struct window_pane *); |
4042 | | void control_continue_pane(struct client *, struct window_pane *); |
4043 | | void control_pause_pane(struct client *, struct window_pane *); |
4044 | | void control_reset_pane(struct client *, struct window_pane *); |
4045 | | void control_set_window_size(struct client *, u_int, u_int, u_int); |
4046 | | int control_get_window_size(struct client *, u_int, u_int *, u_int *); |
4047 | | void control_clear_window_size(struct client *, u_int); |
4048 | | struct window_pane_offset *control_pane_offset(struct client *, |
4049 | | struct window_pane *, int *); |
4050 | | void control_reset_offsets(struct client *); |
4051 | | void printflike(2, 3) control_write(struct client *, const char *, ...); |
4052 | | void printflike(2, 3) control_notify_write(struct client *, const char *, ...); |
4053 | | void control_write_guard(struct client *, const char *, long, u_int, int); |
4054 | | void control_write_output(struct client *, struct window_pane *); |
4055 | | int control_all_done(struct client *); |
4056 | | void control_add_sub(struct client *, const char *, enum monitor_type, int, |
4057 | | const char *); |
4058 | | void control_remove_sub(struct client *, const char *); |
4059 | | |
4060 | | /* control-notify.c */ |
4061 | | void control_build_events(void); |
4062 | | |
4063 | | /* session.c */ |
4064 | | extern struct sessions sessions; |
4065 | | extern struct session_groups session_groups; |
4066 | | extern u_int next_session_id; |
4067 | | int session_cmp(struct session *, struct session *); |
4068 | | RB_PROTOTYPE(sessions, session, entry, session_cmp); |
4069 | | int session_group_cmp(struct session_group *, struct session_group *s2); |
4070 | | RB_PROTOTYPE(session_groups, session_group, entry, session_group_cmp); |
4071 | | int session_alive(struct session *); |
4072 | | struct session *session_find(const char *); |
4073 | | struct session *session_find_by_id_str(const char *); |
4074 | | struct session *session_find_by_id(u_int); |
4075 | | struct session *session_create(const char *, const char *, const char *, |
4076 | | struct environ *, struct options *, struct termios *); |
4077 | | void session_destroy(struct session *, int, const char *); |
4078 | | void session_add_ref(struct session *, const char *); |
4079 | | void session_remove_ref(struct session *, const char *); |
4080 | | void session_update_activity(struct session *, struct timeval *); |
4081 | | struct session *session_next_session(struct session *, struct sort_criteria *); |
4082 | | struct session *session_previous_session(struct session *, |
4083 | | struct sort_criteria *); |
4084 | | struct winlink *session_attach(struct session *, struct window *, int, |
4085 | | char **); |
4086 | | int session_detach(struct session *, struct winlink *); |
4087 | | int session_has(struct session *, struct window *); |
4088 | | int session_is_linked(struct session *, struct window *); |
4089 | | int session_next(struct session *, int); |
4090 | | int session_previous(struct session *, int); |
4091 | | int session_select(struct session *, int); |
4092 | | int session_last(struct session *); |
4093 | | int session_set_current(struct session *, struct winlink *); |
4094 | | struct session_group *session_group_contains(struct session *); |
4095 | | struct session_group *session_group_find(const char *); |
4096 | | struct session_group *session_group_new(const char *); |
4097 | | void session_group_add(struct session_group *, struct session *); |
4098 | | void session_group_synchronize_to(struct session *); |
4099 | | void session_group_synchronize_from(struct session *); |
4100 | | u_int session_group_count(struct session_group *); |
4101 | | u_int session_group_attached_count(struct session_group *); |
4102 | | void session_renumber_windows(struct session *); |
4103 | | void session_theme_changed(struct session *); |
4104 | | void session_update_history(struct session *); |
4105 | | |
4106 | | /* utf8.c */ |
4107 | | enum utf8_state utf8_towc (const struct utf8_data *, wchar_t *); |
4108 | | enum utf8_state utf8_fromwc(wchar_t wc, struct utf8_data *); |
4109 | | void utf8_update_width_cache(void); |
4110 | | utf8_char utf8_build_one(u_char); |
4111 | | enum utf8_state utf8_from_data(const struct utf8_data *, utf8_char *); |
4112 | | void utf8_to_data(utf8_char, struct utf8_data *); |
4113 | | void utf8_set(struct utf8_data *, u_char); |
4114 | | void utf8_copy(struct utf8_data *, const struct utf8_data *); |
4115 | | enum utf8_state utf8_open(struct utf8_data *, u_char); |
4116 | | enum utf8_state utf8_append(struct utf8_data *, u_char); |
4117 | | int utf8_isvalid(const char *); |
4118 | | size_t utf8_strvis(char *, const char *, size_t, int); |
4119 | | size_t utf8_stravis(char **, const char *, int); |
4120 | | size_t utf8_stravisx(char **, const char *, size_t, int); |
4121 | | char *utf8_sanitize(const char *); |
4122 | | size_t utf8_strlen(const struct utf8_data *); |
4123 | | u_int utf8_strwidth(const struct utf8_data *, ssize_t); |
4124 | | struct utf8_data *utf8_fromcstr(const char *); |
4125 | | char *utf8_tocstr(struct utf8_data *); |
4126 | | u_int utf8_cstrwidth(const char *); |
4127 | | char *utf8_padcstr(const char *, u_int); |
4128 | | char *utf8_rpadcstr(const char *, u_int); |
4129 | | int utf8_cstrhas(const char *, const struct utf8_data *); |
4130 | | |
4131 | | /* osdep-*.c */ |
4132 | | char *osdep_get_name(int, char *); |
4133 | | char *osdep_get_cwd(int); |
4134 | | struct event_base *osdep_event_init(void); |
4135 | | |
4136 | | /* utf8-combined.c */ |
4137 | | int utf8_has_zwj(const struct utf8_data *); |
4138 | | int utf8_is_zwj(const struct utf8_data *); |
4139 | | int utf8_is_vs(const struct utf8_data *); |
4140 | | int utf8_is_hangul_filler(const struct utf8_data *); |
4141 | | int utf8_should_combine(const struct utf8_data *, |
4142 | | const struct utf8_data *); |
4143 | | enum hanguljamo_state hanguljamo_check_state(const struct utf8_data *, |
4144 | | const struct utf8_data *); |
4145 | | |
4146 | | /* log.c */ |
4147 | | void log_add_level(void); |
4148 | | int log_get_level(void); |
4149 | | void log_open(const char *); |
4150 | | void log_toggle(const char *); |
4151 | | void log_close(void); |
4152 | | void printflike(1, 2) log_debug(const char *, ...); |
4153 | | __dead void printflike(1, 2) fatal(const char *, ...); |
4154 | | __dead void printflike(1, 2) fatalx(const char *, ...); |
4155 | | |
4156 | | /* menu.c */ |
4157 | 0 | #define MENU_NOMOUSE 0x1 |
4158 | 0 | #define MENU_TAB 0x2 |
4159 | 0 | #define MENU_STAYOPEN 0x4 |
4160 | | struct menu *menu_create(const char *); |
4161 | | void menu_add_items(struct menu *, const struct menu_item *, |
4162 | | struct cmdq_item *, struct client *, |
4163 | | struct cmd_find_state *); |
4164 | | void menu_add_item(struct menu *, const struct menu_item *, |
4165 | | struct cmdq_item *, struct client *, |
4166 | | struct cmd_find_state *); |
4167 | | void menu_free(struct menu *); |
4168 | | int menu_display(struct menu *, int, int, struct cmdq_item *, |
4169 | | u_int, u_int, struct client *, enum box_lines, const char *, |
4170 | | const char *, const char *, struct cmd_find_state *, |
4171 | | menu_choice_cb, void *); |
4172 | | void menu_close(struct window *); |
4173 | | void menu_destroy(struct window *); |
4174 | | void menu_update(struct menu_data *); |
4175 | | struct screen *menu_screen(struct menu_data *); |
4176 | | u_int menu_width(struct menu_data *); |
4177 | | u_int menu_height(struct menu_data *); |
4178 | | u_int menu_x(struct menu_data *); |
4179 | | u_int menu_y(struct menu_data *); |
4180 | | void menu_get_cursor(struct menu_data *, u_int *, u_int *); |
4181 | | void menu_resize(struct menu_data *, struct window *); |
4182 | | int menu_key(struct client *, struct menu_data *, struct key_event *); |
4183 | | |
4184 | | /* popup.c */ |
4185 | 0 | #define POPUP_CLOSEEXIT 0x1 |
4186 | 0 | #define POPUP_CLOSEEXITZERO 0x2 |
4187 | 0 | #define POPUP_CLOSEANYKEY 0x4 |
4188 | | typedef void (*popup_close_cb)(int, void *); |
4189 | | int popup_display(int, enum box_lines, struct cmdq_item *, u_int, |
4190 | | u_int, u_int, u_int, struct environ *, const char *, int, |
4191 | | char **, const char *, const char *, struct client *, |
4192 | | struct session *, const char *, const char *, |
4193 | | popup_close_cb, void *); |
4194 | | int popup_present(struct client *); |
4195 | | int popup_modify(struct client *, const char *, const char *, |
4196 | | const char *, enum box_lines, int); |
4197 | | |
4198 | | /* style.c */ |
4199 | | int style_parse(struct style *,const struct grid_cell *, |
4200 | | const char *); |
4201 | | int style_parse_colour(struct style *, |
4202 | | const struct grid_cell *, const char *); |
4203 | | const char *style_tostring(struct style *); |
4204 | | const char *style_link(struct style *); |
4205 | | struct style *style_add(struct grid_cell *, struct options *, |
4206 | | const char *, struct format_tree *); |
4207 | | void style_apply(struct grid_cell *, struct options *, |
4208 | | const char *, struct format_tree *); |
4209 | | void style_set(struct style *, const struct grid_cell *); |
4210 | | void style_copy(struct style *, struct style *); |
4211 | | void style_set_scrollbar_style_from_option(struct style *, |
4212 | | struct options *); |
4213 | | void style_ranges_init(struct style_ranges *); |
4214 | | void style_ranges_free(struct style_ranges *); |
4215 | | struct style_range *style_ranges_get_range(struct style_ranges *, u_int); |
4216 | | |
4217 | | /* spawn.c */ |
4218 | | struct winlink *spawn_window(struct spawn_context *, char **); |
4219 | | struct window_pane *spawn_pane(struct spawn_context *, char **); |
4220 | | typedef void (*spawn_finish_edit_cb)(char *, size_t, void *); |
4221 | | struct spawn_editor_state *spawn_editor(struct client *, const char *, size_t, |
4222 | | spawn_finish_edit_cb, void *); |
4223 | | void spawn_cancel_editor(struct spawn_editor_state *); |
4224 | | pid_t spawn_get_editor_pid(struct spawn_editor_state *); |
4225 | | void spawn_editor_finish(struct window_pane *); |
4226 | | |
4227 | | /* regsub.c */ |
4228 | | char *regsub(const char *, const char *, const char *, int); |
4229 | | |
4230 | | #ifdef ENABLE_SIXEL |
4231 | | /* image.c */ |
4232 | | int image_free_all(struct screen *); |
4233 | | struct image *image_store(struct screen *, struct sixel_image *); |
4234 | | int image_check_line(struct screen *, u_int, u_int); |
4235 | | int image_check_area(struct screen *, u_int, u_int, u_int, u_int); |
4236 | | int image_scroll_up(struct screen *, u_int); |
4237 | | |
4238 | | /* image-sixel.c */ |
4239 | | #define SIXEL_COLOUR_REGISTERS 1024 |
4240 | | struct sixel_image *sixel_parse(const char *, size_t, u_int, u_int, u_int); |
4241 | | void sixel_free(struct sixel_image *); |
4242 | | void sixel_log(struct sixel_image *); |
4243 | | void sixel_size_in_cells(struct sixel_image *, u_int *, u_int *); |
4244 | | struct sixel_image *sixel_scale(struct sixel_image *, u_int, u_int, u_int, |
4245 | | u_int, u_int, u_int, int); |
4246 | | char *sixel_print(struct sixel_image *, struct sixel_image *, |
4247 | | size_t *); |
4248 | | struct screen *sixel_to_screen(struct sixel_image *); |
4249 | | #endif |
4250 | | |
4251 | | /* server-acl.c */ |
4252 | 0 | #define SERVER_ACL_READONLY 0x1 |
4253 | 0 | #define SERVER_ACL_IS_GROUP 0x2 |
4254 | | void server_acl_init(void); |
4255 | | int server_acl_find(id_t, int); |
4256 | | void server_acl_display(struct cmdq_item *); |
4257 | | void server_acl_allow(id_t, int); |
4258 | | void server_acl_deny(id_t, int); |
4259 | | void server_acl_allow_write(id_t, int); |
4260 | | void server_acl_deny_write(id_t, int); |
4261 | | int server_acl_join(struct client *); |
4262 | | |
4263 | | /* hyperlink.c */ |
4264 | | u_int hyperlinks_put(struct hyperlinks *, const char *, |
4265 | | const char *); |
4266 | | int hyperlinks_get(struct hyperlinks *, u_int, |
4267 | | const char **, const char **, const char **); |
4268 | | struct hyperlinks *hyperlinks_init(void); |
4269 | | struct hyperlinks *hyperlinks_copy(struct hyperlinks *); |
4270 | | void hyperlinks_reset(struct hyperlinks *); |
4271 | | void hyperlinks_free(struct hyperlinks *); |
4272 | | |
4273 | | #endif /* TMUX_H */ |