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