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