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