Annotation of src/usr.bin/tmux/tmux.h, Revision 1.703
1.703 ! nicm 1: /* $OpenBSD: tmux.h,v 1.702 2017/01/23 10:09:43 nicm Exp $ */
1.1 nicm 2:
3: /*
1.617 nicm 4: * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
1.1 nicm 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:
1.423 nicm 22: #define PROTOCOL_VERSION 8
1.1 nicm 23:
24: #include <sys/time.h>
25: #include <sys/queue.h>
26: #include <sys/tree.h>
27:
1.6 nicm 28: #include <bitstring.h>
1.159 nicm 29: #include <event.h>
1.1 nicm 30: #include <limits.h>
31: #include <stdarg.h>
32: #include <stdint.h>
33: #include <stdio.h>
34: #include <termios.h>
1.621 nicm 35: #include <wchar.h>
1.1 nicm 36:
1.583 nicm 37: #include "xmalloc.h"
38:
1.73 nicm 39: extern char **environ;
1.1 nicm 40:
1.652 nicm 41: struct args;
1.568 nicm 42: struct client;
1.668 nicm 43: struct cmdq_item;
44: struct cmdq_list;
1.568 nicm 45: struct environ;
46: struct input_ctx;
1.655 nicm 47: struct mode_key_cmdstr;
1.568 nicm 48: struct mouse_event;
49: struct options;
1.699 nicm 50: struct options_entry;
1.568 nicm 51: struct session;
52: struct tmuxpeer;
53: struct tmuxproc;
54:
1.409 nicm 55: /* Default global configuration file. */
56: #define TMUX_CONF "/etc/tmux.conf"
1.1 nicm 57:
1.195 nicm 58: /*
1.39 nicm 59: * Minimum layout cell size, NOT including separator line. The scroll region
60: * cannot be one line in height so this must be at least two.
61: */
62: #define PANE_MINIMUM 2
1.1 nicm 63:
1.540 nicm 64: /* Automatic name refresh interval, in microseconds. Must be < 1 second. */
65: #define NAME_INTERVAL 500000
1.152 nicm 66:
1.645 nicm 67: /*
68: * Event watermarks. We start with FAST then if we hit full size for HITS reads
69: * in succession switch to SLOW, and return when we hit EMPTY the same number
70: * of times.
71: */
72: #define READ_FAST_SIZE 4096
73: #define READ_SLOW_SIZE 128
74:
75: #define READ_FULL_SIZE (4096 - 16)
76: #define READ_EMPTY_SIZE 16
77:
78: #define READ_CHANGE_HITS 3
1.1 nicm 79:
1.686 nicm 80: /* Attribute to make GCC check printf-like arguments. */
1.476 nicm 81: #define printflike(a, b) __attribute__ ((format (printf, a, b)))
1.1 nicm 82:
83: /* Number of items in array. */
1.14 nicm 84: #ifndef nitems
1.1 nicm 85: #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
1.14 nicm 86: #endif
1.335 nicm 87:
1.1 nicm 88: /* Bell option values. */
89: #define BELL_NONE 0
90: #define BELL_ANY 1
91: #define BELL_CURRENT 2
1.513 nicm 92: #define BELL_OTHER 3
1.1 nicm 93:
1.174 nicm 94: /* Special key codes. */
1.571 nicm 95: #define KEYC_NONE 0xffff00000000ULL
1.601 nicm 96: #define KEYC_UNKNOWN 0xfffe00000000ULL
1.675 nicm 97: #define KEYC_BASE 0x000010000000ULL
1.174 nicm 98:
99: /* Key modifier bits. */
1.571 nicm 100: #define KEYC_ESCAPE 0x200000000000ULL
101: #define KEYC_CTRL 0x400000000000ULL
102: #define KEYC_SHIFT 0x800000000000ULL
1.225 nicm 103:
1.275 nicm 104: /* Mask to obtain key w/o modifiers. */
1.493 nicm 105: #define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT)
1.225 nicm 106: #define KEYC_MASK_KEY (~KEYC_MASK_MOD)
1.41 nicm 107:
1.492 nicm 108: /* Is this a mouse key? */
109: #define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
110: ((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
111:
1.653 nicm 112: /* Multiple click timeout. */
113: #define KEYC_CLICK_TIMEOUT 300
114:
1.492 nicm 115: /* Mouse key codes. */
116: #define KEYC_MOUSE_KEY(name) \
117: KEYC_ ## name ## _PANE, \
118: KEYC_ ## name ## _STATUS, \
119: KEYC_ ## name ## _BORDER
120: #define KEYC_MOUSE_STRING(name, s) \
121: { #s "Pane", KEYC_ ## name ## _PANE }, \
122: { #s "Status", KEYC_ ## name ## _STATUS }, \
123: { #s "Border", KEYC_ ## name ## _BORDER }
124:
1.571 nicm 125: /*
126: * A single key. This can be ASCII or Unicode or one of the keys starting at
127: * KEYC_BASE.
128: */
1.580 nicm 129: typedef unsigned long long key_code;
1.571 nicm 130:
1.492 nicm 131: /* Special key codes. */
1.571 nicm 132: enum {
1.492 nicm 133: /* Focus events. */
134: KEYC_FOCUS_IN = KEYC_BASE,
135: KEYC_FOCUS_OUT,
136:
137: /* Mouse keys. */
138: KEYC_MOUSE, /* unclassified mouse event */
1.681 nicm 139: KEYC_DRAGGING, /* dragging in progress */
1.492 nicm 140: KEYC_MOUSE_KEY(MOUSEDOWN1),
141: KEYC_MOUSE_KEY(MOUSEDOWN2),
142: KEYC_MOUSE_KEY(MOUSEDOWN3),
143: KEYC_MOUSE_KEY(MOUSEUP1),
144: KEYC_MOUSE_KEY(MOUSEUP2),
145: KEYC_MOUSE_KEY(MOUSEUP3),
146: KEYC_MOUSE_KEY(MOUSEDRAG1),
147: KEYC_MOUSE_KEY(MOUSEDRAG2),
148: KEYC_MOUSE_KEY(MOUSEDRAG3),
1.623 nicm 149: KEYC_MOUSE_KEY(MOUSEDRAGEND1),
150: KEYC_MOUSE_KEY(MOUSEDRAGEND2),
151: KEYC_MOUSE_KEY(MOUSEDRAGEND3),
1.492 nicm 152: KEYC_MOUSE_KEY(WHEELUP),
153: KEYC_MOUSE_KEY(WHEELDOWN),
1.653 nicm 154: KEYC_MOUSE_KEY(DOUBLECLICK1),
155: KEYC_MOUSE_KEY(DOUBLECLICK2),
156: KEYC_MOUSE_KEY(DOUBLECLICK3),
157: KEYC_MOUSE_KEY(TRIPLECLICK1),
158: KEYC_MOUSE_KEY(TRIPLECLICK2),
159: KEYC_MOUSE_KEY(TRIPLECLICK3),
1.56 nicm 160:
161: /* Backspace key. */
162: KEYC_BSPACE,
1.41 nicm 163:
164: /* Function keys. */
165: KEYC_F1,
166: KEYC_F2,
167: KEYC_F3,
168: KEYC_F4,
169: KEYC_F5,
170: KEYC_F6,
171: KEYC_F7,
172: KEYC_F8,
173: KEYC_F9,
174: KEYC_F10,
175: KEYC_F11,
176: KEYC_F12,
177: KEYC_IC,
178: KEYC_DC,
179: KEYC_HOME,
180: KEYC_END,
181: KEYC_NPAGE,
182: KEYC_PPAGE,
183: KEYC_BTAB,
184:
185: /* Arrow keys. */
186: KEYC_UP,
187: KEYC_DOWN,
188: KEYC_LEFT,
189: KEYC_RIGHT,
190:
1.148 nicm 191: /* Numeric keypad. */
192: KEYC_KP_SLASH,
193: KEYC_KP_STAR,
194: KEYC_KP_MINUS,
195: KEYC_KP_SEVEN,
196: KEYC_KP_EIGHT,
197: KEYC_KP_NINE,
198: KEYC_KP_PLUS,
199: KEYC_KP_FOUR,
200: KEYC_KP_FIVE,
201: KEYC_KP_SIX,
202: KEYC_KP_ONE,
203: KEYC_KP_TWO,
204: KEYC_KP_THREE,
205: KEYC_KP_ENTER,
206: KEYC_KP_ZERO,
207: KEYC_KP_PERIOD,
1.41 nicm 208: };
1.1 nicm 209:
210: /* Termcap codes. */
211: enum tty_code_code {
212: TTYC_AX = 0,
213: TTYC_ACSC, /* acs_chars, ac */
1.491 nicm 214: TTYC_BCE, /* back_color_erase, ut */
1.1 nicm 215: TTYC_BEL, /* bell, bl */
216: TTYC_BLINK, /* enter_blink_mode, mb */
217: TTYC_BOLD, /* enter_bold_mode, md */
218: TTYC_CIVIS, /* cursor_invisible, vi */
219: TTYC_CLEAR, /* clear_screen, cl */
220: TTYC_CNORM, /* cursor_normal, ve */
221: TTYC_COLORS, /* max_colors, Co */
1.287 nicm 222: TTYC_CR, /* restore cursor colour, Cr */
1.411 nicm 223: TTYC_CS, /* set cursor colour, Cs */
1.1 nicm 224: TTYC_CSR, /* change_scroll_region, cs */
1.135 nicm 225: TTYC_CUB, /* parm_left_cursor, LE */
226: TTYC_CUB1, /* cursor_left, le */
1.1 nicm 227: TTYC_CUD, /* parm_down_cursor, DO */
228: TTYC_CUD1, /* cursor_down, do */
1.135 nicm 229: TTYC_CUF, /* parm_right_cursor, RI */
230: TTYC_CUF1, /* cursor_right, nd */
1.1 nicm 231: TTYC_CUP, /* cursor_address, cm */
1.135 nicm 232: TTYC_CUU, /* parm_up_cursor, UP */
233: TTYC_CUU1, /* cursor_up, up */
1.485 nicm 234: TTYC_CVVIS, /* cursor_visible, vs */
1.1 nicm 235: TTYC_DCH, /* parm_dch, DC */
236: TTYC_DCH1, /* delete_character, dc */
237: TTYC_DIM, /* enter_dim_mode, mh */
238: TTYC_DL, /* parm_delete_line, DL */
239: TTYC_DL1, /* delete_line, dl */
1.297 nicm 240: TTYC_E3,
1.371 nicm 241: TTYC_ECH, /* erase_chars, ec */
1.1 nicm 242: TTYC_EL, /* clr_eol, ce */
243: TTYC_EL1, /* clr_bol, cb */
244: TTYC_ENACS, /* ena_acs, eA */
1.283 nicm 245: TTYC_FSL, /* from_status_line, fsl */
1.135 nicm 246: TTYC_HOME, /* cursor_home, ho */
247: TTYC_HPA, /* column_address, ch */
1.1 nicm 248: TTYC_ICH, /* parm_ich, IC */
249: TTYC_ICH1, /* insert_character, ic */
250: TTYC_IL, /* parm_insert_line, IL */
251: TTYC_IL1, /* insert_line, il */
252: TTYC_INVIS, /* enter_secure_mode, mk */
253: TTYC_IS1, /* init_1string, i1 */
254: TTYC_IS2, /* init_2string, i2 */
255: TTYC_IS3, /* init_3string, i3 */
256: TTYC_KCBT, /* key_btab, kB */
257: TTYC_KCUB1, /* key_left, kl */
258: TTYC_KCUD1, /* key_down, kd */
259: TTYC_KCUF1, /* key_right, kr */
260: TTYC_KCUU1, /* key_up, ku */
1.149 nicm 261: TTYC_KDC2,
262: TTYC_KDC3,
263: TTYC_KDC4,
264: TTYC_KDC5,
265: TTYC_KDC6,
266: TTYC_KDC7,
1.1 nicm 267: TTYC_KDCH1, /* key_dc, kD */
1.149 nicm 268: TTYC_KDN2,
269: TTYC_KDN3,
270: TTYC_KDN4,
271: TTYC_KDN5,
272: TTYC_KDN6,
273: TTYC_KDN7,
1.1 nicm 274: TTYC_KEND, /* key_end, ke */
1.149 nicm 275: TTYC_KEND2,
276: TTYC_KEND3,
277: TTYC_KEND4,
278: TTYC_KEND5,
279: TTYC_KEND6,
280: TTYC_KEND7,
1.466 nicm 281: TTYC_KF1,
282: TTYC_KF10,
283: TTYC_KF11,
284: TTYC_KF12,
285: TTYC_KF13,
286: TTYC_KF14,
287: TTYC_KF15,
288: TTYC_KF16,
289: TTYC_KF17,
290: TTYC_KF18,
291: TTYC_KF19,
292: TTYC_KF2,
293: TTYC_KF20,
294: TTYC_KF21,
295: TTYC_KF22,
296: TTYC_KF23,
297: TTYC_KF24,
298: TTYC_KF25,
299: TTYC_KF26,
300: TTYC_KF27,
301: TTYC_KF28,
302: TTYC_KF29,
303: TTYC_KF3,
304: TTYC_KF30,
305: TTYC_KF31,
306: TTYC_KF32,
307: TTYC_KF33,
308: TTYC_KF34,
309: TTYC_KF35,
310: TTYC_KF36,
311: TTYC_KF37,
312: TTYC_KF38,
313: TTYC_KF39,
314: TTYC_KF4,
315: TTYC_KF40,
316: TTYC_KF41,
317: TTYC_KF42,
318: TTYC_KF43,
319: TTYC_KF44,
320: TTYC_KF45,
321: TTYC_KF46,
322: TTYC_KF47,
323: TTYC_KF48,
324: TTYC_KF49,
325: TTYC_KF5,
326: TTYC_KF50,
327: TTYC_KF51,
328: TTYC_KF52,
329: TTYC_KF53,
330: TTYC_KF54,
331: TTYC_KF55,
332: TTYC_KF56,
333: TTYC_KF57,
334: TTYC_KF58,
335: TTYC_KF59,
336: TTYC_KF6,
337: TTYC_KF60,
338: TTYC_KF61,
339: TTYC_KF62,
340: TTYC_KF63,
341: TTYC_KF7,
342: TTYC_KF8,
343: TTYC_KF9,
1.149 nicm 344: TTYC_KHOM2,
345: TTYC_KHOM3,
346: TTYC_KHOM4,
347: TTYC_KHOM5,
348: TTYC_KHOM6,
349: TTYC_KHOM7,
1.1 nicm 350: TTYC_KHOME, /* key_home, kh */
1.149 nicm 351: TTYC_KIC2,
352: TTYC_KIC3,
353: TTYC_KIC4,
354: TTYC_KIC5,
355: TTYC_KIC6,
356: TTYC_KIC7,
1.1 nicm 357: TTYC_KICH1, /* key_ic, kI */
1.149 nicm 358: TTYC_KLFT2,
359: TTYC_KLFT3,
360: TTYC_KLFT4,
361: TTYC_KLFT5,
362: TTYC_KLFT6,
363: TTYC_KLFT7,
1.1 nicm 364: TTYC_KMOUS, /* key_mouse, Km */
365: TTYC_KNP, /* key_npage, kN */
1.149 nicm 366: TTYC_KNXT2,
367: TTYC_KNXT3,
368: TTYC_KNXT4,
369: TTYC_KNXT5,
370: TTYC_KNXT6,
371: TTYC_KNXT7,
1.1 nicm 372: TTYC_KPP, /* key_ppage, kP */
1.149 nicm 373: TTYC_KPRV2,
374: TTYC_KPRV3,
375: TTYC_KPRV4,
376: TTYC_KPRV5,
377: TTYC_KPRV6,
378: TTYC_KPRV7,
379: TTYC_KRIT2,
380: TTYC_KRIT3,
381: TTYC_KRIT4,
382: TTYC_KRIT5,
383: TTYC_KRIT6,
384: TTYC_KRIT7,
385: TTYC_KUP2,
386: TTYC_KUP3,
387: TTYC_KUP4,
388: TTYC_KUP5,
389: TTYC_KUP6,
390: TTYC_KUP7,
1.286 nicm 391: TTYC_MS, /* modify xterm(1) selection */
1.1 nicm 392: TTYC_OP, /* orig_pair, op */
393: TTYC_REV, /* enter_reverse_mode, mr */
394: TTYC_RI, /* scroll_reverse, sr */
395: TTYC_RMACS, /* exit_alt_charset_mode */
396: TTYC_RMCUP, /* exit_ca_mode, te */
397: TTYC_RMKX, /* keypad_local, ke */
1.411 nicm 398: TTYC_SE, /* reset cursor style, Se */
1.1 nicm 399: TTYC_SETAB, /* set_a_background, AB */
400: TTYC_SETAF, /* set_a_foreground, AF */
401: TTYC_SGR0, /* exit_attribute_mode, me */
1.283 nicm 402: TTYC_SITM, /* enter_italics_mode, it */
1.1 nicm 403: TTYC_SMACS, /* enter_alt_charset_mode, as */
404: TTYC_SMCUP, /* enter_ca_mode, ti */
405: TTYC_SMKX, /* keypad_xmit, ks */
406: TTYC_SMSO, /* enter_standout_mode, so */
407: TTYC_SMUL, /* enter_underline_mode, us */
1.411 nicm 408: TTYC_SS, /* set cursor style, Ss */
1.619 nicm 409: TTYC_TC, /* 24-bit "true" colour, Tc */
1.283 nicm 410: TTYC_TSL, /* to_status_line, tsl */
1.135 nicm 411: TTYC_VPA, /* row_address, cv */
1.1 nicm 412: TTYC_XENL, /* eat_newline_glitch, xn */
1.283 nicm 413: TTYC_XT, /* xterm(1)-compatible title, XT */
1.1 nicm 414: };
415:
416: /* Message codes. */
1.64 nicm 417: enum msgtype {
1.423 nicm 418: MSG_VERSION = 12,
419:
420: MSG_IDENTIFY_FLAGS = 100,
421: MSG_IDENTIFY_TERM,
422: MSG_IDENTIFY_TTYNAME,
1.563 nicm 423: MSG_IDENTIFY_OLDCWD, /* unused */
1.423 nicm 424: MSG_IDENTIFY_STDIN,
425: MSG_IDENTIFY_ENVIRON,
426: MSG_IDENTIFY_DONE,
1.523 nicm 427: MSG_IDENTIFY_CLIENTPID,
1.563 nicm 428: MSG_IDENTIFY_CWD,
1.423 nicm 429:
430: MSG_COMMAND = 200,
1.1 nicm 431: MSG_DETACH,
1.423 nicm 432: MSG_DETACHKILL,
1.1 nicm 433: MSG_EXIT,
434: MSG_EXITED,
435: MSG_EXITING,
1.423 nicm 436: MSG_LOCK,
1.1 nicm 437: MSG_READY,
438: MSG_RESIZE,
1.423 nicm 439: MSG_SHELL,
1.1 nicm 440: MSG_SHUTDOWN,
1.423 nicm 441: MSG_STDERR,
442: MSG_STDIN,
443: MSG_STDOUT,
1.1 nicm 444: MSG_SUSPEND,
1.423 nicm 445: MSG_UNLOCK,
1.1 nicm 446: MSG_WAKEUP,
1.694 nicm 447: MSG_EXEC,
1.1 nicm 448: };
449:
1.55 nicm 450: /*
1.75 nicm 451: * Message data.
1.55 nicm 452: *
453: * Don't forget to bump PROTOCOL_VERSION if any of these change!
454: */
1.1 nicm 455: struct msg_command_data {
1.427 nicm 456: int argc;
457: }; /* followed by packed argv */
1.1 nicm 458:
1.332 nicm 459: struct msg_stdin_data {
460: ssize_t size;
461: char data[BUFSIZ];
462: };
463:
464: struct msg_stdout_data {
465: ssize_t size;
466: char data[BUFSIZ];
467: };
468:
469: struct msg_stderr_data {
470: ssize_t size;
471: char data[BUFSIZ];
472: };
473:
1.62 nicm 474: /* Mode key commands. */
1.1 nicm 475: enum mode_key_cmd {
1.59 nicm 476: MODEKEY_NONE,
477: MODEKEY_OTHER,
478:
479: /* Menu (choice) keys. */
1.350 nicm 480: MODEKEYCHOICE_BACKSPACE,
1.439 nicm 481: MODEKEYCHOICE_BOTTOMLINE,
1.59 nicm 482: MODEKEYCHOICE_CANCEL,
483: MODEKEYCHOICE_CHOOSE,
484: MODEKEYCHOICE_DOWN,
1.439 nicm 485: MODEKEYCHOICE_ENDOFLIST,
1.59 nicm 486: MODEKEYCHOICE_PAGEDOWN,
487: MODEKEYCHOICE_PAGEUP,
1.201 nicm 488: MODEKEYCHOICE_SCROLLDOWN,
489: MODEKEYCHOICE_SCROLLUP,
1.350 nicm 490: MODEKEYCHOICE_STARTNUMBERPREFIX,
1.439 nicm 491: MODEKEYCHOICE_STARTOFLIST,
492: MODEKEYCHOICE_TOPLINE,
1.359 nicm 493: MODEKEYCHOICE_TREE_COLLAPSE,
494: MODEKEYCHOICE_TREE_COLLAPSE_ALL,
495: MODEKEYCHOICE_TREE_EXPAND,
496: MODEKEYCHOICE_TREE_EXPAND_ALL,
497: MODEKEYCHOICE_TREE_TOGGLE,
1.59 nicm 498: MODEKEYCHOICE_UP,
1.1 nicm 499: };
500:
1.62 nicm 501: /* Data required while mode keys are in use. */
1.1 nicm 502: struct mode_key_data {
1.62 nicm 503: struct mode_key_tree *tree;
1.1 nicm 504: };
505: #define MODEKEY_EMACS 0
506: #define MODEKEY_VI 1
507:
1.62 nicm 508: /* Binding between a key and a command. */
509: struct mode_key_binding {
1.571 nicm 510: key_code key;
1.389 nicm 511: enum mode_key_cmd cmd;
1.62 nicm 512:
1.389 nicm 513: RB_ENTRY(mode_key_binding) entry;
1.62 nicm 514: };
1.306 nicm 515: RB_HEAD(mode_key_tree, mode_key_binding);
1.62 nicm 516:
517: /* Named mode key table description. */
1.509 nicm 518: struct mode_key_entry;
1.62 nicm 519: struct mode_key_table {
1.261 nicm 520: const char *name;
521: const struct mode_key_cmdstr *cmdstr;
522: struct mode_key_tree *tree;
523: const struct mode_key_entry *table; /* default entries */
1.62 nicm 524: };
525:
1.1 nicm 526: /* Modes. */
527: #define MODE_CURSOR 0x1
528: #define MODE_INSERT 0x2
529: #define MODE_KCURSOR 0x4
1.185 nicm 530: #define MODE_KKEYPAD 0x8 /* set = application, clear = number */
1.255 nicm 531: #define MODE_WRAP 0x10 /* whether lines wrap */
532: #define MODE_MOUSE_STANDARD 0x20
1.266 nicm 533: #define MODE_MOUSE_BUTTON 0x40
1.485 nicm 534: #define MODE_BLINKING 0x80
1.586 nicm 535: #define MODE_MOUSE_UTF8 0x100
1.384 nicm 536: #define MODE_MOUSE_SGR 0x200
537: #define MODE_BRACKETPASTE 0x400
1.393 nicm 538: #define MODE_FOCUSON 0x800
1.255 nicm 539:
1.467 nicm 540: #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON)
1.1 nicm 541:
1.580 nicm 542: /*
543: * A single UTF-8 character. UTF8_SIZE must be big enough to hold at least one
544: * combining character as well.
545: */
546: #define UTF8_SIZE 9
1.143 nicm 547: struct utf8_data {
548: u_char data[UTF8_SIZE];
549:
1.576 nicm 550: u_char have;
551: u_char size;
1.143 nicm 552:
1.578 nicm 553: u_char width; /* 0xff if invalid */
1.576 nicm 554: } __packed;
1.579 nicm 555: enum utf8_state {
556: UTF8_MORE,
557: UTF8_DONE,
558: UTF8_ERROR
559: };
1.1 nicm 560:
1.637 nicm 561: /* Colour flags. */
562: #define COLOUR_FLAG_256 0x01000000
563: #define COLOUR_FLAG_RGB 0x02000000
564:
1.1 nicm 565: /* Grid attributes. */
566: #define GRID_ATTR_BRIGHT 0x1
567: #define GRID_ATTR_DIM 0x2
568: #define GRID_ATTR_UNDERSCORE 0x4
569: #define GRID_ATTR_BLINK 0x8
570: #define GRID_ATTR_REVERSE 0x10
571: #define GRID_ATTR_HIDDEN 0x20
572: #define GRID_ATTR_ITALICS 0x40
573: #define GRID_ATTR_CHARSET 0x80 /* alternative character set */
574:
575: /* Grid flags. */
576: #define GRID_FLAG_FG256 0x1
577: #define GRID_FLAG_BG256 0x2
578: #define GRID_FLAG_PADDING 0x4
1.576 nicm 579: #define GRID_FLAG_EXTENDED 0x8
1.637 nicm 580: #define GRID_FLAG_SELECTED 0x10
1.685 nicm 581: #define GRID_FLAG_NOPALETTE 0x20
1.1 nicm 582:
1.72 nicm 583: /* Grid line flags. */
584: #define GRID_LINE_WRAPPED 0x1
1.638 nicm 585: #define GRID_LINE_EXTENDED 0x2
1.72 nicm 586:
1.1 nicm 587: /* Grid cell data. */
588: struct grid_cell {
1.576 nicm 589: u_char flags;
590: u_char attr;
1.637 nicm 591: int fg;
592: int bg;
1.576 nicm 593: struct utf8_data data;
594:
595: };
596: struct grid_cell_entry {
597: u_char flags;
598: union {
599: u_int offset;
600: struct {
601: u_char attr;
602: u_char fg;
603: u_char bg;
604: u_char data;
605: } data;
606: };
1.1 nicm 607: } __packed;
608:
1.71 nicm 609: /* Grid line. */
610: struct grid_line {
1.661 nicm 611: u_int cellused;
1.576 nicm 612: u_int cellsize;
613: struct grid_cell_entry *celldata;
614:
615: u_int extdsize;
616: struct grid_cell *extddata;
1.71 nicm 617:
1.576 nicm 618: int flags;
1.71 nicm 619: } __packed;
620:
1.1 nicm 621: /* Entire grid of cells. */
622: struct grid {
1.576 nicm 623: int flags;
624: #define GRID_HISTORY 0x1 /* scroll lines into history */
1.25 nicm 625:
1.576 nicm 626: u_int sx;
627: u_int sy;
1.1 nicm 628:
1.642 nicm 629: u_int hscrolled;
1.576 nicm 630: u_int hsize;
631: u_int hlimit;
1.1 nicm 632:
1.576 nicm 633: struct grid_line *linedata;
1.1 nicm 634: };
635:
1.595 nicm 636: /* Hook data structures. */
637: struct hook {
1.596 nicm 638: const char *name;
639:
640: struct cmd_list *cmdlist;
641:
642: RB_ENTRY(hook) entry;
1.595 nicm 643: };
644:
1.126 nicm 645: /* Scheduled job. */
646: struct job {
1.525 nicm 647: enum {
648: JOB_RUNNING,
649: JOB_DEAD,
650: JOB_CLOSED
651: } state;
652:
1.126 nicm 653: char *cmd;
654: pid_t pid;
1.130 nicm 655: int status;
1.126 nicm 656:
657: int fd;
1.160 nicm 658: struct bufferevent *event;
1.126 nicm 659:
660: void (*callbackfn)(struct job *);
661: void (*freefn)(void *);
662: void *data;
1.130 nicm 663:
1.270 nicm 664: LIST_ENTRY(job) lentry;
1.126 nicm 665: };
1.270 nicm 666: LIST_HEAD(joblist, job);
1.126 nicm 667:
1.1 nicm 668: /* Screen selection. */
669: struct screen_sel {
670: int flag;
1.680 nicm 671: int hidden;
672:
1.204 nicm 673: int rectflag;
1.480 nicm 674: enum {
675: LINE_SEL_NONE,
676: LINE_SEL_LEFT_RIGHT,
677: LINE_SEL_RIGHT_LEFT,
678: } lineflag;
679:
1.469 nicm 680: int modekeys;
1.1 nicm 681:
682: u_int sx;
683: u_int sy;
684:
685: u_int ex;
686: u_int ey;
687:
688: struct grid_cell cell;
689: };
690:
691: /* Virtual screen. */
692: struct screen {
1.638 nicm 693: char *title;
694:
695: struct grid *grid; /* grid data */
1.1 nicm 696:
1.638 nicm 697: u_int cx; /* cursor x */
698: u_int cy; /* cursor y */
1.1 nicm 699:
1.638 nicm 700: u_int cstyle; /* cursor style */
701: char *ccolour; /* cursor colour string */
1.1 nicm 702:
1.638 nicm 703: u_int rupper; /* scroll region top */
1.661 nicm 704: u_int rlower; /* scroll region bottom */
1.287 nicm 705:
1.638 nicm 706: int mode;
1.1 nicm 707:
1.638 nicm 708: bitstr_t *tabs;
1.1 nicm 709:
1.638 nicm 710: bitstr_t *dirty;
711: u_int dirtysize;
1.6 nicm 712:
1.638 nicm 713: struct screen_sel sel;
1.1 nicm 714: };
715:
716: /* Screen write context. */
717: struct screen_write_ctx {
1.638 nicm 718: struct window_pane *wp;
719: struct screen *s;
720: u_int dirty;
721:
722: u_int cells;
723: u_int written;
724: u_int skipped;
1.1 nicm 725: };
726:
727: /* Screen size. */
728: #define screen_size_x(s) ((s)->grid->sx)
729: #define screen_size_y(s) ((s)->grid->sy)
730: #define screen_hsize(s) ((s)->grid->hsize)
731: #define screen_hlimit(s) ((s)->grid->hlimit)
732:
733: /*
734: * Window mode. Windows can be in several modes and this is used to call the
735: * right function to handle input and output.
736: */
737: struct window_mode {
738: struct screen *(*init)(struct window_pane *);
739: void (*free)(struct window_pane *);
740: void (*resize)(struct window_pane *, u_int, u_int);
1.492 nicm 741: void (*key)(struct window_pane *, struct client *, struct session *,
1.571 nicm 742: key_code, struct mouse_event *);
1.652 nicm 743:
744: const char *(*key_table)(struct window_pane *);
745: void (*command)(struct window_pane *, struct client *,
746: struct session *, struct args *, struct mouse_event *);
1.1 nicm 747: };
1.635 nicm 748: #define WINDOW_MODE_TIMEOUT 180
1.1 nicm 749:
1.343 nicm 750: /* Structures for choose mode. */
751: struct window_choose_data {
1.375 nicm 752: struct client *start_client;
753: struct session *start_session;
754:
1.343 nicm 755: u_int idx;
1.359 nicm 756: int type;
1.375 nicm 757: #define TREE_OTHER 0x0
1.359 nicm 758: #define TREE_WINDOW 0x1
759: #define TREE_SESSION 0x2
1.375 nicm 760:
761: struct session *tree_session; /* session of items in tree */
762:
763: struct winlink *wl;
1.355 nicm 764: int pane_id;
1.375 nicm 765:
1.511 nicm 766: char *ft_template;
1.375 nicm 767: struct format_tree *ft;
768:
769: char *command;
1.343 nicm 770: };
771:
1.1 nicm 772: /* Child window structure. */
773: struct window_pane {
1.274 nicm 774: u_int id;
1.458 nicm 775: u_int active_point;
1.274 nicm 776:
1.1 nicm 777: struct window *window;
1.398 nicm 778:
1.39 nicm 779: struct layout_cell *layout_cell;
1.398 nicm 780: struct layout_cell *saved_layout_cell;
1.1 nicm 781:
782: u_int sx;
783: u_int sy;
784:
785: u_int xoff;
786: u_int yoff;
787:
788: int flags;
1.28 nicm 789: #define PANE_REDRAW 0x1
1.325 nicm 790: #define PANE_DROP 0x2
1.393 nicm 791: #define PANE_FOCUSED 0x4
1.394 nicm 792: #define PANE_RESIZE 0x8
1.413 nicm 793: #define PANE_FOCUSPUSH 0x10
1.468 nicm 794: #define PANE_INPUTOFF 0x20
1.532 nicm 795: #define PANE_CHANGED 0x40
1.1 nicm 796:
1.463 nicm 797: int argc;
798: char **argv;
1.93 nicm 799: char *shell;
1.569 nicm 800: const char *cwd;
1.1 nicm 801:
802: pid_t pid;
1.159 nicm 803: char tty[TTY_NAME_MAX];
1.484 nicm 804: int status;
1.159 nicm 805:
1.1 nicm 806: int fd;
1.163 nicm 807: struct bufferevent *event;
1.646 nicm 808:
809: struct event resize_timer;
1.645 nicm 810:
811: u_int wmark_size;
812: u_int wmark_hits;
1.1 nicm 813:
1.507 nicm 814: struct input_ctx *ictx;
1.1 nicm 815:
1.491 nicm 816: struct grid_cell colgc;
817:
1.685 nicm 818: int *palette;
819:
1.131 nicm 820: int pipe_fd;
1.162 nicm 821: struct bufferevent *pipe_event;
1.131 nicm 822: size_t pipe_off;
823:
1.1 nicm 824: struct screen *screen;
825: struct screen base;
1.627 nicm 826:
827: struct screen status_screen;
828: size_t status_size;
1.1 nicm 829:
1.25 nicm 830: /* Saved in alternative screen mode. */
1.192 nicm 831: u_int saved_cx;
832: u_int saved_cy;
1.25 nicm 833: struct grid *saved_grid;
1.69 nicm 834: struct grid_cell saved_cell;
1.25 nicm 835:
1.1 nicm 836: const struct window_mode *mode;
837: void *modedata;
1.635 nicm 838: struct event modetimer;
839: time_t modelast;
1.652 nicm 840: u_int modeprefix;
1.1 nicm 841:
842: TAILQ_ENTRY(window_pane) entry;
1.274 nicm 843: RB_ENTRY(window_pane) tree_entry;
1.1 nicm 844: };
845: TAILQ_HEAD(window_panes, window_pane);
1.274 nicm 846: RB_HEAD(window_pane_tree, window_pane);
1.1 nicm 847:
848: /* Window structure. */
849: struct window {
1.309 nicm 850: u_int id;
1.540 nicm 851:
1.1 nicm 852: char *name;
1.540 nicm 853: struct event name_event;
854: struct timeval name_time;
855:
1.541 nicm 856: struct event alerts_timer;
857:
1.524 nicm 858: struct timeval activity_time;
1.1 nicm 859:
860: struct window_pane *active;
1.244 nicm 861: struct window_pane *last;
1.1 nicm 862: struct window_panes panes;
1.39 nicm 863:
1.61 nicm 864: int lastlayout;
1.39 nicm 865: struct layout_cell *layout_root;
1.398 nicm 866: struct layout_cell *saved_layout_root;
1.503 nicm 867: char *old_layout;
1.1 nicm 868:
869: u_int sx;
870: u_int sy;
871:
872: int flags;
873: #define WINDOW_BELL 0x1
1.247 nicm 874: #define WINDOW_ACTIVITY 0x2
875: #define WINDOW_REDRAW 0x4
1.248 nicm 876: #define WINDOW_SILENCE 0x8
1.481 nicm 877: #define WINDOW_ZOOMED 0x1000
878: #define WINDOW_FORCEWIDTH 0x2000
879: #define WINDOW_FORCEHEIGHT 0x4000
1.632 nicm 880: #define WINDOW_STYLECHANGED 0x8000
1.418 nicm 881: #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
1.1 nicm 882:
1.674 nicm 883: int alerts_queued;
884: TAILQ_ENTRY(window) alerts_entry;
885:
1.567 nicm 886: struct options *options;
1.632 nicm 887:
888: struct grid_cell style;
889: struct grid_cell active_style;
1.1 nicm 890:
891: u_int references;
1.674 nicm 892: TAILQ_HEAD(, winlink) winlinks;
1.496 nicm 893:
894: RB_ENTRY(window) entry;
1.1 nicm 895: };
1.496 nicm 896: RB_HEAD(windows, window);
1.1 nicm 897:
898: /* Entry on local window list. */
899: struct winlink {
900: int idx;
1.674 nicm 901: struct session *session;
1.1 nicm 902: struct window *window;
1.184 nicm 903:
904: size_t status_width;
905: struct grid_cell status_cell;
906: char *status_text;
1.1 nicm 907:
1.511 nicm 908: int flags;
1.226 nicm 909: #define WINLINK_BELL 0x1
910: #define WINLINK_ACTIVITY 0x2
1.451 nicm 911: #define WINLINK_SILENCE 0x4
912: #define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
1.226 nicm 913:
1.1 nicm 914: RB_ENTRY(winlink) entry;
1.674 nicm 915: TAILQ_ENTRY(winlink) wentry;
1.124 nicm 916: TAILQ_ENTRY(winlink) sentry;
1.1 nicm 917: };
918: RB_HEAD(winlinks, winlink);
1.124 nicm 919: TAILQ_HEAD(winlink_stack, winlink);
1.1 nicm 920:
1.39 nicm 921: /* Layout direction. */
922: enum layout_type {
923: LAYOUT_LEFTRIGHT,
924: LAYOUT_TOPBOTTOM,
925: LAYOUT_WINDOWPANE
926: };
927:
928: /* Layout cells queue. */
929: TAILQ_HEAD(layout_cells, layout_cell);
930:
931: /* Layout cell. */
932: struct layout_cell {
933: enum layout_type type;
934:
935: struct layout_cell *parent;
936:
937: u_int sx;
938: u_int sy;
939:
940: u_int xoff;
941: u_int yoff;
942:
943: struct window_pane *wp;
944: struct layout_cells cells;
945:
946: TAILQ_ENTRY(layout_cell) entry;
947: };
948:
1.73 nicm 949: /* Environment variable. */
950: struct environ_entry {
951: char *name;
952: char *value;
953:
954: RB_ENTRY(environ_entry) entry;
955: };
956:
1.1 nicm 957: /* Client session. */
1.124 nicm 958: struct session_group {
959: TAILQ_HEAD(, session) sessions;
960:
961: TAILQ_ENTRY(session_group) entry;
962: };
963: TAILQ_HEAD(session_groups, session_group);
964:
1.1 nicm 965: struct session {
1.402 nicm 966: u_int id;
1.254 nicm 967:
1.1 nicm 968: char *name;
1.569 nicm 969: const char *cwd;
1.156 nicm 970:
971: struct timeval creation_time;
1.555 nicm 972: struct timeval last_attached_time;
1.156 nicm 973: struct timeval activity_time;
1.370 nicm 974: struct timeval last_activity_time;
1.537 nicm 975:
976: struct event lock_timer;
1.1 nicm 977:
978: u_int sx;
979: u_int sy;
980:
981: struct winlink *curw;
982: struct winlink_stack lastw;
983: struct winlinks windows;
984:
1.595 nicm 985: struct hooks *hooks;
1.567 nicm 986: struct options *options;
1.1 nicm 987:
988: #define SESSION_UNATTACHED 0x1 /* not attached to any clients */
1.583 nicm 989: #define SESSION_PASTING 0x2
1.674 nicm 990: #define SESSION_ALERTED 0x4
1.1 nicm 991: int flags;
1.440 nicm 992:
1.511 nicm 993: u_int attached;
1.73 nicm 994:
1.105 nicm 995: struct termios *tio;
1.80 nicm 996:
1.568 nicm 997: struct environ *environ;
1.101 nicm 998:
999: int references;
1.124 nicm 1000:
1001: TAILQ_ENTRY(session) gentry;
1.254 nicm 1002: RB_ENTRY(session) entry;
1.1 nicm 1003: };
1.254 nicm 1004: RB_HEAD(sessions, session);
1.1 nicm 1005:
1.443 nicm 1006: /* Mouse button masks. */
1007: #define MOUSE_MASK_BUTTONS 3
1008: #define MOUSE_MASK_SHIFT 4
1009: #define MOUSE_MASK_META 8
1010: #define MOUSE_MASK_CTRL 16
1011: #define MOUSE_MASK_DRAG 32
1012: #define MOUSE_MASK_WHEEL 64
1013:
1.360 nicm 1014: /* Mouse wheel states. */
1015: #define MOUSE_WHEEL_UP 0
1.492 nicm 1016: #define MOUSE_WHEEL_DOWN 64
1.459 nicm 1017:
1.492 nicm 1018: /* Mouse helpers. */
1019: #define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
1020: #define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
1021: #define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
1022: #define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
1.360 nicm 1023:
1.492 nicm 1024: /* Mouse input. */
1025: struct mouse_event {
1.571 nicm 1026: int valid;
1.360 nicm 1027:
1.571 nicm 1028: key_code key;
1029: int statusat;
1.360 nicm 1030:
1.571 nicm 1031: u_int x;
1032: u_int y;
1033: u_int b;
1.360 nicm 1034:
1.571 nicm 1035: u_int lx;
1036: u_int ly;
1037: u_int lb;
1.360 nicm 1038:
1.571 nicm 1039: int s;
1040: int w;
1041: int wp;
1.384 nicm 1042:
1.571 nicm 1043: u_int sgr_type;
1044: u_int sgr_b;
1.360 nicm 1045: };
1046:
1.511 nicm 1047: /* TTY information. */
1048: struct tty_key {
1049: char ch;
1.571 nicm 1050: key_code key;
1.511 nicm 1051:
1052: struct tty_key *left;
1053: struct tty_key *right;
1054:
1055: struct tty_key *next;
1056: };
1057:
1.530 nicm 1058: struct tty_code;
1.511 nicm 1059: struct tty_term {
1060: char *name;
1061: u_int references;
1062:
1063: char acs[UCHAR_MAX + 1][2];
1064:
1.530 nicm 1065: struct tty_code *codes;
1.511 nicm 1066:
1067: #define TERM_256COLOURS 0x1
1068: #define TERM_EARLYWRAP 0x2
1069: int flags;
1070:
1071: LIST_ENTRY(tty_term) entry;
1072: };
1073: LIST_HEAD(tty_terms, tty_term);
1074:
1.1 nicm 1075: struct tty {
1.337 nicm 1076: struct client *client;
1.1 nicm 1077: char *path;
1078:
1.192 nicm 1079: u_int sx;
1080: u_int sy;
1.1 nicm 1081:
1082: u_int cx;
1083: u_int cy;
1.288 nicm 1084: u_int cstyle;
1.287 nicm 1085: char *ccolour;
1.1 nicm 1086:
1087: int mode;
1088:
1089: u_int rlower;
1090: u_int rupper;
1091:
1.676 nicm 1092: u_int rleft;
1093: u_int rright;
1094:
1.1 nicm 1095: int fd;
1.161 nicm 1096: struct bufferevent *event;
1.1 nicm 1097:
1.192 nicm 1098: struct termios tio;
1.1 nicm 1099:
1100: struct grid_cell cell;
1101:
1102: #define TTY_NOCURSOR 0x1
1103: #define TTY_FREEZE 0x2
1.382 nicm 1104: #define TTY_TIMER 0x4
1.1 nicm 1105: #define TTY_UTF8 0x8
1.76 nicm 1106: #define TTY_STARTED 0x10
1.77 nicm 1107: #define TTY_OPENED 0x20
1.414 nicm 1108: #define TTY_FOCUS 0x40
1.192 nicm 1109: int flags;
1.1 nicm 1110:
1.690 nicm 1111: struct tty_term *term;
1112: char *term_name;
1.1 nicm 1113: int term_flags;
1.676 nicm 1114: enum {
1115: TTY_VT100,
1116: TTY_VT101,
1117: TTY_VT102,
1118: TTY_VT220,
1119: TTY_VT320,
1120: TTY_VT420,
1121: TTY_UNKNOWN
1122: } term_type;
1.1 nicm 1123:
1.337 nicm 1124: struct mouse_event mouse;
1.492 nicm 1125: int mouse_drag_flag;
1126: void (*mouse_drag_update)(struct client *,
1127: struct mouse_event *);
1128: void (*mouse_drag_release)(struct client *,
1.511 nicm 1129: struct mouse_event *);
1.337 nicm 1130:
1.170 nicm 1131: struct event key_timer;
1.173 nicm 1132: struct tty_key *key_tree;
1.1 nicm 1133: };
1.689 nicm 1134: #define TTY_TYPES \
1135: { "VT100", "VT101", "VT102", "VT220", "VT320", "VT420", "UNKNOWN" }
1.1 nicm 1136:
1.583 nicm 1137: /* TTY command context. */
1.47 nicm 1138: struct tty_ctx {
1139: struct window_pane *wp;
1140:
1141: const struct grid_cell *cell;
1142:
1.49 nicm 1143: u_int num;
1.196 nicm 1144: void *ptr;
1.49 nicm 1145:
1.196 nicm 1146: /*
1.49 nicm 1147: * Cursor and region position before the screen was updated - this is
1148: * where the command should be applied; the values in the screen have
1149: * already been updated.
1150: */
1151: u_int ocx;
1152: u_int ocy;
1153:
1154: u_int orupper;
1155: u_int orlower;
1.140 nicm 1156:
1.308 nicm 1157: u_int xoff;
1158: u_int yoff;
1159:
1.661 nicm 1160: /* The background colour used for clearing (erasing). */
1161: u_int bg;
1162:
1.140 nicm 1163: /* Saved last cell on line. */
1164: struct grid_cell last_cell;
1.47 nicm 1165: };
1166:
1.180 nicm 1167: /* Saved message entry. */
1168: struct message_entry {
1.509 nicm 1169: char *msg;
1170: u_int msg_num;
1171: time_t msg_time;
1.501 nicm 1172: TAILQ_ENTRY(message_entry) entry;
1.180 nicm 1173: };
1174:
1.410 nicm 1175: /* Parsed arguments structures. */
1.544 nicm 1176: struct args_entry;
1.410 nicm 1177: RB_HEAD(args_tree, args_entry);
1.264 nicm 1178: struct args {
1.410 nicm 1179: struct args_tree tree;
1.511 nicm 1180: int argc;
1181: char **argv;
1.264 nicm 1182: };
1183:
1.606 nicm 1184: /* Command find structures. */
1185: enum cmd_find_type {
1186: CMD_FIND_PANE,
1187: CMD_FIND_WINDOW,
1188: CMD_FIND_SESSION,
1189: };
1190: struct cmd_find_state {
1.668 nicm 1191: struct cmdq_item *item;
1.606 nicm 1192: int flags;
1193: struct cmd_find_state *current;
1194:
1.661 nicm 1195: struct session *s;
1196: struct winlink *wl;
1.606 nicm 1197: struct window *w;
1.661 nicm 1198: struct window_pane *wp;
1.603 nicm 1199: int idx;
1.606 nicm 1200: };
1201:
1202: /* Command find flags. */
1203: #define CMD_FIND_PREFER_UNATTACHED 0x1
1204: #define CMD_FIND_QUIET 0x2
1205: #define CMD_FIND_WINDOW_INDEX 0x4
1206: #define CMD_FIND_DEFAULT_MARKED 0x8
1207: #define CMD_FIND_EXACT_SESSION 0x10
1208: #define CMD_FIND_EXACT_WINDOW 0x20
1.603 nicm 1209:
1.606 nicm 1210: /* Context for command being executed. */
1.603 nicm 1211: struct cmd_state {
1212: struct client *c;
1.606 nicm 1213: struct cmd_find_state tflag;
1214: struct cmd_find_state sflag;
1.603 nicm 1215: };
1216:
1.397 nicm 1217: /* Command and list of commands. */
1.1 nicm 1218: struct cmd {
1.264 nicm 1219: const struct cmd_entry *entry;
1220: struct args *args;
1.1 nicm 1221:
1.397 nicm 1222: char *file;
1223: u_int line;
1.412 nicm 1224:
1225: #define CMD_CONTROL 0x1
1226: int flags;
1.397 nicm 1227:
1.264 nicm 1228: TAILQ_ENTRY(cmd) qentry;
1.1 nicm 1229: };
1.509 nicm 1230:
1.229 nicm 1231: struct cmd_list {
1.511 nicm 1232: int references;
1233: TAILQ_HEAD(, cmd) list;
1.229 nicm 1234: };
1.1 nicm 1235:
1.397 nicm 1236: /* Command return values. */
1.348 nicm 1237: enum cmd_retval {
1238: CMD_RETURN_ERROR = -1,
1239: CMD_RETURN_NORMAL = 0,
1.397 nicm 1240: CMD_RETURN_WAIT,
1241: CMD_RETURN_STOP
1242: };
1243:
1.667 nicm 1244: /* Command queue item type. */
1.668 nicm 1245: enum cmdq_type {
1246: CMDQ_COMMAND,
1247: CMDQ_CALLBACK,
1.397 nicm 1248: };
1249:
1.667 nicm 1250: /* Command queue item. */
1.668 nicm 1251: typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
1252: struct cmdq_item {
1.673 nicm 1253: const char *name;
1.668 nicm 1254: struct cmdq_list *queue;
1255: struct cmdq_item *next;
1.397 nicm 1256:
1257: struct client *client;
1258:
1.668 nicm 1259: enum cmdq_type type;
1.667 nicm 1260: u_int group;
1261:
1262: u_int number;
1263: time_t time;
1264:
1.670 nicm 1265: struct format_tree *formats;
1266:
1.667 nicm 1267: int flags;
1.668 nicm 1268: #define CMDQ_FIRED 0x1
1269: #define CMDQ_WAITING 0x2
1270: #define CMDQ_NOHOOKS 0x4
1.667 nicm 1271:
1272: struct cmd_list *cmdlist;
1.397 nicm 1273: struct cmd *cmd;
1.667 nicm 1274:
1.668 nicm 1275: cmdq_cb cb;
1.667 nicm 1276: void *data;
1.397 nicm 1277:
1.613 nicm 1278: struct cmd_find_state current;
1.603 nicm 1279: struct cmd_state state;
1280:
1.667 nicm 1281: struct mouse_event mouse;
1.403 nicm 1282:
1.668 nicm 1283: TAILQ_ENTRY(cmdq_item) entry;
1.348 nicm 1284: };
1.668 nicm 1285: TAILQ_HEAD(cmdq_list, cmdq_item);
1.348 nicm 1286:
1.609 nicm 1287: /* Command -c, -t or -s flags. */
1288: enum cmd_entry_flag {
1289: CMD_NONE,
1290:
1291: CMD_CLIENT,
1292: CMD_CLIENT_CANFAIL,
1293:
1294: CMD_SESSION,
1295: CMD_SESSION_CANFAIL,
1296: CMD_SESSION_PREFERUNATTACHED,
1.682 nicm 1297: CMD_SESSION_WITHPANE, /* implies PREFERUNATTACHED */
1.609 nicm 1298:
1299: CMD_WINDOW,
1300: CMD_WINDOW_CANFAIL,
1301: CMD_WINDOW_MARKED,
1302: CMD_WINDOW_INDEX,
1303:
1304: CMD_PANE,
1305: CMD_PANE_CANFAIL,
1306: CMD_PANE_MARKED,
1307:
1308: CMD_MOVEW_R,
1309: };
1310:
1.397 nicm 1311: /* Command definition. */
1.1 nicm 1312: struct cmd_entry {
1.608 nicm 1313: const char *name;
1314: const char *alias;
1.264 nicm 1315:
1.608 nicm 1316: struct {
1317: const char *template;
1318: int lower;
1319: int upper;
1320: } args;
1.609 nicm 1321: const char *usage;
1.264 nicm 1322:
1.609 nicm 1323: enum cmd_entry_flag tflag;
1324: enum cmd_entry_flag sflag;
1325: enum cmd_entry_flag cflag;
1.1 nicm 1326:
1327: #define CMD_STARTSERVER 0x1
1.517 nicm 1328: #define CMD_READONLY 0x2
1.662 nicm 1329: #define CMD_AFTERHOOK 0x4
1.609 nicm 1330: int flags;
1.1 nicm 1331:
1.668 nicm 1332: enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
1.1 nicm 1333: };
1.604 nicm 1334:
1.667 nicm 1335: /* Client connection. */
1336: struct client {
1337: struct tmuxpeer *peer;
1.668 nicm 1338: struct cmdq_list queue;
1.667 nicm 1339:
1340: pid_t pid;
1341: int fd;
1342: struct event event;
1343: int retval;
1344:
1345: struct timeval creation_time;
1346: struct timeval activity_time;
1347:
1348: struct environ *environ;
1349:
1350: char *title;
1351: const char *cwd;
1352:
1353: char *term;
1354: char *ttyname;
1355: struct tty tty;
1356:
1357: void (*stdin_callback)(struct client *, int, void *);
1358: void *stdin_callback_data;
1359: struct evbuffer *stdin_data;
1360: int stdin_closed;
1361: struct evbuffer *stdout_data;
1362: struct evbuffer *stderr_data;
1363:
1364: struct event repeat_timer;
1365:
1366: struct event click_timer;
1367: u_int click_button;
1368:
1369: struct event status_timer;
1370: struct screen status;
1371:
1372: #define CLIENT_TERMINAL 0x1
1373: #define CLIENT_LOGIN 0x2
1374: #define CLIENT_EXIT 0x4
1375: #define CLIENT_REDRAW 0x8
1376: #define CLIENT_STATUS 0x10
1377: #define CLIENT_REPEAT 0x20
1378: #define CLIENT_SUSPENDED 0x40
1379: #define CLIENT_ATTACHED 0x80
1380: #define CLIENT_IDENTIFY 0x100
1381: #define CLIENT_DEAD 0x200
1382: #define CLIENT_BORDERS 0x400
1383: #define CLIENT_READONLY 0x800
1384: #define CLIENT_REDRAWWINDOW 0x1000
1385: #define CLIENT_CONTROL 0x2000
1386: #define CLIENT_CONTROLCONTROL 0x4000
1387: #define CLIENT_FOCUSED 0x8000
1388: #define CLIENT_UTF8 0x10000
1389: #define CLIENT_256COLOURS 0x20000
1390: #define CLIENT_IDENTIFIED 0x40000
1391: #define CLIENT_STATUSFORCE 0x80000
1392: #define CLIENT_DOUBLECLICK 0x100000
1393: #define CLIENT_TRIPLECLICK 0x200000
1394: int flags;
1395: struct key_table *keytable;
1396:
1397: struct event identify_timer;
1398: void (*identify_callback)(struct client *, struct window_pane *);
1399: void *identify_callback_data;
1400:
1401: char *message_string;
1402: struct event message_timer;
1403: u_int message_next;
1404: TAILQ_HEAD(, message_entry) message_log;
1405:
1406: char *prompt_string;
1407: struct utf8_data *prompt_buffer;
1408: size_t prompt_index;
1.684 nicm 1409: int (*prompt_callbackfn)(void *, const char *, int);
1.667 nicm 1410: void (*prompt_freefn)(void *);
1411: void *prompt_data;
1412: u_int prompt_hindex;
1413: enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
1414:
1415: #define PROMPT_SINGLE 0x1
1416: #define PROMPT_NUMERIC 0x2
1.684 nicm 1417: #define PROMPT_INCREMENTAL 0x4
1.667 nicm 1418: int prompt_flags;
1419:
1420: struct session *session;
1421: struct session *last_session;
1422:
1423: int wlmouse;
1424:
1425: int references;
1426:
1427: TAILQ_ENTRY(client) entry;
1428: };
1429: TAILQ_HEAD(clients, client);
1430:
1.493 nicm 1431: /* Key binding and key table. */
1.1 nicm 1432: struct key_binding {
1.571 nicm 1433: key_code key;
1.493 nicm 1434: struct cmd_list *cmdlist;
1435: int can_repeat;
1.1 nicm 1436:
1.493 nicm 1437: RB_ENTRY(key_binding) entry;
1.1 nicm 1438: };
1.306 nicm 1439: RB_HEAD(key_bindings, key_binding);
1.509 nicm 1440:
1.493 nicm 1441: struct key_table {
1442: const char *name;
1443: struct key_bindings key_bindings;
1444:
1445: u_int references;
1446:
1447: RB_ENTRY(key_table) entry;
1448: };
1449: RB_HEAD(key_tables, key_table);
1.1 nicm 1450:
1.699 nicm 1451: /* Option table entries. */
1.262 nicm 1452: enum options_table_type {
1453: OPTIONS_TABLE_STRING,
1454: OPTIONS_TABLE_NUMBER,
1.305 nicm 1455: OPTIONS_TABLE_KEY,
1.262 nicm 1456: OPTIONS_TABLE_COLOUR,
1457: OPTIONS_TABLE_ATTRIBUTES,
1458: OPTIONS_TABLE_FLAG,
1.435 nicm 1459: OPTIONS_TABLE_CHOICE,
1.697 nicm 1460: OPTIONS_TABLE_STYLE,
1461: OPTIONS_TABLE_ARRAY,
1.262 nicm 1462: };
1.584 nicm 1463: enum options_table_scope {
1.587 nicm 1464: OPTIONS_TABLE_NONE,
1.584 nicm 1465: OPTIONS_TABLE_SERVER,
1466: OPTIONS_TABLE_SESSION,
1467: OPTIONS_TABLE_WINDOW,
1468: };
1.262 nicm 1469:
1470: struct options_table_entry {
1.584 nicm 1471: const char *name;
1472: enum options_table_type type;
1473: enum options_table_scope scope;
1.1 nicm 1474:
1.584 nicm 1475: u_int minimum;
1476: u_int maximum;
1477: const char **choices;
1.1 nicm 1478:
1.584 nicm 1479: const char *default_str;
1480: long long default_num;
1.435 nicm 1481:
1.703 ! nicm 1482: const char *separator;
1.584 nicm 1483: const char *style;
1.1 nicm 1484: };
1485:
1.264 nicm 1486: /* Common command usages. */
1487: #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
1488: #define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
1489: #define CMD_TARGET_SESSION_USAGE "[-t target-session]"
1490: #define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
1491: #define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
1492: #define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
1493: #define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
1494: #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
1.461 nicm 1495: #define CMD_BUFFER_USAGE "[-b buffer-name]"
1.264 nicm 1496:
1.1 nicm 1497: /* tmux.c */
1.595 nicm 1498: extern struct hooks *global_hooks;
1499: extern struct options *global_options;
1500: extern struct options *global_s_options;
1501: extern struct options *global_w_options;
1502: extern struct environ *global_environ;
1.589 nicm 1503: extern struct timeval start_time;
1.590 nicm 1504: extern const char *socket_path;
1.702 nicm 1505: extern int ptm_fd;
1.93 nicm 1506: int areshell(const char *);
1.265 nicm 1507: void setblocking(int, int);
1.529 nicm 1508: const char *find_home(void);
1.1 nicm 1509:
1.566 nicm 1510: /* proc.c */
1511: struct imsg;
1512: int proc_send(struct tmuxpeer *, enum msgtype, int, const void *, size_t);
1513: int proc_send_s(struct tmuxpeer *, enum msgtype, const char *);
1514: struct tmuxproc *proc_start(const char *, struct event_base *, int,
1515: void (*)(int));
1516: void proc_loop(struct tmuxproc *, int (*)(void));
1517: void proc_exit(struct tmuxproc *);
1518: struct tmuxpeer *proc_add_peer(struct tmuxproc *, int,
1519: void (*)(struct imsg *, void *), void *);
1520: void proc_remove_peer(struct tmuxpeer *);
1521: void proc_kill_peer(struct tmuxpeer *);
1522:
1.1 nicm 1523: /* cfg.c */
1.397 nicm 1524: extern int cfg_finished;
1.431 nicm 1525: extern struct client *cfg_client;
1.668 nicm 1526: void start_cfg(void);
1527: int load_cfg(const char *, struct client *, struct cmdq_item *, int);
1528: void set_cfg_file(const char *);
1.615 nicm 1529: void printflike(1, 2) cfg_add_cause(const char *, ...);
1.668 nicm 1530: void cfg_print_causes(struct cmdq_item *);
1531: void cfg_show_causes(struct session *);
1.294 nicm 1532:
1.542 nicm 1533: /* paste.c */
1534: struct paste_buffer;
1535: const char *paste_buffer_name(struct paste_buffer *);
1.647 nicm 1536: u_int paste_buffer_order(struct paste_buffer *);
1537: time_t paste_buffer_created(struct paste_buffer *);
1.542 nicm 1538: const char *paste_buffer_data(struct paste_buffer *, size_t *);
1539: struct paste_buffer *paste_walk(struct paste_buffer *);
1540: struct paste_buffer *paste_get_top(const char **);
1541: struct paste_buffer *paste_get_name(const char *);
1.556 nicm 1542: void paste_free(struct paste_buffer *);
1.542 nicm 1543: void paste_add(char *, size_t);
1544: int paste_rename(const char *, const char *, char **);
1545: int paste_set(char *, size_t, const char *, char **);
1.572 nicm 1546: char *paste_make_sample(struct paste_buffer *);
1.542 nicm 1547:
1.294 nicm 1548: /* format.c */
1.558 nicm 1549: #define FORMAT_STATUS 0x1
1550: #define FORMAT_FORCE 0x2
1.687 nicm 1551: #define FORMAT_NOJOBS 0x4
1.483 nicm 1552: struct format_tree;
1.668 nicm 1553: struct format_tree *format_create(struct cmdq_item *, int);
1.294 nicm 1554: void format_free(struct format_tree *);
1.476 nicm 1555: void printflike(3, 4) format_add(struct format_tree *, const char *,
1556: const char *, ...);
1.489 nicm 1557: char *format_expand_time(struct format_tree *, const char *, time_t);
1.294 nicm 1558: char *format_expand(struct format_tree *, const char *);
1.488 nicm 1559: void format_defaults(struct format_tree *, struct client *,
1560: struct session *, struct winlink *, struct window_pane *);
1561: void format_defaults_window(struct format_tree *, struct window *);
1562: void format_defaults_pane(struct format_tree *,
1.417 nicm 1563: struct window_pane *);
1.488 nicm 1564: void format_defaults_paste_buffer(struct format_tree *,
1.572 nicm 1565: struct paste_buffer *);
1.1 nicm 1566:
1.595 nicm 1567: /* hooks.c */
1568: struct hook;
1.661 nicm 1569: struct hooks *hooks_get(struct session *);
1.595 nicm 1570: struct hooks *hooks_create(struct hooks *);
1571: void hooks_free(struct hooks *);
1572: struct hook *hooks_first(struct hooks *);
1573: struct hook *hooks_next(struct hook *);
1574: void hooks_add(struct hooks *, const char *, struct cmd_list *);
1575: void hooks_copy(struct hooks *, struct hooks *);
1.599 nicm 1576: void hooks_remove(struct hooks *, const char *);
1.595 nicm 1577: struct hook *hooks_find(struct hooks *, const char *);
1.667 nicm 1578: void printflike(4, 5) hooks_run(struct hooks *, struct client *,
1.613 nicm 1579: struct cmd_find_state *, const char *, ...);
1.668 nicm 1580: void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *,
1.613 nicm 1581: struct cmd_find_state *, const char *, ...);
1.595 nicm 1582:
1.1 nicm 1583: /* mode-key.c */
1.62 nicm 1584: extern struct mode_key_tree mode_key_tree_vi_choice;
1585: extern struct mode_key_tree mode_key_tree_emacs_choice;
1586: int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
1.306 nicm 1587: RB_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
1.261 nicm 1588: const char *mode_key_tostring(const struct mode_key_cmdstr *,
1589: enum mode_key_cmd);
1590: enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *,
1591: const char *);
1.63 nicm 1592: const struct mode_key_table *mode_key_findtable(const char *);
1.62 nicm 1593: void mode_key_init_trees(void);
1594: void mode_key_init(struct mode_key_data *, struct mode_key_tree *);
1.652 nicm 1595: enum mode_key_cmd mode_key_lookup(struct mode_key_data *, key_code);
1.323 nicm 1596:
1597: /* notify.c */
1.358 nicm 1598: void notify_input(struct window_pane *, struct evbuffer *);
1.671 nicm 1599: void notify_client(const char *, struct client *);
1600: void notify_session(const char *, struct session *);
1.672 nicm 1601: void notify_winlink(const char *, struct session *, struct winlink *);
1.671 nicm 1602: void notify_session_window(const char *, struct session *, struct window *);
1603: void notify_window(const char *, struct window *);
1604: void notify_pane(const char *, struct window_pane *);
1.1 nicm 1605:
1606: /* options.c */
1.697 nicm 1607: struct options *options_create(struct options *);
1608: void options_free(struct options *);
1.699 nicm 1609: struct options_entry *options_first(struct options *);
1610: struct options_entry *options_next(struct options_entry *);
1611: struct options_entry *options_empty(struct options *,
1.697 nicm 1612: const struct options_table_entry *);
1.699 nicm 1613: struct options_entry *options_default(struct options *,
1.697 nicm 1614: const struct options_table_entry *);
1.699 nicm 1615: const char *options_name(struct options_entry *);
1616: const struct options_table_entry *options_table_entry(struct options_entry *);
1617: struct options_entry *options_get_only(struct options *, const char *);
1618: struct options_entry *options_get(struct options *, const char *);
1619: void options_remove(struct options_entry *);
1.703 ! nicm 1620: void options_array_clear(struct options_entry *);
1.699 nicm 1621: const char *options_array_get(struct options_entry *, u_int);
1.703 ! nicm 1622: int options_array_set(struct options_entry *, u_int, const char *,
! 1623: int);
1.699 nicm 1624: int options_array_size(struct options_entry *, u_int *);
1.703 ! nicm 1625: void options_array_assign(struct options_entry *, const char *);
1.699 nicm 1626: int options_isstring(struct options_entry *);
1627: const char *options_tostring(struct options_entry *, int);
1.697 nicm 1628: char *options_parse(const char *, int *);
1.699 nicm 1629: struct options_entry *options_parse_get(struct options *, const char *, int *,
1.703 ! nicm 1630: int);
1.697 nicm 1631: char *options_match(const char *, int *, int *);
1.699 nicm 1632: struct options_entry *options_match_get(struct options *, const char *, int *,
1.703 ! nicm 1633: int, int *);
1.697 nicm 1634: const char *options_get_string(struct options *, const char *);
1635: long long options_get_number(struct options *, const char *);
1.696 nicm 1636: const struct grid_cell *options_get_style(struct options *, const char *);
1.699 nicm 1637: struct options_entry * printflike(4, 5) options_set_string(struct options *,
1.697 nicm 1638: const char *, int, const char *, ...);
1.699 nicm 1639: struct options_entry *options_set_number(struct options *, const char *,
1640: long long);
1641: struct options_entry *options_set_style(struct options *, const char *, int,
1.697 nicm 1642: const char *);
1643: enum options_table_scope options_scope_from_flags(struct args *, int,
1644: struct cmd_find_state *, struct options **, char **);
1.699 nicm 1645: void options_style_update_new(struct options *,
1646: struct options_entry *);
1647: void options_style_update_old(struct options *,
1648: struct options_entry *);
1.1 nicm 1649:
1.262 nicm 1650: /* options-table.c */
1.584 nicm 1651: extern const struct options_table_entry options_table[];
1.262 nicm 1652:
1.126 nicm 1653: /* job.c */
1.128 nicm 1654: extern struct joblist all_jobs;
1.569 nicm 1655: struct job *job_run(const char *, struct session *, const char *,
1.405 nicm 1656: void (*)(struct job *), void (*)(void *), void *);
1.126 nicm 1657: void job_free(struct job *);
1.160 nicm 1658: void job_died(struct job *, int);
1.126 nicm 1659:
1.73 nicm 1660: /* environ.c */
1.568 nicm 1661: struct environ *environ_create(void);
1.73 nicm 1662: void environ_free(struct environ *);
1.568 nicm 1663: struct environ_entry *environ_first(struct environ *);
1664: struct environ_entry *environ_next(struct environ_entry *);
1.73 nicm 1665: void environ_copy(struct environ *, struct environ *);
1666: struct environ_entry *environ_find(struct environ *, const char *);
1.592 nicm 1667: void printflike(3, 4) environ_set(struct environ *, const char *, const char *,
1668: ...);
1669: void environ_clear(struct environ *, const char *);
1.73 nicm 1670: void environ_put(struct environ *, const char *);
1671: void environ_unset(struct environ *, const char *);
1.192 nicm 1672: void environ_update(const char *, struct environ *, struct environ *);
1.215 nicm 1673: void environ_push(struct environ *);
1.640 nicm 1674: void environ_log(struct environ *, const char *);
1.73 nicm 1675:
1.1 nicm 1676: /* tty.c */
1.570 nicm 1677: void tty_create_log(void);
1.115 nicm 1678: void tty_raw(struct tty *, const char *);
1.491 nicm 1679: void tty_attributes(struct tty *, const struct grid_cell *,
1680: const struct window_pane *);
1.47 nicm 1681: void tty_reset(struct tty *);
1.677 nicm 1682: void tty_region_off(struct tty *);
1683: void tty_margin_off(struct tty *);
1.134 nicm 1684: void tty_cursor(struct tty *, u_int, u_int);
1.47 nicm 1685: void tty_putcode(struct tty *, enum tty_code_code);
1686: void tty_putcode1(struct tty *, enum tty_code_code, int);
1687: void tty_putcode2(struct tty *, enum tty_code_code, int, int);
1.287 nicm 1688: void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
1.373 nicm 1689: void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
1690: const void *);
1.47 nicm 1691: void tty_puts(struct tty *, const char *);
1692: void tty_putc(struct tty *, u_char);
1.373 nicm 1693: void tty_putn(struct tty *, const void *, size_t, u_int);
1.528 nicm 1694: int tty_init(struct tty *, struct client *, int, char *);
1.224 nicm 1695: int tty_resize(struct tty *);
1.324 nicm 1696: int tty_set_size(struct tty *, u_int, u_int);
1.47 nicm 1697: void tty_start_tty(struct tty *);
1698: void tty_stop_tty(struct tty *);
1699: void tty_set_title(struct tty *, const char *);
1.287 nicm 1700: void tty_update_mode(struct tty *, int, struct screen *);
1.491 nicm 1701: void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
1702: u_int);
1703: void tty_draw_line(struct tty *, const struct window_pane *, struct screen *,
1704: u_int, u_int, u_int);
1.437 nicm 1705: int tty_open(struct tty *, char **);
1.76 nicm 1706: void tty_close(struct tty *);
1707: void tty_free(struct tty *);
1.676 nicm 1708: void tty_set_type(struct tty *, int);
1.514 nicm 1709: void tty_write(void (*)(struct tty *, const struct tty_ctx *),
1710: struct tty_ctx *);
1.79 nicm 1711: void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
1712: void tty_cmd_cell(struct tty *, const struct tty_ctx *);
1713: void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *);
1714: void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *);
1715: void tty_cmd_clearline(struct tty *, const struct tty_ctx *);
1716: void tty_cmd_clearscreen(struct tty *, const struct tty_ctx *);
1717: void tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *);
1718: void tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *);
1719: void tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *);
1.371 nicm 1720: void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
1.79 nicm 1721: void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
1.282 nicm 1722: void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
1.79 nicm 1723: void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
1724: void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
1725: void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
1726: void tty_cmd_utf8character(struct tty *, const struct tty_ctx *);
1727: void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
1.286 nicm 1728: void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
1.273 nicm 1729: void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
1.1 nicm 1730:
1731: /* tty-term.c */
1732: extern struct tty_terms tty_terms;
1.530 nicm 1733: u_int tty_term_ncodes(void);
1.437 nicm 1734: struct tty_term *tty_term_find(char *, int, char **);
1.192 nicm 1735: void tty_term_free(struct tty_term *);
1.1 nicm 1736: int tty_term_has(struct tty_term *, enum tty_code_code);
1737: const char *tty_term_string(struct tty_term *, enum tty_code_code);
1738: const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
1.600 nicm 1739: const char *tty_term_string2(struct tty_term *, enum tty_code_code, int,
1740: int);
1741: const char *tty_term_ptr1(struct tty_term *, enum tty_code_code,
1742: const void *);
1.367 nicm 1743: const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
1744: const void *, const void *);
1.1 nicm 1745: int tty_term_number(struct tty_term *, enum tty_code_code);
1746: int tty_term_flag(struct tty_term *, enum tty_code_code);
1.530 nicm 1747: const char *tty_term_describe(struct tty_term *, enum tty_code_code);
1.240 nicm 1748:
1749: /* tty-acs.c */
1750: const char *tty_acs_get(struct tty *, u_char);
1.1 nicm 1751:
1752: /* tty-keys.c */
1.571 nicm 1753: void tty_keys_build(struct tty *);
1754: void tty_keys_free(struct tty *);
1755: key_code tty_keys_next(struct tty *);
1.1 nicm 1756:
1.264 nicm 1757: /* arguments.c */
1758: struct args *args_parse(const char *, int, char **);
1759: void args_free(struct args *);
1.593 nicm 1760: char *args_print(struct args *);
1.264 nicm 1761: int args_has(struct args *, u_char);
1762: const char *args_get(struct args *, u_char);
1.502 nicm 1763: long long args_strtonum(struct args *, u_char, long long, long long,
1764: char **);
1765:
1766: /* cmd-find.c */
1.668 nicm 1767: int cmd_find_current(struct cmd_find_state *, struct cmdq_item *,
1.618 nicm 1768: int);
1769: int cmd_find_target(struct cmd_find_state *,
1.668 nicm 1770: struct cmd_find_state *, struct cmdq_item *, const char *,
1.618 nicm 1771: enum cmd_find_type, int);
1.668 nicm 1772: struct client *cmd_find_client(struct cmdq_item *, const char *, int);
1773: void cmd_find_clear_state(struct cmd_find_state *,
1774: struct cmdq_item *, int);
1.660 nicm 1775: int cmd_find_empty_state(struct cmd_find_state *);
1.611 nicm 1776: int cmd_find_valid_state(struct cmd_find_state *);
1777: void cmd_find_copy_state(struct cmd_find_state *,
1778: struct cmd_find_state *);
1.610 nicm 1779: void cmd_find_log_state(const char *, struct cmd_find_state *);
1.613 nicm 1780: int cmd_find_from_session(struct cmd_find_state *,
1781: struct session *);
1.616 nicm 1782: int cmd_find_from_winlink(struct cmd_find_state *,
1783: struct session *, struct winlink *);
1.664 nicm 1784: int cmd_find_from_session_window(struct cmd_find_state *,
1785: struct session *, struct window *);
1.613 nicm 1786: int cmd_find_from_window(struct cmd_find_state *, struct window *);
1787: int cmd_find_from_pane(struct cmd_find_state *,
1788: struct window_pane *);
1.264 nicm 1789:
1.1 nicm 1790: /* cmd.c */
1.55 nicm 1791: int cmd_pack_argv(int, char **, char *, size_t);
1792: int cmd_unpack_argv(char *, size_t, int, char ***);
1.460 nicm 1793: char **cmd_copy_argv(int, char **);
1.55 nicm 1794: void cmd_free_argv(int, char **);
1.463 nicm 1795: char *cmd_stringify_argv(int, char **);
1.397 nicm 1796: struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
1.668 nicm 1797: int cmd_prepare_state(struct cmd *, struct cmdq_item *);
1.593 nicm 1798: char *cmd_print(struct cmd *);
1.492 nicm 1799: int cmd_mouse_at(struct window_pane *, struct mouse_event *,
1800: u_int *, u_int *, int);
1801: struct winlink *cmd_mouse_window(struct mouse_event *, struct session **);
1802: struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
1803: struct winlink **);
1.380 nicm 1804: char *cmd_template_replace(const char *, const char *, int);
1.1 nicm 1805: extern const struct cmd_entry *cmd_table[];
1.399 nicm 1806:
1807: /* cmd-attach-session.c */
1.668 nicm 1808: enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *,
1809: int);
1.1 nicm 1810:
1811: /* cmd-list.c */
1.397 nicm 1812: struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
1.1 nicm 1813: void cmd_list_free(struct cmd_list *);
1.593 nicm 1814: char *cmd_list_print(struct cmd_list *);
1.1 nicm 1815:
1.397 nicm 1816: /* cmd-queue.c */
1.668 nicm 1817: struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
1.667 nicm 1818: struct mouse_event *, int);
1.673 nicm 1819: #define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data)
1820: struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *);
1.668 nicm 1821: void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
1822: void cmdq_append(struct client *, struct cmdq_item *);
1.670 nicm 1823: void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
1824: const char *, ...);
1.667 nicm 1825: u_int cmdq_next(struct client *);
1.668 nicm 1826: void cmdq_guard(struct cmdq_item *, const char *, int);
1827: void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...);
1828: void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
1.397 nicm 1829:
1.1 nicm 1830: /* cmd-string.c */
1.698 nicm 1831: struct cmd_list *cmd_string_parse(const char *, const char *, u_int, char **);
1.471 nicm 1832:
1833: /* cmd-wait-for.c */
1834: void cmd_wait_for_flush(void);
1.1 nicm 1835:
1836: /* client.c */
1.591 nicm 1837: int client_main(struct event_base *, int, char **, int, const char *);
1.1 nicm 1838:
1839: /* key-bindings.c */
1.493 nicm 1840: RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
1841: RB_PROTOTYPE(key_tables, key_table, entry, key_table_cmp);
1842: extern struct key_tables key_tables;
1843: int key_table_cmp(struct key_table *, struct key_table *);
1.1 nicm 1844: int key_bindings_cmp(struct key_binding *, struct key_binding *);
1.592 nicm 1845: struct key_table *key_bindings_get_table(const char *, int);
1.511 nicm 1846: void key_bindings_unref_table(struct key_table *);
1.571 nicm 1847: void key_bindings_add(const char *, key_code, int, struct cmd_list *);
1848: void key_bindings_remove(const char *, key_code);
1.493 nicm 1849: void key_bindings_remove_table(const char *);
1.1 nicm 1850: void key_bindings_init(void);
1.492 nicm 1851: void key_bindings_dispatch(struct key_binding *, struct client *,
1.679 nicm 1852: struct mouse_event *, struct cmd_find_state *);
1.1 nicm 1853:
1854: /* key-string.c */
1.571 nicm 1855: key_code key_string_lookup_string(const char *);
1856: const char *key_string_lookup_key(key_code);
1.1 nicm 1857:
1.541 nicm 1858: /* alerts.c */
1859: void alerts_reset_all(void);
1860: void alerts_queue(struct window *, int);
1.594 nicm 1861: void alerts_check_session(struct session *);
1.541 nicm 1862:
1.1 nicm 1863: /* server.c */
1.566 nicm 1864: extern struct tmuxproc *server_proc;
1.1 nicm 1865: extern struct clients clients;
1.611 nicm 1866: extern struct cmd_find_state marked_pane;
1.516 nicm 1867: void server_set_marked(struct session *, struct winlink *,
1868: struct window_pane *);
1869: void server_clear_marked(void);
1870: int server_is_marked(struct session *, struct winlink *,
1871: struct window_pane *);
1872: int server_check_marked(void);
1.546 nicm 1873: int server_start(struct event_base *, int, char *);
1.175 nicm 1874: void server_update_socket(void);
1.328 nicm 1875: void server_add_accept(int);
1.1 nicm 1876:
1.146 nicm 1877: /* server-client.c */
1.602 nicm 1878: void server_client_set_key_table(struct client *, const char *);
1879: const char *server_client_get_key_table(struct client *);
1.652 nicm 1880: int server_client_is_default_key_table(struct client *);
1.517 nicm 1881: int server_client_check_nested(struct client *);
1.571 nicm 1882: void server_client_handle_key(struct client *, key_code);
1.146 nicm 1883: void server_client_create(int);
1.511 nicm 1884: int server_client_open(struct client *, char **);
1.519 nicm 1885: void server_client_unref(struct client *);
1.146 nicm 1886: void server_client_lost(struct client *);
1.595 nicm 1887: void server_client_detach(struct client *, enum msgtype);
1.694 nicm 1888: void server_client_exec(struct client *, const char *);
1.146 nicm 1889: void server_client_loop(void);
1.577 nicm 1890: void server_client_push_stdout(struct client *);
1891: void server_client_push_stderr(struct client *);
1.146 nicm 1892:
1.1 nicm 1893: /* server-fn.c */
1.73 nicm 1894: void server_fill_environ(struct session *, struct environ *);
1.1 nicm 1895: void server_redraw_client(struct client *);
1896: void server_status_client(struct client *);
1897: void server_redraw_session(struct session *);
1.124 nicm 1898: void server_redraw_session_group(struct session *);
1.1 nicm 1899: void server_status_session(struct session *);
1.124 nicm 1900: void server_status_session_group(struct session *);
1.1 nicm 1901: void server_redraw_window(struct window *);
1.197 nicm 1902: void server_redraw_window_borders(struct window *);
1.1 nicm 1903: void server_status_window(struct window *);
1904: void server_lock(void);
1.118 nicm 1905: void server_lock_session(struct session *);
1906: void server_lock_client(struct client *);
1.37 nicm 1907: void server_kill_window(struct window *);
1.124 nicm 1908: int server_link_window(struct session *,
1.106 nicm 1909: struct winlink *, struct session *, int, int, int, char **);
1910: void server_unlink_window(struct session *, struct winlink *);
1.613 nicm 1911: void server_destroy_pane(struct window_pane *, int);
1.103 nicm 1912: void server_destroy_session(struct session *);
1.367 nicm 1913: void server_check_unattached(void);
1.92 nicm 1914: void server_set_identify(struct client *);
1.636 nicm 1915: void server_clear_identify(struct client *, struct window_pane *);
1.332 nicm 1916: int server_set_stdin_callback(struct client *, void (*)(struct client *,
1917: int, void *), void *, char **);
1.398 nicm 1918: void server_unzoom_window(struct window *);
1.1 nicm 1919:
1920: /* status.c */
1.534 nicm 1921: void status_timer_start(struct client *);
1922: void status_timer_start_all(void);
1.308 nicm 1923: int status_at_line(struct client *);
1.492 nicm 1924: struct window *status_get_window_at(struct client *, u_int);
1.1 nicm 1925: int status_redraw(struct client *);
1.476 nicm 1926: void printflike(2, 3) status_message_set(struct client *, const char *, ...);
1.1 nicm 1927: void status_message_clear(struct client *);
1928: int status_message_redraw(struct client *);
1.292 nicm 1929: void status_prompt_set(struct client *, const char *, const char *,
1.684 nicm 1930: int (*)(void *, const char *, int), void (*)(void *), void *, int);
1.1 nicm 1931: void status_prompt_clear(struct client *);
1932: int status_prompt_redraw(struct client *);
1.656 nicm 1933: int status_prompt_key(struct client *, key_code);
1.292 nicm 1934: void status_prompt_update(struct client *, const char *, const char *);
1.529 nicm 1935: void status_prompt_load_history(void);
1936: void status_prompt_save_history(void);
1.1 nicm 1937:
1938: /* resize.c */
1939: void recalculate_sizes(void);
1940:
1941: /* input.c */
1942: void input_init(struct window_pane *);
1943: void input_free(struct window_pane *);
1.614 nicm 1944: void input_reset(struct window_pane *, int);
1.507 nicm 1945: struct evbuffer *input_pending(struct window_pane *);
1.1 nicm 1946: void input_parse(struct window_pane *);
1947:
1948: /* input-key.c */
1.571 nicm 1949: void input_key(struct window_pane *, key_code, struct mouse_event *);
1.150 nicm 1950:
1951: /* xterm-keys.c */
1.571 nicm 1952: char *xterm_keys_lookup(key_code);
1953: int xterm_keys_find(const char *, size_t, size_t *, key_code *);
1.1 nicm 1954:
1955: /* colour.c */
1.521 nicm 1956: int colour_find_rgb(u_char, u_char, u_char);
1.637 nicm 1957: int colour_join_rgb(u_char, u_char, u_char);
1958: void colour_split_rgb(int, u_char *, u_char *, u_char *);
1.102 nicm 1959: const char *colour_tostring(int);
1.637 nicm 1960: int colour_fromstring(const char *s);
1.1 nicm 1961: u_char colour_256to16(u_char);
1962:
1963: /* attributes.c */
1964: const char *attributes_tostring(u_char);
1965: int attributes_fromstring(const char *);
1966:
1967: /* grid.c */
1968: extern const struct grid_cell grid_default_cell;
1.638 nicm 1969: int grid_cells_equal(const struct grid_cell *, const struct grid_cell *);
1.1 nicm 1970: struct grid *grid_create(u_int, u_int, u_int);
1971: void grid_destroy(struct grid *);
1972: int grid_compare(struct grid *, struct grid *);
1.661 nicm 1973: void grid_collect_history(struct grid *, u_int);
1974: void grid_scroll_history(struct grid *, u_int);
1.139 nicm 1975: void grid_scroll_history_region(struct grid *, u_int, u_int);
1.562 nicm 1976: void grid_clear_history(struct grid *);
1.391 nicm 1977: const struct grid_line *grid_peek_line(struct grid *, u_int);
1.576 nicm 1978: void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
1.1 nicm 1979: void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
1.661 nicm 1980: void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
1981: void grid_clear_lines(struct grid *, u_int, u_int, u_int);
1982: void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int);
1983: void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int, u_int);
1.388 nicm 1984: char *grid_string_cells(struct grid *, u_int, u_int, u_int,
1.400 nicm 1985: struct grid_cell **, int, int, int);
1.600 nicm 1986: void grid_duplicate_lines(struct grid *, u_int, struct grid *, u_int,
1987: u_int);
1.378 nicm 1988: u_int grid_reflow(struct grid *, struct grid *, u_int);
1.181 nicm 1989:
1.1 nicm 1990: /* grid-view.c */
1.576 nicm 1991: void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
1992: void grid_view_set_cell(struct grid *, u_int, u_int,
1993: const struct grid_cell *);
1.661 nicm 1994: void grid_view_clear_history(struct grid *, u_int);
1995: void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
1.1 nicm 1996: void grid_view_scroll_region_up(struct grid *, u_int, u_int);
1997: void grid_view_scroll_region_down(struct grid *, u_int, u_int);
1.661 nicm 1998: void grid_view_insert_lines(struct grid *, u_int, u_int, u_int);
1999: void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int,
2000: u_int);
2001: void grid_view_delete_lines(struct grid *, u_int, u_int, u_int);
2002: void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int,
2003: u_int);
2004: void grid_view_insert_cells(struct grid *, u_int, u_int, u_int, u_int);
2005: void grid_view_delete_cells(struct grid *, u_int, u_int, u_int, u_int);
1.9 nicm 2006: char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
1.1 nicm 2007:
2008: /* screen-write.c */
1.572 nicm 2009: void screen_write_start(struct screen_write_ctx *, struct window_pane *,
2010: struct screen *);
1.1 nicm 2011: void screen_write_stop(struct screen_write_ctx *);
1.304 nicm 2012: void screen_write_reset(struct screen_write_ctx *);
1.572 nicm 2013: size_t printflike(1, 2) screen_write_cstrlen(const char *, ...);
2014: void printflike(4, 5) screen_write_cnputs(struct screen_write_ctx *,
1.625 nicm 2015: ssize_t, const struct grid_cell *, const char *, ...);
1.572 nicm 2016: size_t printflike(1, 2) screen_write_strlen(const char *, ...);
1.476 nicm 2017: void printflike(3, 4) screen_write_puts(struct screen_write_ctx *,
1.625 nicm 2018: const struct grid_cell *, const char *, ...);
1.572 nicm 2019: void printflike(4, 5) screen_write_nputs(struct screen_write_ctx *,
1.625 nicm 2020: ssize_t, const struct grid_cell *, const char *, ...);
1.572 nicm 2021: void screen_write_vnputs(struct screen_write_ctx *, ssize_t,
1.625 nicm 2022: const struct grid_cell *, const char *, va_list);
2023: void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *,
1.572 nicm 2024: u_char);
2025: void screen_write_copy(struct screen_write_ctx *, struct screen *, u_int,
1.683 nicm 2026: u_int, u_int, u_int, bitstr_t *, const struct grid_cell *);
1.136 nicm 2027: void screen_write_backspace(struct screen_write_ctx *);
1.383 nicm 2028: void screen_write_mode_set(struct screen_write_ctx *, int);
2029: void screen_write_mode_clear(struct screen_write_ctx *, int);
1.1 nicm 2030: void screen_write_cursorup(struct screen_write_ctx *, u_int);
2031: void screen_write_cursordown(struct screen_write_ctx *, u_int);
2032: void screen_write_cursorright(struct screen_write_ctx *, u_int);
2033: void screen_write_cursorleft(struct screen_write_ctx *, u_int);
1.5 nicm 2034: void screen_write_alignmenttest(struct screen_write_ctx *);
1.661 nicm 2035: void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int);
2036: void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int);
1.371 nicm 2037: void screen_write_clearcharacter(struct screen_write_ctx *, u_int);
1.661 nicm 2038: void screen_write_insertline(struct screen_write_ctx *, u_int, u_int);
2039: void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int);
2040: void screen_write_clearline(struct screen_write_ctx *, u_int);
2041: void screen_write_clearendofline(struct screen_write_ctx *, u_int);
2042: void screen_write_clearstartofline(struct screen_write_ctx *, u_int);
1.1 nicm 2043: void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
2044: void screen_write_reverseindex(struct screen_write_ctx *);
2045: void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
1.72 nicm 2046: void screen_write_linefeed(struct screen_write_ctx *, int);
1.1 nicm 2047: void screen_write_carriagereturn(struct screen_write_ctx *);
1.661 nicm 2048: void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
1.1 nicm 2049: void screen_write_clearstartofscreen(struct screen_write_ctx *);
1.661 nicm 2050: void screen_write_clearscreen(struct screen_write_ctx *, u_int);
1.297 nicm 2051: void screen_write_clearhistory(struct screen_write_ctx *);
1.373 nicm 2052: void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
1.286 nicm 2053: void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
1.273 nicm 2054: void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
1.1 nicm 2055:
2056: /* screen-redraw.c */
1.648 nicm 2057: void screen_redraw_update(struct client *);
1.436 nicm 2058: void screen_redraw_screen(struct client *, int, int, int);
1.1 nicm 2059: void screen_redraw_pane(struct client *, struct window_pane *);
2060:
2061: /* screen.c */
2062: void screen_init(struct screen *, u_int, u_int, u_int);
2063: void screen_reinit(struct screen *);
2064: void screen_free(struct screen *);
1.6 nicm 2065: void screen_reset_tabs(struct screen *);
1.288 nicm 2066: void screen_set_cursor_style(struct screen *, u_int);
1.287 nicm 2067: void screen_set_cursor_colour(struct screen *, const char *);
1.1 nicm 2068: void screen_set_title(struct screen *, const char *);
1.374 nicm 2069: void screen_resize(struct screen *, u_int, u_int, int);
1.204 nicm 2070: void screen_set_selection(struct screen *,
2071: u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
1.1 nicm 2072: void screen_clear_selection(struct screen *);
1.680 nicm 2073: void screen_hide_selection(struct screen *);
1.1 nicm 2074: int screen_check_selection(struct screen *, u_int, u_int);
1.657 nicm 2075: void screen_select_cell(struct screen *, struct grid_cell *,
2076: const struct grid_cell *);
1.1 nicm 2077:
2078: /* window.c */
2079: extern struct windows windows;
1.274 nicm 2080: extern struct window_pane_tree all_window_panes;
1.496 nicm 2081: int window_cmp(struct window *, struct window *);
2082: RB_PROTOTYPE(windows, window, entry, window_cmp);
1.1 nicm 2083: int winlink_cmp(struct winlink *, struct winlink *);
2084: RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
1.274 nicm 2085: int window_pane_cmp(struct window_pane *, struct window_pane *);
2086: RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
1.1 nicm 2087: struct winlink *winlink_find_by_index(struct winlinks *, int);
1.192 nicm 2088: struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
1.309 nicm 2089: struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
1.1 nicm 2090: u_int winlink_count(struct winlinks *);
1.268 nicm 2091: struct winlink *winlink_add(struct winlinks *, int);
2092: void winlink_set_window(struct winlink *, struct window *);
1.1 nicm 2093: void winlink_remove(struct winlinks *, struct winlink *);
1.186 nicm 2094: struct winlink *winlink_next(struct winlink *);
2095: struct winlink *winlink_previous(struct winlink *);
1.235 nicm 2096: struct winlink *winlink_next_by_number(struct winlink *, struct session *,
2097: int);
2098: struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
2099: int);
1.1 nicm 2100: void winlink_stack_push(struct winlink_stack *, struct winlink *);
2101: void winlink_stack_remove(struct winlink_stack *, struct winlink *);
1.500 nicm 2102: struct window *window_find_by_id_str(const char *);
1.309 nicm 2103: struct window *window_find_by_id(u_int);
1.541 nicm 2104: void window_update_activity(struct window *);
1.666 nicm 2105: struct window *window_create(u_int, u_int);
2106: struct window *window_create_spawn(const char *, int, char **, const char *,
1.569 nicm 2107: const char *, const char *, struct environ *,
2108: struct termios *, u_int, u_int, u_int, char **);
1.289 nicm 2109: struct window_pane *window_get_active_at(struct window *, u_int, u_int);
2110: struct window_pane *window_find_string(struct window *, const char *);
1.492 nicm 2111: int window_has_pane(struct window *, struct window_pane *);
1.477 nicm 2112: int window_set_active_pane(struct window *, struct window_pane *);
1.559 nicm 2113: void window_redraw_active_switch(struct window *,
2114: struct window_pane *);
1.633 nicm 2115: struct window_pane *window_add_pane(struct window *, struct window_pane *,
2116: u_int);
1.44 nicm 2117: void window_resize(struct window *, u_int, u_int);
1.398 nicm 2118: int window_zoom(struct window_pane *);
2119: int window_unzoom(struct window *);
1.453 nicm 2120: void window_lost_pane(struct window *, struct window_pane *);
1.1 nicm 2121: void window_remove_pane(struct window *, struct window_pane *);
2122: struct window_pane *window_pane_at_index(struct window *, u_int);
1.235 nicm 2123: struct window_pane *window_pane_next_by_number(struct window *,
1.511 nicm 2124: struct window_pane *, u_int);
1.235 nicm 2125: struct window_pane *window_pane_previous_by_number(struct window *,
1.511 nicm 2126: struct window_pane *, u_int);
1.298 nicm 2127: int window_pane_index(struct window_pane *, u_int *);
1.1 nicm 2128: u_int window_count_panes(struct window *);
2129: void window_destroy_panes(struct window *);
1.500 nicm 2130: struct window_pane *window_pane_find_by_id_str(const char *);
1.274 nicm 2131: struct window_pane *window_pane_find_by_id(u_int);
1.463 nicm 2132: int window_pane_spawn(struct window_pane *, int, char **,
1.569 nicm 2133: const char *, const char *, const char *, struct environ *,
1.455 nicm 2134: struct termios *, char **);
1.44 nicm 2135: void window_pane_resize(struct window_pane *, u_int, u_int);
1.366 nicm 2136: void window_pane_alternate_on(struct window_pane *,
2137: struct grid_cell *, int);
2138: void window_pane_alternate_off(struct window_pane *,
2139: struct grid_cell *, int);
1.685 nicm 2140: void window_pane_set_palette(struct window_pane *, u_int, int);
2141: void window_pane_unset_palette(struct window_pane *, u_int);
2142: void window_pane_reset_palette(struct window_pane *);
1.692 nicm 2143: int window_pane_get_palette(const struct window_pane *, int);
1.600 nicm 2144: int window_pane_set_mode(struct window_pane *,
2145: const struct window_mode *);
1.1 nicm 2146: void window_pane_reset_mode(struct window_pane *);
1.492 nicm 2147: void window_pane_key(struct window_pane *, struct client *,
1.571 nicm 2148: struct session *, key_code, struct mouse_event *);
1.678 nicm 2149: int window_pane_outside(struct window_pane *);
1.28 nicm 2150: int window_pane_visible(struct window_pane *);
1.600 nicm 2151: char *window_pane_search(struct window_pane *, const char *,
2152: u_int *);
1.256 nicm 2153: char *window_printable_flags(struct session *, struct winlink *);
1.211 nicm 2154: struct window_pane *window_pane_find_up(struct window_pane *);
2155: struct window_pane *window_pane_find_down(struct window_pane *);
2156: struct window_pane *window_pane_find_left(struct window_pane *);
2157: struct window_pane *window_pane_find_right(struct window_pane *);
1.311 nicm 2158: void window_set_name(struct window *, const char *);
1.352 nicm 2159: void window_remove_ref(struct window *);
1.345 nicm 2160: void winlink_clear_flags(struct winlink *);
1.526 nicm 2161: int winlink_shuffle_up(struct session *, struct winlink *);
1.1 nicm 2162:
2163: /* layout.c */
1.232 nicm 2164: u_int layout_count_cells(struct layout_cell *);
1.39 nicm 2165: struct layout_cell *layout_create_cell(struct layout_cell *);
2166: void layout_free_cell(struct layout_cell *);
2167: void layout_print_cell(struct layout_cell *, const char *, u_int);
1.641 nicm 2168: void layout_destroy_cell(struct window *, struct layout_cell *,
1.600 nicm 2169: struct layout_cell **);
2170: void layout_set_size(struct layout_cell *, u_int, u_int, u_int,
2171: u_int);
2172: void layout_make_leaf(struct layout_cell *, struct window_pane *);
1.39 nicm 2173: void layout_make_node(struct layout_cell *, enum layout_type);
2174: void layout_fix_offsets(struct layout_cell *);
2175: void layout_fix_panes(struct window *, u_int, u_int);
1.641 nicm 2176: void layout_resize_adjust(struct window *, struct layout_cell *,
2177: enum layout_type, int);
1.398 nicm 2178: void layout_init(struct window *, struct window_pane *);
1.39 nicm 2179: void layout_free(struct window *);
2180: void layout_resize(struct window *, u_int, u_int);
1.385 nicm 2181: void layout_resize_pane(struct window_pane *, enum layout_type,
1.650 nicm 2182: int, int);
1.385 nicm 2183: void layout_resize_pane_to(struct window_pane *, enum layout_type,
2184: u_int);
1.198 nicm 2185: void layout_assign_pane(struct layout_cell *, struct window_pane *);
1.600 nicm 2186: struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type,
1.643 nicm 2187: int, int, int);
1.39 nicm 2188: void layout_close_pane(struct window_pane *);
2189:
1.232 nicm 2190: /* layout-custom.c */
1.494 nicm 2191: char *layout_dump(struct layout_cell *);
1.232 nicm 2192: int layout_parse(struct window *, const char *);
2193:
1.39 nicm 2194: /* layout-set.c */
2195: int layout_set_lookup(const char *);
2196: u_int layout_set_select(struct window *, u_int);
2197: u_int layout_set_next(struct window *);
2198: u_int layout_set_previous(struct window *);
1.1 nicm 2199:
2200: /* window-clock.c */
2201: extern const struct window_mode window_clock_mode;
1.438 nicm 2202: extern const char window_clock_table[14][5][5];
1.1 nicm 2203:
2204: /* window-copy.c */
2205: extern const struct window_mode window_copy_mode;
1.560 nicm 2206: void window_copy_init_from_pane(struct window_pane *, int);
1.216 nicm 2207: void window_copy_init_for_output(struct window_pane *);
1.476 nicm 2208: void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
1.216 nicm 2209: void window_copy_vadd(struct window_pane *, const char *, va_list);
1.629 nicm 2210: void window_copy_pageup(struct window_pane *, int);
1.492 nicm 2211: void window_copy_start_drag(struct client *, struct mouse_event *);
1.564 nicm 2212: int window_copy_scroll_position(struct window_pane *);
1.1 nicm 2213:
2214: /* window-choose.c */
2215: extern const struct window_mode window_choose_mode;
1.343 nicm 2216: void window_choose_add(struct window_pane *,
2217: struct window_choose_data *);
1.1 nicm 2218: void window_choose_ready(struct window_pane *,
1.376 nicm 2219: u_int, void (*)(struct window_choose_data *));
1.375 nicm 2220: struct window_choose_data *window_choose_data_create (int,
2221: struct client *, struct session *);
2222: void window_choose_data_run(struct window_choose_data *);
1.344 nicm 2223: struct window_choose_data *window_choose_add_window(struct window_pane *,
1.377 nicm 2224: struct client *, struct session *, struct winlink *,
1.380 nicm 2225: const char *, const char *, u_int);
1.344 nicm 2226: struct window_choose_data *window_choose_add_session(struct window_pane *,
1.377 nicm 2227: struct client *, struct session *, const char *,
1.380 nicm 2228: const char *, u_int);
1.369 nicm 2229: void window_choose_expand_all(struct window_pane *);
1.408 nicm 2230: void window_choose_set_current(struct window_pane *, u_int);
1.1 nicm 2231:
2232: /* names.c */
1.540 nicm 2233: void check_window_name(struct window *);
1.417 nicm 2234: char *default_window_name(struct window *);
2235: char *parse_window_name(const char *);
1.219 nicm 2236:
2237: /* signal.c */
1.566 nicm 2238: void set_signals(void(*)(int, short, void *), void *);
1.349 nicm 2239: void clear_signals(int);
1.342 nicm 2240:
2241: /* control.c */
1.470 nicm 2242: void control_callback(struct client *, int, void *);
1.476 nicm 2243: void printflike(2, 3) control_write(struct client *, const char *, ...);
1.357 nicm 2244: void control_write_buffer(struct client *, struct evbuffer *);
1.353 nicm 2245:
2246: /* control-notify.c */
1.358 nicm 2247: void control_notify_input(struct client *, struct window_pane *,
2248: struct evbuffer *);
1.353 nicm 2249: void control_notify_window_layout_changed(struct window *);
2250: void control_notify_window_unlinked(struct session *, struct window *);
2251: void control_notify_window_linked(struct session *, struct window *);
2252: void control_notify_window_renamed(struct window *);
1.671 nicm 2253: void control_notify_client_session_changed(struct client *);
1.353 nicm 2254: void control_notify_session_renamed(struct session *);
2255: void control_notify_session_created(struct session *);
1.665 nicm 2256: void control_notify_session_closed(struct session *);
1.1 nicm 2257:
2258: /* session.c */
2259: extern struct sessions sessions;
1.124 nicm 2260: extern struct session_groups session_groups;
1.254 nicm 2261: int session_cmp(struct session *, struct session *);
2262: RB_PROTOTYPE(sessions, session, entry, session_cmp);
1.251 nicm 2263: int session_alive(struct session *);
1.1 nicm 2264: struct session *session_find(const char *);
1.500 nicm 2265: struct session *session_find_by_id_str(const char *);
1.402 nicm 2266: struct session *session_find_by_id(u_int);
1.463 nicm 2267: struct session *session_create(const char *, int, char **, const char *,
1.569 nicm 2268: const char *, struct environ *, struct termios *, int,
2269: u_int, u_int, char **);
1.192 nicm 2270: void session_destroy(struct session *);
1.520 nicm 2271: void session_unref(struct session *);
1.279 nicm 2272: int session_check_name(const char *);
1.536 nicm 2273: void session_update_activity(struct session *, struct timeval *);
1.239 nicm 2274: struct session *session_next_session(struct session *);
2275: struct session *session_previous_session(struct session *);
1.463 nicm 2276: struct winlink *session_new(struct session *, const char *, int, char **,
1.569 nicm 2277: const char *, const char *, int, char **);
1.463 nicm 2278: struct winlink *session_attach(struct session *, struct window *, int,
2279: char **);
1.1 nicm 2280: int session_detach(struct session *, struct winlink *);
1.497 nicm 2281: int session_has(struct session *, struct window *);
1.504 nicm 2282: int session_is_linked(struct session *, struct window *);
1.1 nicm 2283: int session_next(struct session *, int);
2284: int session_previous(struct session *, int);
2285: int session_select(struct session *, int);
2286: int session_last(struct session *);
1.392 nicm 2287: int session_set_current(struct session *, struct winlink *);
1.124 nicm 2288: struct session_group *session_group_find(struct session *);
2289: u_int session_group_index(struct session_group *);
2290: void session_group_add(struct session *, struct session *);
2291: void session_group_synchronize_to(struct session *);
2292: void session_group_synchronize_from(struct session *);
1.330 nicm 2293: void session_renumber_windows(struct session *);
1.1 nicm 2294:
2295: /* utf8.c */
1.456 nicm 2296: void utf8_set(struct utf8_data *, u_char);
1.576 nicm 2297: void utf8_copy(struct utf8_data *, const struct utf8_data *);
1.579 nicm 2298: enum utf8_state utf8_open(struct utf8_data *, u_char);
2299: enum utf8_state utf8_append(struct utf8_data *, u_char);
1.622 nicm 2300: enum utf8_state utf8_combine(const struct utf8_data *, wchar_t *);
1.621 nicm 2301: enum utf8_state utf8_split(wchar_t, struct utf8_data *);
1.456 nicm 2302: int utf8_strvis(char *, const char *, size_t, int);
1.701 nicm 2303: int utf8_stravis(char **, const char *, int);
1.573 nicm 2304: char *utf8_sanitize(const char *);
1.651 nicm 2305: size_t utf8_strlen(const struct utf8_data *);
2306: u_int utf8_strwidth(const struct utf8_data *, ssize_t);
1.456 nicm 2307: struct utf8_data *utf8_fromcstr(const char *);
2308: char *utf8_tocstr(struct utf8_data *);
2309: u_int utf8_cstrwidth(const char *);
1.620 nicm 2310: char *utf8_rtrimcstr(const char *, u_int);
1.456 nicm 2311: char *utf8_trimcstr(const char *, u_int);
1.575 nicm 2312: char *utf8_padcstr(const char *, u_int);
1.1 nicm 2313:
2314: /* procname.c */
2315: char *get_proc_name(int, char *);
2316:
2317: /* log.c */
1.588 nicm 2318: void log_add_level(void);
2319: int log_get_level(void);
2320: void log_open(const char *);
2321: void log_close(void);
1.476 nicm 2322: void printflike(1, 2) log_debug(const char *, ...);
1.581 nicm 2323: __dead void printflike(1, 2) fatal(const char *, ...);
2324: __dead void printflike(1, 2) fatalx(const char *, ...);
1.435 nicm 2325:
2326: /* style.c */
2327: int style_parse(const struct grid_cell *,
2328: struct grid_cell *, const char *);
2329: const char *style_tostring(struct grid_cell *);
1.450 nicm 2330: void style_apply(struct grid_cell *, struct options *,
2331: const char *);
2332: void style_apply_update(struct grid_cell *, struct options *,
2333: const char *);
1.559 nicm 2334: int style_equal(const struct grid_cell *,
2335: const struct grid_cell *);
1.702 nicm 2336:
2337: /* pty.c */
2338: int pty_open(int *);
2339: pid_t pty_fork(int, int *, char *, size_t, struct winsize *);
1.1 nicm 2340:
2341: #endif /* TMUX_H */