tmux  3.2a
About: tmux is a terminal multiplexer that lets you switch easily between several programs in one terminal.
  Fossies Dox: tmux-3.2a.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tmux.h
Go to the documentation of this file.
1 /* $OpenBSD$ */
2 
3 /*
4  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef TMUX_H
20 #define TMUX_H
21 
22 #include <sys/time.h>
23 #include <sys/uio.h>
24 
25 #include <limits.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <termios.h>
29 
30 #ifdef HAVE_UTEMPTER
31 #include <utempter.h>
32 #endif
33 
34 #include "compat.h"
35 #include "xmalloc.h"
36 
37 extern char **environ;
38 
39 struct args;
40 struct args_value;
41 struct client;
42 struct cmd;
43 struct cmd_find_state;
44 struct cmdq_item;
45 struct cmdq_list;
46 struct cmdq_state;
47 struct cmds;
48 struct control_state;
49 struct environ;
50 struct format_job_tree;
51 struct format_tree;
52 struct input_ctx;
53 struct job;
54 struct mode_tree_data;
55 struct mouse_event;
56 struct options;
57 struct options_array_item;
58 struct options_entry;
59 struct screen_write_citem;
60 struct screen_write_cline;
61 struct screen_write_ctx;
62 struct session;
63 struct tty_ctx;
64 struct tmuxpeer;
65 struct tmuxproc;
66 struct winlink;
67 
68 /* Client-server protocol version. */
69 #define PROTOCOL_VERSION 8
70 
71 /* Default configuration files and socket paths. */
72 #ifndef TMUX_CONF
73 #define TMUX_CONF "/etc/tmux.conf:~/.tmux.conf"
74 #endif
75 #ifndef TMUX_SOCK
76 #define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP
77 #endif
78 
79 /* Minimum layout cell size, NOT including border lines. */
80 #define PANE_MINIMUM 1
81 
82 /* Minimum and maximum window size. */
83 #define WINDOW_MINIMUM PANE_MINIMUM
84 #define WINDOW_MAXIMUM 10000
85 
86 /* Automatic name refresh interval, in microseconds. Must be < 1 second. */
87 #define NAME_INTERVAL 500000
88 
89 /* Default pixel cell sizes. */
90 #define DEFAULT_XPIXEL 16
91 #define DEFAULT_YPIXEL 32
92 
93 /* Attribute to make GCC check printf-like arguments. */
94 #define printflike(a, b) __attribute__ ((format (printf, a, b)))
95 
96 /* Number of items in array. */
97 #ifndef nitems
98 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
99 #endif
100 
101 /* Alert option values. */
102 #define ALERT_NONE 0
103 #define ALERT_ANY 1
104 #define ALERT_CURRENT 2
105 #define ALERT_OTHER 3
106 
107 /* Visual option values. */
108 #define VISUAL_OFF 0
109 #define VISUAL_ON 1
110 #define VISUAL_BOTH 2
111 
112 /* No key or unknown key. */
113 #define KEYC_NONE 0x000ff000000000ULL
114 #define KEYC_UNKNOWN 0x000fe000000000ULL
115 
116 /*
117  * Base for special (that is, not Unicode) keys. An enum must be at most a
118  * signed int, so these are based in the highest Unicode PUA.
119  */
120 #define KEYC_BASE 0x0000000010e000ULL
121 #define KEYC_USER 0x0000000010f000ULL
122 
123 /* Key modifier bits. */
124 #define KEYC_META 0x00100000000000ULL
125 #define KEYC_CTRL 0x00200000000000ULL
126 #define KEYC_SHIFT 0x00400000000000ULL
127 
128 /* Key flag bits. */
129 #define KEYC_LITERAL 0x01000000000000ULL
130 #define KEYC_KEYPAD 0x02000000000000ULL
131 #define KEYC_CURSOR 0x04000000000000ULL
132 #define KEYC_IMPLIED_META 0x08000000000000ULL
133 #define KEYC_BUILD_MODIFIERS 0x10000000000000ULL
134 
135 /* Masks for key bits. */
136 #define KEYC_MASK_MODIFIERS 0x00f00000000000ULL
137 #define KEYC_MASK_FLAGS 0xff000000000000ULL
138 #define KEYC_MASK_KEY 0x000fffffffffffULL
139 
140 /* Available user keys. */
141 #define KEYC_NUSER 1000
142 
143 /* Is this a mouse key? */
144 #define KEYC_IS_MOUSE(key) \
145  (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
146  ((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
147 
148 /* Is this a Unicode key? */
149 #define KEYC_IS_UNICODE(key) \
150  (((key) & KEYC_MASK_KEY) > 0x7f && \
151  (((key) & KEYC_MASK_KEY) < KEYC_BASE || \
152  ((key) & KEYC_MASK_KEY) >= KEYC_BASE_END))
153 
154 /* Multiple click timeout. */
155 #define KEYC_CLICK_TIMEOUT 300
156 
157 /* Mouse key codes. */
158 #define KEYC_MOUSE_KEY(name) \
159  KEYC_ ## name ## _PANE, \
160  KEYC_ ## name ## _STATUS, \
161  KEYC_ ## name ## _STATUS_LEFT, \
162  KEYC_ ## name ## _STATUS_RIGHT, \
163  KEYC_ ## name ## _STATUS_DEFAULT, \
164  KEYC_ ## name ## _BORDER
165 #define KEYC_MOUSE_STRING(name, s) \
166  { #s "Pane", KEYC_ ## name ## _PANE }, \
167  { #s "Status", KEYC_ ## name ## _STATUS }, \
168  { #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
169  { #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
170  { #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
171  { #s "Border", KEYC_ ## name ## _BORDER }
172 
173 /*
174  * A single key. This can be ASCII or Unicode or one of the keys between
175  * KEYC_BASE and KEYC_BASE_END.
176  */
177 typedef unsigned long long key_code;
178 
179 /* Special key codes. */
180 enum {
181  /* Focus events. */
184 
185  /* "Any" key, used if not found in key table. */
187 
188  /* Paste brackets. */
191 
192  /* Mouse keys. */
193  KEYC_MOUSE, /* unclassified mouse event */
194  KEYC_DRAGGING, /* dragging in progress */
195  KEYC_DOUBLECLICK, /* double click complete */
196  KEYC_MOUSE_KEY(MOUSEMOVE),
197  KEYC_MOUSE_KEY(MOUSEDOWN1),
198  KEYC_MOUSE_KEY(MOUSEDOWN2),
199  KEYC_MOUSE_KEY(MOUSEDOWN3),
200  KEYC_MOUSE_KEY(MOUSEUP1),
201  KEYC_MOUSE_KEY(MOUSEUP2),
202  KEYC_MOUSE_KEY(MOUSEUP3),
203  KEYC_MOUSE_KEY(MOUSEDRAG1),
204  KEYC_MOUSE_KEY(MOUSEDRAG2),
205  KEYC_MOUSE_KEY(MOUSEDRAG3),
206  KEYC_MOUSE_KEY(MOUSEDRAGEND1),
207  KEYC_MOUSE_KEY(MOUSEDRAGEND2),
208  KEYC_MOUSE_KEY(MOUSEDRAGEND3),
209  KEYC_MOUSE_KEY(WHEELUP),
210  KEYC_MOUSE_KEY(WHEELDOWN),
211  KEYC_MOUSE_KEY(SECONDCLICK1),
212  KEYC_MOUSE_KEY(SECONDCLICK2),
213  KEYC_MOUSE_KEY(SECONDCLICK3),
214  KEYC_MOUSE_KEY(DOUBLECLICK1),
215  KEYC_MOUSE_KEY(DOUBLECLICK2),
216  KEYC_MOUSE_KEY(DOUBLECLICK3),
217  KEYC_MOUSE_KEY(TRIPLECLICK1),
218  KEYC_MOUSE_KEY(TRIPLECLICK2),
219  KEYC_MOUSE_KEY(TRIPLECLICK3),
220 
221  /* Backspace key. */
223 
224  /* Function keys. */
244 
245  /* Arrow keys. */
250 
251  /* Numeric keypad. */
268 
269  /* End of special keys. */
271 };
272 
273 /* Termcap codes. */
501  TTYC_XT
502 };
503 
504 /* Message codes. */
505 enum msgtype {
507 
511  MSG_IDENTIFY_OLDCWD, /* unused */
521 
522  MSG_COMMAND = 200,
533  MSG_OLDSTDERR, /* unused */
534  MSG_OLDSTDIN, /* unused */
535  MSG_OLDSTDOUT, /* unused */
541 
549 };
550 
551 /*
552  * Message data.
553  *
554  * Don't forget to bump PROTOCOL_VERSION if any of these change!
555  */
556 struct msg_command {
557  int argc;
558 }; /* followed by packed argv */
559 
561  int stream;
562  int fd;
563 }; /* followed by path */
564 
566  int stream;
567 };
568 
570  int stream;
571  int error;
572 };
573 
575  int stream;
576  int fd;
577  int flags;
578 }; /* followed by path */
579 
581  int stream;
582 }; /* followed by data */
583 
585  int stream;
586  int error;
587 };
588 
590  int stream;
591 };
592 
593 /* Mode keys. */
594 #define MODEKEY_EMACS 0
595 #define MODEKEY_VI 1
596 
597 /* Modes. */
598 #define MODE_CURSOR 0x1
599 #define MODE_INSERT 0x2
600 #define MODE_KCURSOR 0x4
601 #define MODE_KKEYPAD 0x8
602 #define MODE_WRAP 0x10
603 #define MODE_MOUSE_STANDARD 0x20
604 #define MODE_MOUSE_BUTTON 0x40
605 #define MODE_BLINKING 0x80
606 #define MODE_MOUSE_UTF8 0x100
607 #define MODE_MOUSE_SGR 0x200
608 #define MODE_BRACKETPASTE 0x400
609 #define MODE_FOCUSON 0x800
610 #define MODE_MOUSE_ALL 0x1000
611 #define MODE_ORIGIN 0x2000
612 #define MODE_CRLF 0x4000
613 #define MODE_KEXTENDED 0x8000
614 
615 #define ALL_MODES 0xffffff
616 #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
617 #define MOTION_MOUSE_MODES (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
618 
619 /* A single UTF-8 character. */
620 typedef u_int utf8_char;
621 
622 /*
623  * An expanded UTF-8 character. UTF8_SIZE must be big enough to hold combining
624  * characters as well. It can't be more than 32 bytes without changes to how
625  * characters are stored.
626  */
627 #define UTF8_SIZE 21
628 struct utf8_data {
629  u_char data[UTF8_SIZE];
630 
631  u_char have;
632  u_char size;
633 
634  u_char width; /* 0xff if invalid */
635 };
639  UTF8_ERROR
640 };
641 
642 /* Colour flags. */
643 #define COLOUR_FLAG_256 0x01000000
644 #define COLOUR_FLAG_RGB 0x02000000
645 
646 /* Special colours. */
647 #define COLOUR_DEFAULT(c) ((c) == 8 || (c) == 9)
648 
649 /* Grid attributes. Anything above 0xff is stored in an extended cell. */
650 #define GRID_ATTR_BRIGHT 0x1
651 #define GRID_ATTR_DIM 0x2
652 #define GRID_ATTR_UNDERSCORE 0x4
653 #define GRID_ATTR_BLINK 0x8
654 #define GRID_ATTR_REVERSE 0x10
655 #define GRID_ATTR_HIDDEN 0x20
656 #define GRID_ATTR_ITALICS 0x40
657 #define GRID_ATTR_CHARSET 0x80 /* alternative character set */
658 #define GRID_ATTR_STRIKETHROUGH 0x100
659 #define GRID_ATTR_UNDERSCORE_2 0x200
660 #define GRID_ATTR_UNDERSCORE_3 0x400
661 #define GRID_ATTR_UNDERSCORE_4 0x800
662 #define GRID_ATTR_UNDERSCORE_5 0x1000
663 #define GRID_ATTR_OVERLINE 0x2000
664 
665 /* All underscore attributes. */
666 #define GRID_ATTR_ALL_UNDERSCORE \
667  (GRID_ATTR_UNDERSCORE| \
668  GRID_ATTR_UNDERSCORE_2| \
669  GRID_ATTR_UNDERSCORE_3| \
670  GRID_ATTR_UNDERSCORE_4| \
671  GRID_ATTR_UNDERSCORE_5)
672 
673 /* Grid flags. */
674 #define GRID_FLAG_FG256 0x1
675 #define GRID_FLAG_BG256 0x2
676 #define GRID_FLAG_PADDING 0x4
677 #define GRID_FLAG_EXTENDED 0x8
678 #define GRID_FLAG_SELECTED 0x10
679 #define GRID_FLAG_NOPALETTE 0x20
680 #define GRID_FLAG_CLEARED 0x40
681 
682 /* Grid line flags. */
683 #define GRID_LINE_WRAPPED 0x1
684 #define GRID_LINE_EXTENDED 0x2
685 #define GRID_LINE_DEAD 0x4
686 
687 /* Grid cell data. */
688 struct grid_cell {
689  struct utf8_data data;
690  u_short attr;
691  u_char flags;
692  int fg;
693  int bg;
694  int us;
695 };
696 
697 /* Grid extended cell entry. */
700  u_short attr;
701  u_char flags;
702  int fg;
703  int bg;
704  int us;
705 } __packed;
706 
707 /* Grid cell entry. */
709  u_char flags;
710  union {
711  u_int offset;
712  struct {
713  u_char attr;
714  u_char fg;
715  u_char bg;
716  u_char data;
717  } data;
718  };
719 } __packed;
720 
721 /* Grid line. */
722 struct grid_line {
723  u_int cellused;
724  u_int cellsize;
726 
727  u_int extdsize;
729 
730  int flags;
731 } __packed;
732 
733 /* Entire grid of cells. */
734 struct grid {
735  int flags;
736 #define GRID_HISTORY 0x1 /* scroll lines into history */
737 
738  u_int sx;
739  u_int sy;
740 
741  u_int hscrolled;
742  u_int hsize;
743  u_int hlimit;
744 
746 };
747 
748 /* Virtual cursor in a grid. */
749 struct grid_reader {
750  struct grid *gd;
751  u_int cx;
752  u_int cy;
753 };
754 
755 /* Style alignment. */
762 };
763 
764 /* Style list. */
771 };
772 
773 /* Style range. */
779 };
780 struct style_range {
781  enum style_range_type type;
782  u_int argument;
783 
784  u_int start;
785  u_int end; /* not included */
786 
788 };
789 TAILQ_HEAD(style_ranges, style_range);
790 
791 /* Style default. */
796 };
797 
798 /* Style option. */
799 struct style {
800  struct grid_cell gc;
801  int ignore;
802 
803  int fill;
804  enum style_align align;
805  enum style_list list;
806 
809 
811 };
812 
813 /* Virtual screen. */
814 struct screen_sel;
815 struct screen_titles;
816 struct screen {
817  char *title;
818  char *path;
819  struct screen_titles *titles;
820 
821  struct grid *grid; /* grid data */
822 
823  u_int cx; /* cursor x */
824  u_int cy; /* cursor y */
825 
826  u_int cstyle; /* cursor style */
827  char *ccolour; /* cursor colour string */
828 
829  u_int rupper; /* scroll region top */
830  u_int rlower; /* scroll region bottom */
831 
832  int mode;
833 
834  u_int saved_cx;
835  u_int saved_cy;
836  struct grid *saved_grid;
837  struct grid_cell saved_cell;
839 
840  bitstr_t *tabs;
841  struct screen_sel *sel;
842 
844 };
845 
846 /* Screen write context. */
848  struct tty_ctx *);
850  struct window_pane *wp;
851  struct screen *s;
852 
853  int flags;
854 #define SCREEN_WRITE_SYNC 0x1
855 
857  void *arg;
858 
860  u_int scrolled;
861  u_int bg;
862 };
863 
864 /* Screen redraw context. */
866  struct client *c;
867 
868  u_int statuslines;
870 
873 
874  u_int sx;
875  u_int sy;
876  u_int ox;
877  u_int oy;
878 };
879 
880 /* Screen size. */
881 #define screen_size_x(s) ((s)->grid->sx)
882 #define screen_size_y(s) ((s)->grid->sy)
883 #define screen_hsize(s) ((s)->grid->hsize)
884 #define screen_hlimit(s) ((s)->grid->hlimit)
885 
886 /* Menu. */
887 struct menu_item {
888  const char *name;
890  const char *command;
891 };
892 struct menu {
893  const char *title;
894  struct menu_item *items;
895  u_int count;
896  u_int width;
897 };
898 typedef void (*menu_choice_cb)(struct menu *, u_int, key_code, void *);
899 
900 /*
901  * Window mode. Windows can be in several modes and this is used to call the
902  * right function to handle input and output.
903  */
904 struct window_mode_entry;
905 struct window_mode {
906  const char *name;
907  const char *default_format;
908 
909  struct screen *(*init)(struct window_mode_entry *,
910  struct cmd_find_state *, struct args *);
911  void (*free)(struct window_mode_entry *);
912  void (*resize)(struct window_mode_entry *, u_int, u_int);
913  void (*update)(struct window_mode_entry *);
914  void (*key)(struct window_mode_entry *, struct client *,
915  struct session *, struct winlink *, key_code,
916  struct mouse_event *);
917 
918  const char *(*key_table)(struct window_mode_entry *);
919  void (*command)(struct window_mode_entry *, struct client *,
920  struct session *, struct winlink *, struct args *,
921  struct mouse_event *);
922  void (*formats)(struct window_mode_entry *,
923  struct format_tree *);
924 };
925 
926 /* Active window mode. */
928  struct window_pane *wp;
929  struct window_pane *swp;
930 
931  const struct window_mode *mode;
932  void *data;
933 
934  struct screen *screen;
935  u_int prefix;
936 
938 };
939 
940 /* Offsets into pane buffer. */
942  size_t used;
943 };
944 
945 /* Queued pane resize. */
947  u_int sx;
948  u_int sy;
949 
950  u_int osx;
951  u_int osy;
952 
954 };
955 TAILQ_HEAD(window_pane_resizes, window_pane_resize);
956 
957 /* Child window structure. */
958 struct window_pane {
959  u_int id;
961 
962  struct window *window;
963  struct options *options;
964 
967 
968  u_int sx;
969  u_int sy;
970 
971  u_int xoff;
972  u_int yoff;
973 
974  int fg;
975  int bg;
976 
977  int flags;
978 #define PANE_REDRAW 0x1
979 #define PANE_DROP 0x2
980 #define PANE_FOCUSED 0x4
981 /* 0x8 unused */
982 /* 0x10 unused */
983 #define PANE_FOCUSPUSH 0x20
984 #define PANE_INPUTOFF 0x40
985 #define PANE_CHANGED 0x80
986 #define PANE_EXITED 0x100
987 #define PANE_STATUSREADY 0x200
988 #define PANE_STATUSDRAWN 0x400
989 #define PANE_EMPTY 0x800
990 #define PANE_STYLECHANGED 0x1000
991 
992  int argc;
993  char **argv;
994  char *shell;
995  char *cwd;
996 
997  pid_t pid;
999  int status;
1000 
1001  int fd;
1002  struct bufferevent *event;
1003 
1004  struct window_pane_offset offset;
1005  size_t base_offset;
1006 
1007  struct window_pane_resizes resize_queue;
1008  struct event resize_timer;
1009 
1010  struct input_ctx *ictx;
1011 
1012  struct grid_cell cached_gc;
1013  struct grid_cell cached_active_gc;
1014  int *palette;
1015 
1016  int pipe_fd;
1017  struct bufferevent *pipe_event;
1019 
1020  struct screen *screen;
1021  struct screen base;
1022 
1023  struct screen status_screen;
1024  size_t status_size;
1025 
1027 
1028  char *searchstr;
1030 
1032  struct grid_cell border_gc;
1033 
1035  RB_ENTRY(window_pane) tree_entry;
1036 };
1037 TAILQ_HEAD(window_panes, window_pane);
1038 RB_HEAD(window_pane_tree, window_pane);
1039 
1040 /* Window structure. */
1041 struct window {
1042  u_int id;
1043  void *latest;
1044 
1045  char *name;
1046  struct event name_event;
1047  struct timeval name_time;
1048 
1049  struct event alerts_timer;
1050  struct event offset_timer;
1051 
1052  struct timeval activity_time;
1053 
1056  struct window_panes panes;
1057 
1061  char *old_layout;
1062 
1063  u_int sx;
1064  u_int sy;
1065  u_int xpixel;
1066  u_int ypixel;
1067 
1068  u_int new_sx;
1069  u_int new_sy;
1070  u_int new_xpixel;
1071  u_int new_ypixel;
1072 
1073  int flags;
1074 #define WINDOW_BELL 0x1
1075 #define WINDOW_ACTIVITY 0x2
1076 #define WINDOW_SILENCE 0x4
1077 #define WINDOW_ZOOMED 0x8
1078 #define WINDOW_WASZOOMED 0x10
1079 #define WINDOW_RESIZE 0x20
1080 #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
1081 
1083  TAILQ_ENTRY(window) alerts_entry;
1084 
1085  struct options *options;
1086 
1087  u_int references;
1088  TAILQ_HEAD(, winlink) winlinks;
1089 
1091 };
1093 
1094 /* Entry on local window list. */
1095 struct winlink {
1096  int idx;
1097  struct session *session;
1098  struct window *window;
1099 
1100  int flags;
1101 #define WINLINK_BELL 0x1
1102 #define WINLINK_ACTIVITY 0x2
1103 #define WINLINK_SILENCE 0x4
1104 #define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
1105 
1109 };
1110 RB_HEAD(winlinks, winlink);
1111 TAILQ_HEAD(winlink_stack, winlink);
1112 
1113 /* Window size option. */
1114 #define WINDOW_SIZE_LARGEST 0
1115 #define WINDOW_SIZE_SMALLEST 1
1116 #define WINDOW_SIZE_MANUAL 2
1117 #define WINDOW_SIZE_LATEST 3
1118 
1119 /* Pane border status option. */
1120 #define PANE_STATUS_OFF 0
1121 #define PANE_STATUS_TOP 1
1122 #define PANE_STATUS_BOTTOM 2
1123 
1124 /* Pane border lines option. */
1125 #define PANE_LINES_SINGLE 0
1126 #define PANE_LINES_DOUBLE 1
1127 #define PANE_LINES_HEAVY 2
1128 #define PANE_LINES_SIMPLE 3
1129 #define PANE_LINES_NUMBER 4
1130 
1131 /* Layout direction. */
1136 };
1137 
1138 /* Layout cells queue. */
1139 TAILQ_HEAD(layout_cells, layout_cell);
1140 
1141 /* Layout cell. */
1142 struct layout_cell {
1143  enum layout_type type;
1144 
1146 
1147  u_int sx;
1148  u_int sy;
1149 
1150  u_int xoff;
1151  u_int yoff;
1152 
1153  struct window_pane *wp;
1154  struct layout_cells cells;
1155 
1157 };
1158 
1159 /* Environment variable. */
1161  char *name;
1162  char *value;
1163 
1164  int flags;
1165 #define ENVIRON_HIDDEN 0x1
1166 
1168 };
1169 
1170 /* Client session. */
1172  const char *name;
1174 
1176 };
1178 
1179 struct session {
1180  u_int id;
1181 
1182  char *name;
1183  const char *cwd;
1184 
1185  struct timeval creation_time;
1186  struct timeval last_attached_time;
1187  struct timeval activity_time;
1188  struct timeval last_activity_time;
1189 
1190  struct event lock_timer;
1191 
1192  struct winlink *curw;
1193  struct winlink_stack lastw;
1194  struct winlinks windows;
1195 
1198 
1199  struct options *options;
1200 
1201 #define SESSION_PASTING 0x1
1202 #define SESSION_ALERTED 0x2
1203  int flags;
1204 
1205  u_int attached;
1206 
1207  struct termios *tio;
1208 
1209  struct environ *environ;
1210 
1212 
1215 };
1217 
1218 /* Mouse button masks. */
1219 #define MOUSE_MASK_BUTTONS 3
1220 #define MOUSE_MASK_SHIFT 4
1221 #define MOUSE_MASK_META 8
1222 #define MOUSE_MASK_CTRL 16
1223 #define MOUSE_MASK_DRAG 32
1224 #define MOUSE_MASK_WHEEL 64
1225 
1226 /* Mouse wheel states. */
1227 #define MOUSE_WHEEL_UP 0
1228 #define MOUSE_WHEEL_DOWN 1
1229 
1230 /* Mouse helpers. */
1231 #define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
1232 #define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
1233 #define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
1234 #define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
1235 
1236 /* Mouse input. */
1237 struct mouse_event {
1238  int valid;
1239  int ignore;
1240 
1242 
1245 
1246  u_int x;
1247  u_int y;
1248  u_int b;
1249 
1250  u_int lx;
1251  u_int ly;
1252  u_int lb;
1253 
1254  u_int ox;
1255  u_int oy;
1256 
1257  int s;
1258  int w;
1259  int wp;
1260 
1261  u_int sgr_type;
1262  u_int sgr_b;
1263 };
1264 
1265 /* Key event. */
1266 struct key_event {
1268  struct mouse_event m;
1269 };
1270 
1271 /* TTY information. */
1272 struct tty_key {
1273  char ch;
1275 
1276  struct tty_key *left;
1277  struct tty_key *right;
1278 
1279  struct tty_key *next;
1280 };
1281 
1282 struct tty_code;
1283 struct tty_term {
1284  char *name;
1285  struct tty *tty;
1287 
1288  char acs[UCHAR_MAX + 1][2];
1289 
1290  struct tty_code *codes;
1291 
1292 #define TERM_256COLOURS 0x1
1293 #define TERM_NOAM 0x2
1294 #define TERM_DECSLRM 0x4
1295 #define TERM_DECFRA 0x8
1296 #define TERM_RGBCOLOURS 0x10
1297 #define TERM_VT100LIKE 0x20
1298  int flags;
1299 
1301 };
1303 
1304 struct tty {
1305  struct client *client;
1306  struct event start_timer;
1307 
1308  u_int sx;
1309  u_int sy;
1310  u_int xpixel;
1311  u_int ypixel;
1312 
1313  u_int cx;
1314  u_int cy;
1315  u_int cstyle;
1316  char *ccolour;
1317 
1318  int oflag;
1319  u_int oox;
1320  u_int ooy;
1321  u_int osx;
1322  u_int osy;
1323 
1324  int mode;
1325 
1326  u_int rlower;
1327  u_int rupper;
1328 
1329  u_int rleft;
1330  u_int rright;
1331 
1332  struct event event_in;
1333  struct evbuffer *in;
1334  struct event event_out;
1335  struct evbuffer *out;
1336  struct event timer;
1337  size_t discarded;
1338 
1339  struct termios tio;
1340 
1341  struct grid_cell cell;
1342  struct grid_cell last_cell;
1343 
1344 #define TTY_NOCURSOR 0x1
1345 #define TTY_FREEZE 0x2
1346 #define TTY_TIMER 0x4
1347 /* 0x8 unused */
1348 #define TTY_STARTED 0x10
1349 #define TTY_OPENED 0x20
1350 /* 0x40 unused */
1351 #define TTY_BLOCK 0x80
1352 #define TTY_HAVEDA 0x100
1353 #define TTY_HAVEXDA 0x200
1354 #define TTY_SYNCING 0x400
1355  int flags;
1356 
1357  struct tty_term *term;
1358 
1363  void (*mouse_drag_update)(struct client *,
1364  struct mouse_event *);
1365  void (*mouse_drag_release)(struct client *,
1366  struct mouse_event *);
1367 
1368  struct event key_timer;
1370 };
1371 
1372 /* TTY command context. */
1373 typedef void (*tty_ctx_redraw_cb)(const struct tty_ctx *);
1374 typedef int (*tty_ctx_set_client_cb)(struct tty_ctx *, struct client *);
1375 struct tty_ctx {
1376  struct screen *s;
1377 
1380  void *arg;
1381 
1382  const struct grid_cell *cell;
1383  int wrapped;
1384 
1385  u_int num;
1386  void *ptr;
1387 
1388  /*
1389  * Cursor and region position before the screen was updated - this is
1390  * where the command should be applied; the values in the screen have
1391  * already been updated.
1392  */
1393  u_int ocx;
1394  u_int ocy;
1395 
1396  u_int orupper;
1397  u_int orlower;
1398 
1399  /* Target region (usually pane) offset and size. */
1400  u_int xoff;
1401  u_int yoff;
1402  u_int rxoff;
1403  u_int ryoff;
1404  u_int sx;
1405  u_int sy;
1406 
1407  /* The background colour used for clearing (erasing). */
1408  u_int bg;
1409 
1410  /* The default colours and palette. */
1411  struct grid_cell defaults;
1412  int *palette;
1413 
1414  /* Containing region (usually window) offset and size. */
1415  int bigger;
1416  u_int wox;
1417  u_int woy;
1418  u_int wsx;
1419  u_int wsy;
1420 };
1421 
1422 /* Saved message entry. */
1424  char *msg;
1425  u_int msg_num;
1426  struct timeval msg_time;
1427 
1429 };
1430 TAILQ_HEAD(message_list, message_entry);
1431 
1432 /* Parsed arguments structures. */
1433 struct args_entry;
1434 RB_HEAD(args_tree, args_entry);
1435 struct args {
1436  struct args_tree tree;
1437  int argc;
1438  char **argv;
1439 };
1440 
1441 /* Command find structures. */
1446 };
1448  int flags;
1450 
1451  struct session *s;
1452  struct winlink *wl;
1453  struct window *w;
1454  struct window_pane *wp;
1455  int idx;
1456 };
1457 
1458 /* Command find flags. */
1459 #define CMD_FIND_PREFER_UNATTACHED 0x1
1460 #define CMD_FIND_QUIET 0x2
1461 #define CMD_FIND_WINDOW_INDEX 0x4
1462 #define CMD_FIND_DEFAULT_MARKED 0x8
1463 #define CMD_FIND_EXACT_SESSION 0x10
1464 #define CMD_FIND_EXACT_WINDOW 0x20
1465 #define CMD_FIND_CANFAIL 0x40
1466 
1467 /* List of commands. */
1468 struct cmd_list {
1470  u_int group;
1471  struct cmds *list;
1472 };
1473 
1474 /* Command return values. */
1480 };
1481 
1482 /* Command parse result. */
1487 };
1489  enum cmd_parse_status status;
1491  char *error;
1492 };
1494  int flags;
1495 #define CMD_PARSE_QUIET 0x1
1496 #define CMD_PARSE_PARSEONLY 0x2
1497 #define CMD_PARSE_NOALIAS 0x4
1498 #define CMD_PARSE_VERBOSE 0x8
1499 #define CMD_PARSE_ONEGROUP 0x10
1500 
1501  const char *file;
1502  u_int line;
1503 
1504  struct cmdq_item *item;
1505  struct client *c;
1506  struct cmd_find_state fs;
1507 };
1508 
1509 /* Command queue flags. */
1510 #define CMDQ_STATE_REPEAT 0x1
1511 #define CMDQ_STATE_CONTROL 0x2
1512 #define CMDQ_STATE_NOHOOKS 0x4
1513 
1514 /* Command queue callback. */
1515 typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
1516 
1517 /* Command definition flag. */
1519  char flag;
1520  enum cmd_find_type type;
1521  int flags;
1522 };
1523 
1524 /* Command definition. */
1525 struct cmd_entry {
1526  const char *name;
1527  const char *alias;
1528 
1529  struct {
1530  const char *template;
1531  int lower;
1532  int upper;
1533  } args;
1534  const char *usage;
1535 
1536  struct cmd_entry_flag source;
1537  struct cmd_entry_flag target;
1538 
1539 #define CMD_STARTSERVER 0x1
1540 #define CMD_READONLY 0x2
1541 #define CMD_AFTERHOOK 0x4
1542 #define CMD_CLIENT_CFLAG 0x8
1543 #define CMD_CLIENT_TFLAG 0x10
1544 #define CMD_CLIENT_CANFAIL 0x20
1545  int flags;
1546 
1547  enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
1548 };
1549 
1550 /* Status line. */
1551 #define STATUS_LINES_LIMIT 5
1553  char *expanded;
1554  struct style_ranges ranges;
1555 };
1556 struct status_line {
1557  struct event timer;
1558 
1559  struct screen screen;
1560  struct screen *active;
1561  int references;
1562 
1563  struct grid_cell style;
1564  struct status_line_entry entries[STATUS_LINES_LIMIT];
1565 };
1566 
1567 /* File in client. */
1568 typedef void (*client_file_cb) (struct client *, const char *, int, int,
1569  struct evbuffer *, void *);
1570 struct client_file {
1571  struct client *c;
1572  struct tmuxpeer *peer;
1575  int stream;
1576 
1577  char *path;
1578  struct evbuffer *buffer;
1579  struct bufferevent *event;
1580 
1581  int fd;
1582  int error;
1583  int closed;
1584 
1586  void *data;
1587 
1589 };
1591 
1592 /* Client window. */
1594  u_int window;
1597 };
1598 RB_HEAD(client_windows, client_window);
1599 
1600 /* Client connection. */
1601 typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
1602 typedef void (*prompt_free_cb)(void *);
1603 typedef int (*overlay_check_cb)(struct client *, u_int, u_int);
1604 typedef struct screen *(*overlay_mode_cb)(struct client *, u_int *, u_int *);
1605 typedef void (*overlay_draw_cb)(struct client *, struct screen_redraw_ctx *);
1606 typedef int (*overlay_key_cb)(struct client *, struct key_event *);
1607 typedef void (*overlay_free_cb)(struct client *);
1608 struct client {
1609  const char *name;
1610  struct tmuxpeer *peer;
1611  struct cmdq_list *queue;
1612 
1613  struct client_windows windows;
1614 
1616  u_int pause_age;
1617 
1618  pid_t pid;
1619  int fd;
1620  int out_fd;
1621  struct event event;
1622  int retval;
1623 
1624  struct timeval creation_time;
1625  struct timeval activity_time;
1626 
1627  struct environ *environ;
1628  struct format_job_tree *jobs;
1629 
1630  char *title;
1631  const char *cwd;
1632 
1633  char *term_name;
1635  char *term_type;
1636  char **term_caps;
1637  u_int term_ncaps;
1638 
1639  char *ttyname;
1640  struct tty tty;
1641 
1642  size_t written;
1643  size_t discarded;
1644  size_t redraw;
1645 
1646  struct event repeat_timer;
1647 
1648  struct event click_timer;
1650  struct mouse_event click_event;
1651 
1652  struct status_line status;
1653 
1654 #define CLIENT_TERMINAL 0x1
1655 #define CLIENT_LOGIN 0x2
1656 #define CLIENT_EXIT 0x4
1657 #define CLIENT_REDRAWWINDOW 0x8
1658 #define CLIENT_REDRAWSTATUS 0x10
1659 #define CLIENT_REPEAT 0x20
1660 #define CLIENT_SUSPENDED 0x40
1661 #define CLIENT_ATTACHED 0x80
1662 #define CLIENT_EXITED 0x100
1663 #define CLIENT_DEAD 0x200
1664 #define CLIENT_REDRAWBORDERS 0x400
1665 #define CLIENT_READONLY 0x800
1666 #define CLIENT_NOSTARTSERVER 0x1000
1667 #define CLIENT_CONTROL 0x2000
1668 #define CLIENT_CONTROLCONTROL 0x4000
1669 #define CLIENT_FOCUSED 0x8000
1670 #define CLIENT_UTF8 0x10000
1671 #define CLIENT_IGNORESIZE 0x20000
1672 #define CLIENT_IDENTIFIED 0x40000
1673 #define CLIENT_STATUSFORCE 0x80000
1674 #define CLIENT_DOUBLECLICK 0x100000
1675 #define CLIENT_TRIPLECLICK 0x200000
1676 #define CLIENT_SIZECHANGED 0x400000
1677 #define CLIENT_STATUSOFF 0x800000
1678 #define CLIENT_REDRAWSTATUSALWAYS 0x1000000
1679 #define CLIENT_REDRAWOVERLAY 0x2000000
1680 #define CLIENT_CONTROL_NOOUTPUT 0x4000000
1681 #define CLIENT_DEFAULTSOCKET 0x8000000
1682 #define CLIENT_STARTSERVER 0x10000000
1683 #define CLIENT_REDRAWPANES 0x20000000
1684 #define CLIENT_NOFORK 0x40000000
1685 #define CLIENT_ACTIVEPANE 0x80000000ULL
1686 #define CLIENT_CONTROL_PAUSEAFTER 0x100000000ULL
1687 #define CLIENT_CONTROL_WAITEXIT 0x200000000ULL
1688 #define CLIENT_ALLREDRAWFLAGS \
1689  (CLIENT_REDRAWWINDOW| \
1690  CLIENT_REDRAWSTATUS| \
1691  CLIENT_REDRAWSTATUSALWAYS| \
1692  CLIENT_REDRAWBORDERS| \
1693  CLIENT_REDRAWOVERLAY| \
1694  CLIENT_REDRAWPANES)
1695 #define CLIENT_UNATTACHEDFLAGS \
1696  (CLIENT_DEAD| \
1697  CLIENT_SUSPENDED| \
1698  CLIENT_EXIT)
1699 #define CLIENT_NOSIZEFLAGS \
1700  (CLIENT_DEAD| \
1701  CLIENT_SUSPENDED| \
1702  CLIENT_EXIT)
1703  uint64_t flags;
1704 
1705  enum {
1708  CLIENT_EXIT_DETACH
1709  } exit_type;
1710  enum msgtype exit_msgtype;
1713 
1715 
1716  uint64_t redraw_panes;
1717 
1721  struct event message_timer;
1722 
1731  enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
1733 
1734 #define PROMPT_SINGLE 0x1
1735 #define PROMPT_NUMERIC 0x2
1736 #define PROMPT_INCREMENTAL 0x4
1737 #define PROMPT_NOFORMAT 0x8
1738 #define PROMPT_KEY 0x10
1739 #define PROMPT_WINDOW 0x20
1740 #define PROMPT_TARGET 0x40
1742 
1743  struct session *session;
1745 
1747 
1748  void *pan_window;
1749  u_int pan_ox;
1750  u_int pan_oy;
1751 
1757  void *overlay_data;
1758  struct event overlay_timer;
1759 
1760  struct client_files files;
1761 
1763 };
1765 
1766 /* Control mode subscription type. */
1773 };
1774 
1775 /* Key binding and key table. */
1776 struct key_binding {
1779  const char *note;
1780 
1781  int flags;
1782 #define KEY_BINDING_REPEAT 0x1
1783 
1785 };
1786 RB_HEAD(key_bindings, key_binding);
1787 
1788 struct key_table {
1789  const char *name;
1790  struct key_bindings key_bindings;
1791  struct key_bindings default_key_bindings;
1792 
1793  u_int references;
1794 
1796 };
1798 
1799 /* Option data. */
1800 RB_HEAD(options_array, options_array_item);
1802  char *string;
1803  long long number;
1804  struct style style;
1805  struct options_array array;
1807 };
1808 
1809 /* Option table entries. */
1818 };
1819 
1820 #define OPTIONS_TABLE_NONE 0
1821 #define OPTIONS_TABLE_SERVER 0x1
1822 #define OPTIONS_TABLE_SESSION 0x2
1823 #define OPTIONS_TABLE_WINDOW 0x4
1824 #define OPTIONS_TABLE_PANE 0x8
1825 
1826 #define OPTIONS_TABLE_IS_ARRAY 0x1
1827 #define OPTIONS_TABLE_IS_HOOK 0x2
1828 #define OPTIONS_TABLE_IS_STYLE 0x4
1829 
1831  const char *name;
1832  const char *alternative_name;
1833  enum options_table_type type;
1834  int scope;
1835  int flags;
1836 
1837  u_int minimum;
1838  u_int maximum;
1839  const char **choices;
1840 
1841  const char *default_str;
1842  long long default_num;
1843  const char **default_arr;
1844 
1845  const char *separator;
1846  const char *pattern;
1847 
1848  const char *text;
1849  const char *unit;
1850 };
1851 
1853  const char *from;
1854  const char *to;
1855 };
1856 
1857 /* Common command usages. */
1858 #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
1859 #define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
1860 #define CMD_TARGET_SESSION_USAGE "[-t target-session]"
1861 #define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
1862 #define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
1863 #define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
1864 #define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
1865 #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
1866 #define CMD_BUFFER_USAGE "[-b buffer-name]"
1867 
1868 /* Spawn common context. */
1870  struct cmdq_item *item;
1871 
1872  struct session *s;
1873  struct winlink *wl;
1874  struct client *tc;
1875 
1876  struct window_pane *wp0;
1877  struct layout_cell *lc;
1878 
1879  const char *name;
1880  char **argv;
1881  int argc;
1882  struct environ *environ;
1883 
1884  int idx;
1885  const char *cwd;
1886 
1887  int flags;
1888 #define SPAWN_KILL 0x1
1889 #define SPAWN_DETACHED 0x2
1890 #define SPAWN_RESPAWN 0x4
1891 #define SPAWN_BEFORE 0x8
1892 #define SPAWN_NONOTIFY 0x10
1893 #define SPAWN_FULLSIZE 0x20
1894 #define SPAWN_EMPTY 0x40
1895 #define SPAWN_ZOOM 0x80
1896 };
1897 
1898 /* Mode tree sort order. */
1900  u_int field;
1902 };
1903 
1904 /* tmux.c */
1905 extern struct options *global_options;
1906 extern struct options *global_s_options;
1907 extern struct options *global_w_options;
1908 extern struct environ *global_environ;
1909 extern struct timeval start_time;
1910 extern const char *socket_path;
1911 extern const char *shell_command;
1912 extern int ptm_fd;
1913 extern const char *shell_command;
1914 int checkshell(const char *);
1915 void setblocking(int, int);
1916 uint64_t get_timer(void);
1917 const char *sig2name(int);
1918 const char *find_cwd(void);
1919 const char *find_home(void);
1920 const char *getversion(void);
1921 
1922 /* proc.c */
1923 struct imsg;
1924 int proc_send(struct tmuxpeer *, enum msgtype, int, const void *, size_t);
1925 struct tmuxproc *proc_start(const char *);
1926 void proc_loop(struct tmuxproc *, int (*)(void));
1927 void proc_exit(struct tmuxproc *);
1928 void proc_set_signals(struct tmuxproc *, void(*)(int));
1929 void proc_clear_signals(struct tmuxproc *, int);
1930 struct tmuxpeer *proc_add_peer(struct tmuxproc *, int,
1931  void (*)(struct imsg *, void *), void *);
1932 void proc_remove_peer(struct tmuxpeer *);
1933 void proc_kill_peer(struct tmuxpeer *);
1934 void proc_toggle_log(struct tmuxproc *);
1935 pid_t proc_fork_and_daemon(int *);
1936 
1937 /* cfg.c */
1938 extern int cfg_finished;
1939 extern struct client *cfg_client;
1940 extern char **cfg_files;
1941 extern u_int cfg_nfiles;
1942 extern int cfg_quiet;
1943 void start_cfg(void);
1944 int load_cfg(const char *, struct client *, struct cmdq_item *, int,
1945  struct cmdq_item **);
1946 int load_cfg_from_buffer(const void *, size_t, const char *,
1947  struct client *, struct cmdq_item *, int, struct cmdq_item **);
1948 void printflike(1, 2) cfg_add_cause(const char *, ...);
1949 void cfg_print_causes(struct cmdq_item *);
1950 void cfg_show_causes(struct session *);
1951 
1952 /* paste.c */
1953 struct paste_buffer;
1954 const char *paste_buffer_name(struct paste_buffer *);
1955 u_int paste_buffer_order(struct paste_buffer *);
1956 time_t paste_buffer_created(struct paste_buffer *);
1957 const char *paste_buffer_data(struct paste_buffer *, size_t *);
1958 struct paste_buffer *paste_walk(struct paste_buffer *);
1959 struct paste_buffer *paste_get_top(const char **);
1960 struct paste_buffer *paste_get_name(const char *);
1961 void paste_free(struct paste_buffer *);
1962 void paste_add(const char *, char *, size_t);
1963 int paste_rename(const char *, const char *, char **);
1964 int paste_set(char *, size_t, const char *, char **);
1965 void paste_replace(struct paste_buffer *, char *, size_t);
1966 char *paste_make_sample(struct paste_buffer *);
1967 
1968 /* format.c */
1969 #define FORMAT_STATUS 0x1
1970 #define FORMAT_FORCE 0x2
1971 #define FORMAT_NOJOBS 0x4
1972 #define FORMAT_VERBOSE 0x8
1973 #define FORMAT_NONE 0
1974 #define FORMAT_PANE 0x80000000U
1975 #define FORMAT_WINDOW 0x40000000U
1976 struct format_tree;
1977 struct format_modifier;
1978 typedef void *(*format_cb)(struct format_tree *);
1979 void format_tidy_jobs(void);
1980 const char *format_skip(const char *, const char *);
1981 int format_true(const char *);
1982 struct format_tree *format_create(struct client *, struct cmdq_item *, int,
1983  int);
1984 void format_free(struct format_tree *);
1985 void format_merge(struct format_tree *, struct format_tree *);
1986 struct window_pane *format_get_pane(struct format_tree *);
1987 void printflike(3, 4) format_add(struct format_tree *, const char *,
1988  const char *, ...);
1989 void format_add_tv(struct format_tree *, const char *,
1990  struct timeval *);
1991 void format_add_cb(struct format_tree *, const char *, format_cb);
1992 void format_each(struct format_tree *, void (*)(const char *,
1993  const char *, void *), void *);
1994 char *format_expand_time(struct format_tree *, const char *);
1995 char *format_expand(struct format_tree *, const char *);
1996 char *format_single(struct cmdq_item *, const char *,
1997  struct client *, struct session *, struct winlink *,
1998  struct window_pane *);
1999 char *format_single_from_state(struct cmdq_item *, const char *,
2000  struct client *, struct cmd_find_state *);
2001 char *format_single_from_target(struct cmdq_item *, const char *);
2002 struct format_tree *format_create_defaults(struct cmdq_item *, struct client *,
2003  struct session *, struct winlink *, struct window_pane *);
2005  struct client *, struct cmd_find_state *);
2007 void format_defaults(struct format_tree *, struct client *,
2008  struct session *, struct winlink *, struct window_pane *);
2009 void format_defaults_window(struct format_tree *, struct window *);
2010 void format_defaults_pane(struct format_tree *,
2011  struct window_pane *);
2013  struct paste_buffer *);
2014 void format_lost_client(struct client *);
2015 char *format_grid_word(struct grid *, u_int, u_int);
2016 char *format_grid_line(struct grid *, u_int);
2017 
2018 /* format-draw.c */
2019 void format_draw(struct screen_write_ctx *,
2020  const struct grid_cell *, u_int, const char *,
2021  struct style_ranges *);
2022 u_int format_width(const char *);
2023 char *format_trim_left(const char *, u_int);
2024 char *format_trim_right(const char *, u_int);
2025 
2026 /* notify.c */
2027 void notify_hook(struct cmdq_item *, const char *);
2028 void notify_client(const char *, struct client *);
2029 void notify_session(const char *, struct session *);
2030 void notify_winlink(const char *, struct winlink *);
2031 void notify_session_window(const char *, struct session *, struct window *);
2032 void notify_window(const char *, struct window *);
2033 void notify_pane(const char *, struct window_pane *);
2034 
2035 /* options.c */
2036 struct options *options_create(struct options *);
2037 void options_free(struct options *);
2038 struct options *options_get_parent(struct options *);
2039 void options_set_parent(struct options *, struct options *);
2040 struct options_entry *options_first(struct options *);
2041 struct options_entry *options_next(struct options_entry *);
2042 struct options_entry *options_empty(struct options *,
2043  const struct options_table_entry *);
2044 struct options_entry *options_default(struct options *,
2045  const struct options_table_entry *);
2046 char *options_default_to_string(const struct options_table_entry *);
2047 const char *options_name(struct options_entry *);
2048 struct options *options_owner(struct options_entry *);
2049 const struct options_table_entry *options_table_entry(struct options_entry *);
2050 struct options_entry *options_get_only(struct options *, const char *);
2051 struct options_entry *options_get(struct options *, const char *);
2052 void options_array_clear(struct options_entry *);
2053 union options_value *options_array_get(struct options_entry *, u_int);
2054 int options_array_set(struct options_entry *, u_int, const char *,
2055  int, char **);
2056 int options_array_assign(struct options_entry *, const char *,
2057  char **);
2062 int options_is_array(struct options_entry *);
2063 int options_is_string(struct options_entry *);
2064 char *options_to_string(struct options_entry *, int, int);
2065 char *options_parse(const char *, int *);
2066 struct options_entry *options_parse_get(struct options *, const char *, int *,
2067  int);
2068 char *options_match(const char *, int *, int *);
2069 struct options_entry *options_match_get(struct options *, const char *, int *,
2070  int, int *);
2071 const char *options_get_string(struct options *, const char *);
2072 long long options_get_number(struct options *, const char *);
2073 struct options_entry * printflike(4, 5) options_set_string(struct options *,
2074  const char *, int, const char *, ...);
2075 struct options_entry *options_set_number(struct options *, const char *,
2076  long long);
2077 int options_scope_from_name(struct args *, int,
2078  const char *, struct cmd_find_state *, struct options **,
2079  char **);
2080 int options_scope_from_flags(struct args *, int,
2081  struct cmd_find_state *, struct options **, char **);
2082 struct style *options_string_to_style(struct options *, const char *,
2083  struct format_tree *);
2084 int options_from_string(struct options *,
2085  const struct options_table_entry *, const char *,
2086  const char *, int, char **);
2087 void options_push_changes(const char *);
2088 int options_remove_or_default(struct options_entry *, int,
2089  char **);
2090 
2091 /* options-table.c */
2092 extern const struct options_table_entry options_table[];
2093 extern const struct options_name_map options_other_names[];
2094 
2095 /* job.c */
2096 typedef void (*job_update_cb) (struct job *);
2097 typedef void (*job_complete_cb) (struct job *);
2098 typedef void (*job_free_cb) (void *);
2099 #define JOB_NOWAIT 0x1
2100 #define JOB_KEEPWRITE 0x2
2101 #define JOB_PTY 0x4
2102 struct job *job_run(const char *, int, char **, struct session *,
2103  const char *, job_update_cb, job_complete_cb, job_free_cb,
2104  void *, int, int, int);
2105 void job_free(struct job *);
2106 void job_resize(struct job *, u_int, u_int);
2107 void job_check_died(pid_t, int);
2108 int job_get_status(struct job *);
2109 void *job_get_data(struct job *);
2110 struct bufferevent *job_get_event(struct job *);
2111 void job_kill_all(void);
2112 int job_still_running(void);
2113 void job_print_summary(struct cmdq_item *, int);
2114 
2115 /* environ.c */
2116 struct environ *environ_create(void);
2117 void environ_free(struct environ *);
2118 struct environ_entry *environ_first(struct environ *);
2119 struct environ_entry *environ_next(struct environ_entry *);
2120 void environ_copy(struct environ *, struct environ *);
2121 struct environ_entry *environ_find(struct environ *, const char *);
2122 void printflike(4, 5) environ_set(struct environ *, const char *, int,
2123  const char *, ...);
2124 void environ_clear(struct environ *, const char *);
2125 void environ_put(struct environ *, const char *, int);
2126 void environ_unset(struct environ *, const char *);
2127 void environ_update(struct options *, struct environ *, struct environ *);
2128 void environ_push(struct environ *);
2129 void printflike(2, 3) environ_log(struct environ *, const char *, ...);
2130 struct environ *environ_for_session(struct session *, int);
2131 
2132 /* tty.c */
2133 void tty_create_log(void);
2134 int tty_window_bigger(struct tty *);
2135 int tty_window_offset(struct tty *, u_int *, u_int *, u_int *, u_int *);
2136 void tty_update_window_offset(struct window *);
2137 void tty_update_client_offset(struct client *);
2138 void tty_raw(struct tty *, const char *);
2139 void tty_attributes(struct tty *, const struct grid_cell *,
2140  const struct grid_cell *, int *);
2141 void tty_reset(struct tty *);
2142 void tty_region_off(struct tty *);
2143 void tty_margin_off(struct tty *);
2144 void tty_cursor(struct tty *, u_int, u_int);
2145 void tty_putcode(struct tty *, enum tty_code_code);
2146 void tty_putcode1(struct tty *, enum tty_code_code, int);
2147 void tty_putcode2(struct tty *, enum tty_code_code, int, int);
2148 void tty_putcode3(struct tty *, enum tty_code_code, int, int, int);
2149 void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
2150 void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
2151  const void *);
2152 void tty_puts(struct tty *, const char *);
2153 void tty_putc(struct tty *, u_char);
2154 void tty_putn(struct tty *, const void *, size_t, u_int);
2155 void tty_cell(struct tty *, const struct grid_cell *,
2156  const struct grid_cell *, int *);
2157 int tty_init(struct tty *, struct client *);
2158 void tty_resize(struct tty *);
2159 void tty_set_size(struct tty *, u_int, u_int, u_int, u_int);
2160 void tty_start_tty(struct tty *);
2161 void tty_send_requests(struct tty *);
2162 void tty_stop_tty(struct tty *);
2163 void tty_set_title(struct tty *, const char *);
2164 void tty_update_mode(struct tty *, int, struct screen *);
2165 void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
2166  u_int, u_int, const struct grid_cell *, int *);
2167 void tty_sync_start(struct tty *);
2168 void tty_sync_end(struct tty *);
2169 int tty_open(struct tty *, char **);
2170 void tty_close(struct tty *);
2171 void tty_free(struct tty *);
2172 void tty_update_features(struct tty *);
2173 void tty_set_selection(struct tty *, const char *, size_t);
2174 void tty_write(void (*)(struct tty *, const struct tty_ctx *),
2175  struct tty_ctx *);
2176 void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
2177 void tty_cmd_cell(struct tty *, const struct tty_ctx *);
2178 void tty_cmd_cells(struct tty *, const struct tty_ctx *);
2179 void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *);
2180 void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *);
2181 void tty_cmd_clearline(struct tty *, const struct tty_ctx *);
2182 void tty_cmd_clearscreen(struct tty *, const struct tty_ctx *);
2183 void tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *);
2184 void tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *);
2185 void tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *);
2186 void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
2187 void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
2188 void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
2189 void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
2190 void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
2191 void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
2192 void tty_cmd_scrollup(struct tty *, const struct tty_ctx *);
2193 void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *);
2194 void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
2195 void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
2196 void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
2197 void tty_cmd_syncstart(struct tty *, const struct tty_ctx *);
2198 void tty_default_colours(struct grid_cell *, struct window_pane *);
2199 
2200 /* tty-term.c */
2201 extern struct tty_terms tty_terms;
2202 u_int tty_term_ncodes(void);
2203 void tty_term_apply(struct tty_term *, const char *, int);
2204 void tty_term_apply_overrides(struct tty_term *);
2205 struct tty_term *tty_term_create(struct tty *, char *, char **, u_int, int *,
2206  char **);
2207 void tty_term_free(struct tty_term *);
2208 int tty_term_read_list(const char *, int, char ***, u_int *,
2209  char **);
2210 void tty_term_free_list(char **, u_int);
2211 int tty_term_has(struct tty_term *, enum tty_code_code);
2212 const char *tty_term_string(struct tty_term *, enum tty_code_code);
2213 const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
2214 const char *tty_term_string2(struct tty_term *, enum tty_code_code, int,
2215  int);
2216 const char *tty_term_string3(struct tty_term *, enum tty_code_code, int,
2217  int, int);
2218 const char *tty_term_ptr1(struct tty_term *, enum tty_code_code,
2219  const void *);
2220 const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
2221  const void *, const void *);
2222 int tty_term_number(struct tty_term *, enum tty_code_code);
2223 int tty_term_flag(struct tty_term *, enum tty_code_code);
2224 const char *tty_term_describe(struct tty_term *, enum tty_code_code);
2225 
2226 /* tty-features.c */
2227 void tty_add_features(int *, const char *, const char *);
2228 const char *tty_get_features(int);
2229 int tty_apply_features(struct tty_term *, int);
2230 void tty_default_features(int *, const char *, u_int);
2231 
2232 /* tty-acs.c */
2233 int tty_acs_needed(struct tty *);
2234 const char *tty_acs_get(struct tty *, u_char);
2235 int tty_acs_reverse_get(struct tty *, const char *, size_t);
2236 
2237 /* tty-keys.c */
2238 void tty_keys_build(struct tty *);
2239 void tty_keys_free(struct tty *);
2240 int tty_keys_next(struct tty *);
2241 
2242 /* arguments.c */
2243 void args_set(struct args *, u_char, const char *);
2244 struct args *args_parse(const char *, int, char **);
2245 void args_free(struct args *);
2246 char *args_print(struct args *);
2247 char *args_escape(const char *);
2248 int args_has(struct args *, u_char);
2249 const char *args_get(struct args *, u_char);
2250 u_char args_first(struct args *, struct args_entry **);
2251 u_char args_next(struct args_entry **);
2252 const char *args_first_value(struct args *, u_char, struct args_value **);
2253 const char *args_next_value(struct args_value **);
2254 long long args_strtonum(struct args *, u_char, long long, long long,
2255  char **);
2256 long long args_percentage(struct args *, u_char, long long,
2257  long long, long long, char **);
2258 long long args_string_percentage(const char *, long long, long long,
2259  long long, char **);
2260 
2261 /* cmd-find.c */
2262 int cmd_find_target(struct cmd_find_state *, struct cmdq_item *,
2263  const char *, enum cmd_find_type, int);
2264 struct client *cmd_find_best_client(struct session *);
2265 struct client *cmd_find_client(struct cmdq_item *, const char *, int);
2266 void cmd_find_clear_state(struct cmd_find_state *, int);
2267 int cmd_find_empty_state(struct cmd_find_state *);
2268 int cmd_find_valid_state(struct cmd_find_state *);
2269 void cmd_find_copy_state(struct cmd_find_state *,
2270  struct cmd_find_state *);
2272  struct session *, int);
2274  struct winlink *, int);
2276  struct session *, struct window *, int);
2277 int cmd_find_from_window(struct cmd_find_state *, struct window *,
2278  int);
2280  struct winlink *, struct window_pane *, int);
2281 int cmd_find_from_pane(struct cmd_find_state *,
2282  struct window_pane *, int);
2283 int cmd_find_from_client(struct cmd_find_state *, struct client *,
2284  int);
2285 int cmd_find_from_mouse(struct cmd_find_state *,
2286  struct mouse_event *, int);
2287 int cmd_find_from_nothing(struct cmd_find_state *, int);
2288 
2289 /* cmd.c */
2290 extern const struct cmd_entry *cmd_table[];
2291 void printflike(3, 4) cmd_log_argv(int, char **, const char *, ...);
2292 void cmd_prepend_argv(int *, char ***, char *);
2293 void cmd_append_argv(int *, char ***, char *);
2294 int cmd_pack_argv(int, char **, char *, size_t);
2295 int cmd_unpack_argv(char *, size_t, int, char ***);
2296 char **cmd_copy_argv(int, char **);
2297 void cmd_free_argv(int, char **);
2298 char *cmd_stringify_argv(int, char **);
2299 char *cmd_get_alias(const char *);
2300 const struct cmd_entry *cmd_get_entry(struct cmd *);
2301 struct args *cmd_get_args(struct cmd *);
2302 u_int cmd_get_group(struct cmd *);
2303 void cmd_get_source(struct cmd *, const char **, u_int *);
2304 struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
2305 void cmd_free(struct cmd *);
2306 char *cmd_print(struct cmd *);
2307 struct cmd_list *cmd_list_new(void);
2308 void cmd_list_append(struct cmd_list *, struct cmd *);
2309 void cmd_list_move(struct cmd_list *, struct cmd_list *);
2310 void cmd_list_free(struct cmd_list *);
2311 char *cmd_list_print(struct cmd_list *, int);
2312 struct cmd *cmd_list_first(struct cmd_list *);
2313 struct cmd *cmd_list_next(struct cmd *);
2314 int cmd_list_all_have(struct cmd_list *, int);
2315 int cmd_list_any_have(struct cmd_list *, int);
2316 int cmd_mouse_at(struct window_pane *, struct mouse_event *,
2317  u_int *, u_int *, int);
2318 struct winlink *cmd_mouse_window(struct mouse_event *, struct session **);
2319 struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
2320  struct winlink **);
2321 char *cmd_template_replace(const char *, const char *, int);
2322 
2323 /* cmd-attach-session.c */
2324 enum cmd_retval cmd_attach_session(struct cmdq_item *, const char *, int, int,
2325  int, const char *, int, const char *);
2326 
2327 /* cmd-parse.c */
2329 struct cmd_parse_result *cmd_parse_from_file(FILE *, struct cmd_parse_input *);
2330 struct cmd_parse_result *cmd_parse_from_string(const char *,
2331  struct cmd_parse_input *);
2332 enum cmd_parse_status cmd_parse_and_insert(const char *,
2333  struct cmd_parse_input *, struct cmdq_item *,
2334  struct cmdq_state *, char **);
2335 enum cmd_parse_status cmd_parse_and_append(const char *,
2336  struct cmd_parse_input *, struct client *,
2337  struct cmdq_state *, char **);
2338 struct cmd_parse_result *cmd_parse_from_buffer(const void *, size_t,
2339  struct cmd_parse_input *);
2340 struct cmd_parse_result *cmd_parse_from_arguments(int, char **,
2341  struct cmd_parse_input *);
2342 
2343 /* cmd-queue.c */
2344 struct cmdq_state *cmdq_new_state(struct cmd_find_state *, struct key_event *,
2345  int);
2346 struct cmdq_state *cmdq_link_state(struct cmdq_state *);
2347 struct cmdq_state *cmdq_copy_state(struct cmdq_state *);
2348 void cmdq_free_state(struct cmdq_state *);
2349 void printflike(3, 4) cmdq_add_format(struct cmdq_state *, const char *,
2350  const char *, ...);
2351 void cmdq_merge_formats(struct cmdq_item *, struct format_tree *);
2352 struct cmdq_list *cmdq_new(void);
2353 void cmdq_free(struct cmdq_list *);
2354 const char *cmdq_get_name(struct cmdq_item *);
2355 struct client *cmdq_get_client(struct cmdq_item *);
2356 struct client *cmdq_get_target_client(struct cmdq_item *);
2357 struct cmdq_state *cmdq_get_state(struct cmdq_item *);
2358 struct cmd_find_state *cmdq_get_target(struct cmdq_item *);
2359 struct cmd_find_state *cmdq_get_source(struct cmdq_item *);
2360 struct key_event *cmdq_get_event(struct cmdq_item *);
2361 struct cmd_find_state *cmdq_get_current(struct cmdq_item *);
2362 int cmdq_get_flags(struct cmdq_item *);
2363 struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmdq_state *);
2364 #define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data)
2365 struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *);
2366 struct cmdq_item *cmdq_get_error(const char *);
2367 struct cmdq_item *cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
2368 struct cmdq_item *cmdq_append(struct client *, struct cmdq_item *);
2369 void cmdq_insert_hook(struct session *, struct cmdq_item *,
2370  struct cmd_find_state *, const char *, ...);
2371 void cmdq_continue(struct cmdq_item *);
2372 u_int cmdq_next(struct client *);
2373 struct cmdq_item *cmdq_running(struct client *);
2374 void cmdq_guard(struct cmdq_item *, const char *, int);
2375 void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...);
2376 void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
2377 
2378 /* cmd-wait-for.c */
2379 void cmd_wait_for_flush(void);
2380 
2381 /* client.c */
2382 int client_main(struct event_base *, int, char **, uint64_t, int);
2383 
2384 /* key-bindings.c */
2385 struct key_table *key_bindings_get_table(const char *, int);
2386 struct key_table *key_bindings_first_table(void);
2387 struct key_table *key_bindings_next_table(struct key_table *);
2388 void key_bindings_unref_table(struct key_table *);
2389 struct key_binding *key_bindings_get(struct key_table *, key_code);
2391 struct key_binding *key_bindings_first(struct key_table *);
2392 struct key_binding *key_bindings_next(struct key_table *, struct key_binding *);
2393 void key_bindings_add(const char *, key_code, const char *, int,
2394  struct cmd_list *);
2395 void key_bindings_remove(const char *, key_code);
2396 void key_bindings_reset(const char *, key_code);
2397 void key_bindings_remove_table(const char *);
2398 void key_bindings_reset_table(const char *);
2399 void key_bindings_init(void);
2401  struct cmdq_item *, struct client *, struct key_event *,
2402  struct cmd_find_state *);
2403 
2404 /* key-string.c */
2405 key_code key_string_lookup_string(const char *);
2406 const char *key_string_lookup_key(key_code, int);
2407 
2408 /* alerts.c */
2409 void alerts_reset_all(void);
2410 void alerts_queue(struct window *, int);
2411 void alerts_check_session(struct session *);
2412 
2413 /* file.c */
2414 int file_cmp(struct client_file *, struct client_file *);
2416 struct client_file *file_create_with_peer(struct tmuxpeer *,
2417  struct client_files *, int, client_file_cb, void *);
2418 struct client_file *file_create_with_client(struct client *, int,
2419  client_file_cb, void *);
2420 void file_free(struct client_file *);
2421 void file_fire_done(struct client_file *);
2422 void file_fire_read(struct client_file *);
2423 int file_can_print(struct client *);
2424 void printflike(2, 3) file_print(struct client *, const char *, ...);
2425 void file_vprint(struct client *, const char *, va_list);
2426 void file_print_buffer(struct client *, void *, size_t);
2427 void printflike(2, 3) file_error(struct client *, const char *, ...);
2428 void file_write(struct client *, const char *, int, const void *, size_t,
2429  client_file_cb, void *);
2430 void file_read(struct client *, const char *, client_file_cb, void *);
2431 void file_push(struct client_file *);
2432 int file_write_left(struct client_files *);
2433 void file_write_open(struct client_files *, struct tmuxpeer *,
2434  struct imsg *, int, int, client_file_cb, void *);
2435 void file_write_data(struct client_files *, struct imsg *);
2436 void file_write_close(struct client_files *, struct imsg *);
2437 void file_read_open(struct client_files *, struct tmuxpeer *, struct imsg *,
2438  int, int, client_file_cb, void *);
2439 void file_write_ready(struct client_files *, struct imsg *);
2440 void file_read_data(struct client_files *, struct imsg *);
2441 void file_read_done(struct client_files *, struct imsg *);
2442 
2443 /* server.c */
2444 extern struct tmuxproc *server_proc;
2445 extern struct clients clients;
2446 extern struct cmd_find_state marked_pane;
2447 extern struct message_list message_log;
2448 void server_set_marked(struct session *, struct winlink *,
2449  struct window_pane *);
2450 void server_clear_marked(void);
2451 int server_is_marked(struct session *, struct winlink *,
2452  struct window_pane *);
2453 int server_check_marked(void);
2454 int server_start(struct tmuxproc *, int, struct event_base *, int, char *);
2455 void server_update_socket(void);
2456 void server_add_accept(int);
2457 void printflike(1, 2) server_add_message(const char *, ...);
2458 
2459 /* server-client.c */
2461 u_int server_client_how_many(void);
2462 void server_client_set_overlay(struct client *, u_int, overlay_check_cb,
2464  overlay_free_cb, void *);
2465 void server_client_clear_overlay(struct client *);
2466 void server_client_set_key_table(struct client *, const char *);
2467 const char *server_client_get_key_table(struct client *);
2468 int server_client_check_nested(struct client *);
2469 int server_client_handle_key(struct client *, struct key_event *);
2470 struct client *server_client_create(int);
2471 int server_client_open(struct client *, char **);
2472 void server_client_unref(struct client *);
2473 void server_client_lost(struct client *);
2474 void server_client_suspend(struct client *);
2475 void server_client_detach(struct client *, enum msgtype);
2476 void server_client_exec(struct client *, const char *);
2477 void server_client_loop(void);
2480 const char *server_client_get_cwd(struct client *, struct session *);
2481 void server_client_set_flags(struct client *, const char *);
2482 const char *server_client_get_flags(struct client *);
2483 struct window_pane *server_client_get_pane(struct client *);
2484 void server_client_set_pane(struct client *, struct window_pane *);
2485 void server_client_remove_pane(struct window_pane *);
2486 
2487 /* server-fn.c */
2488 void server_redraw_client(struct client *);
2489 void server_status_client(struct client *);
2490 void server_redraw_session(struct session *);
2491 void server_redraw_session_group(struct session *);
2492 void server_status_session(struct session *);
2493 void server_status_session_group(struct session *);
2494 void server_redraw_window(struct window *);
2495 void server_redraw_window_borders(struct window *);
2496 void server_status_window(struct window *);
2497 void server_lock(void);
2498 void server_lock_session(struct session *);
2499 void server_lock_client(struct client *);
2500 void server_kill_pane(struct window_pane *);
2501 void server_kill_window(struct window *, int);
2502 void server_renumber_session(struct session *);
2503 void server_renumber_all(void);
2504 int server_link_window(struct session *,
2505  struct winlink *, struct session *, int, int, int, char **);
2506 void server_unlink_window(struct session *, struct winlink *);
2507 void server_destroy_pane(struct window_pane *, int);
2508 void server_destroy_session(struct session *);
2509 void server_check_unattached(void);
2510 void server_unzoom_window(struct window *);
2511 
2512 /* status.c */
2513 void status_timer_start(struct client *);
2514 void status_timer_start_all(void);
2515 void status_update_cache(struct session *);
2516 int status_at_line(struct client *);
2517 u_int status_line_size(struct client *);
2518 struct style_range *status_get_range(struct client *, u_int, u_int);
2519 void status_init(struct client *);
2520 void status_free(struct client *);
2521 int status_redraw(struct client *);
2522 void status_message_set(struct client *, int, int, int, const char *, ...);
2523 void status_message_clear(struct client *);
2524 int status_message_redraw(struct client *);
2525 void status_prompt_set(struct client *, struct cmd_find_state *,
2526  const char *, const char *, prompt_input_cb, prompt_free_cb,
2527  void *, int);
2528 void status_prompt_clear(struct client *);
2529 int status_prompt_redraw(struct client *);
2530 int status_prompt_key(struct client *, key_code);
2531 void status_prompt_update(struct client *, const char *, const char *);
2532 void status_prompt_load_history(void);
2533 void status_prompt_save_history(void);
2534 
2535 /* resize.c */
2536 void resize_window(struct window *, u_int, u_int, int, int);
2537 void default_window_size(struct client *, struct session *, struct window *,
2538  u_int *, u_int *, u_int *, u_int *, int);
2539 void recalculate_size(struct window *, int);
2540 void recalculate_sizes(void);
2541 void recalculate_sizes_now(int);
2542 
2543 /* input.c */
2544 struct input_ctx *input_init(struct window_pane *, struct bufferevent *);
2545 void input_free(struct input_ctx *);
2546 void input_reset(struct input_ctx *, int);
2547 struct evbuffer *input_pending(struct input_ctx *);
2548 void input_parse_pane(struct window_pane *);
2549 void input_parse_buffer(struct window_pane *, u_char *, size_t);
2550 void input_parse_screen(struct input_ctx *, struct screen *,
2551  screen_write_init_ctx_cb, void *, u_char *, size_t);
2552 
2553 /* input-key.c */
2554 void input_key_build(void);
2555 int input_key_pane(struct window_pane *, key_code, struct mouse_event *);
2556 int input_key(struct screen *, struct bufferevent *, key_code);
2557 int input_key_get_mouse(struct screen *, struct mouse_event *, u_int,
2558  u_int, const char **, size_t *);
2559 
2560 /* colour.c */
2561 int colour_find_rgb(u_char, u_char, u_char);
2562 int colour_join_rgb(u_char, u_char, u_char);
2563 void colour_split_rgb(int, u_char *, u_char *, u_char *);
2564 const char *colour_tostring(int);
2565 int colour_fromstring(const char *s);
2566 int colour_256toRGB(int);
2567 int colour_256to16(int);
2568 int colour_byname(const char *);
2569 
2570 /* attributes.c */
2571 const char *attributes_tostring(int);
2572 int attributes_fromstring(const char *);
2573 
2574 /* grid.c */
2575 extern const struct grid_cell grid_default_cell;
2576 void grid_empty_line(struct grid *, u_int, u_int);
2577 int grid_cells_equal(const struct grid_cell *, const struct grid_cell *);
2578 int grid_cells_look_equal(const struct grid_cell *,
2579  const struct grid_cell *);
2580 struct grid *grid_create(u_int, u_int, u_int);
2581 void grid_destroy(struct grid *);
2582 int grid_compare(struct grid *, struct grid *);
2583 void grid_collect_history(struct grid *);
2584 void grid_remove_history(struct grid *, u_int );
2585 void grid_scroll_history(struct grid *, u_int);
2586 void grid_scroll_history_region(struct grid *, u_int, u_int, u_int);
2587 void grid_clear_history(struct grid *);
2588 const struct grid_line *grid_peek_line(struct grid *, u_int);
2589 void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
2590 void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
2591 void grid_set_padding(struct grid *, u_int, u_int);
2592 void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *,
2593  const char *, size_t);
2594 struct grid_line *grid_get_line(struct grid *, u_int);
2595 void grid_adjust_lines(struct grid *, u_int);
2596 void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
2597 void grid_clear_lines(struct grid *, u_int, u_int, u_int);
2598 void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int);
2599 void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int, u_int);
2600 char *grid_string_cells(struct grid *, u_int, u_int, u_int,
2601  struct grid_cell **, int, int, int);
2602 void grid_duplicate_lines(struct grid *, u_int, struct grid *, u_int,
2603  u_int);
2604 void grid_reflow(struct grid *, u_int);
2605 void grid_wrap_position(struct grid *, u_int, u_int, u_int *, u_int *);
2606 void grid_unwrap_position(struct grid *, u_int *, u_int *, u_int, u_int);
2607 u_int grid_line_length(struct grid *, u_int);
2608 
2609 /* grid-reader.c */
2610 void grid_reader_start(struct grid_reader *, struct grid *, u_int, u_int);
2611 void grid_reader_get_cursor(struct grid_reader *, u_int *, u_int *);
2612 u_int grid_reader_line_length(struct grid_reader *);
2613 int grid_reader_in_set(struct grid_reader *, const char *);
2614 void grid_reader_cursor_right(struct grid_reader *, int, int);
2615 void grid_reader_cursor_left(struct grid_reader *, int);
2616 void grid_reader_cursor_down(struct grid_reader *);
2617 void grid_reader_cursor_up(struct grid_reader *);
2618 void grid_reader_cursor_start_of_line(struct grid_reader *, int);
2619 void grid_reader_cursor_end_of_line(struct grid_reader *, int, int);
2620 void grid_reader_cursor_next_word(struct grid_reader *, const char *);
2621 void grid_reader_cursor_next_word_end(struct grid_reader *, const char *);
2622 void grid_reader_cursor_previous_word(struct grid_reader *, const char *,
2623  int);
2625  const struct utf8_data *);
2627  const struct utf8_data *);
2629 
2630 /* grid-view.c */
2631 void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
2632 void grid_view_set_cell(struct grid *, u_int, u_int,
2633  const struct grid_cell *);
2634 void grid_view_set_padding(struct grid *, u_int, u_int);
2635 void grid_view_set_cells(struct grid *, u_int, u_int,
2636  const struct grid_cell *, const char *, size_t);
2637 void grid_view_clear_history(struct grid *, u_int);
2638 void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
2639 void grid_view_scroll_region_up(struct grid *, u_int, u_int, u_int);
2640 void grid_view_scroll_region_down(struct grid *, u_int, u_int, u_int);
2641 void grid_view_insert_lines(struct grid *, u_int, u_int, u_int);
2642 void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int,
2643  u_int);
2644 void grid_view_delete_lines(struct grid *, u_int, u_int, u_int);
2645 void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int,
2646  u_int);
2647 void grid_view_insert_cells(struct grid *, u_int, u_int, u_int, u_int);
2648 void grid_view_delete_cells(struct grid *, u_int, u_int, u_int, u_int);
2649 char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
2650 
2651 /* screen-write.c */
2652 void screen_write_make_list(struct screen *);
2653 void screen_write_free_list(struct screen *);
2655  struct window_pane *, struct screen *);
2656 void screen_write_start(struct screen_write_ctx *, struct screen *);
2657 void screen_write_start_callback(struct screen_write_ctx *, struct screen *,
2658  screen_write_init_ctx_cb, void *);
2659 void screen_write_stop(struct screen_write_ctx *);
2660 void screen_write_reset(struct screen_write_ctx *);
2661 size_t printflike(1, 2) screen_write_strlen(const char *, ...);
2662 int printflike(7, 8) screen_write_text(struct screen_write_ctx *, u_int, u_int,
2663  u_int, int, const struct grid_cell *, const char *, ...);
2664 void printflike(3, 4) screen_write_puts(struct screen_write_ctx *,
2665  const struct grid_cell *, const char *, ...);
2666 void printflike(4, 5) screen_write_nputs(struct screen_write_ctx *,
2667  ssize_t, const struct grid_cell *, const char *, ...);
2668 void screen_write_vnputs(struct screen_write_ctx *, ssize_t,
2669  const struct grid_cell *, const char *, va_list);
2670 void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *,
2671  u_char);
2672 void screen_write_fast_copy(struct screen_write_ctx *, struct screen *,
2673  u_int, u_int, u_int, u_int);
2674 void screen_write_hline(struct screen_write_ctx *, u_int, int, int);
2675 void screen_write_vline(struct screen_write_ctx *, u_int, int, int);
2676 void screen_write_menu(struct screen_write_ctx *, struct menu *, int,
2677  const struct grid_cell *);
2678 void screen_write_box(struct screen_write_ctx *, u_int, u_int);
2679 void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int,
2680  u_int);
2682 void screen_write_mode_set(struct screen_write_ctx *, int);
2683 void screen_write_mode_clear(struct screen_write_ctx *, int);
2684 void screen_write_cursorup(struct screen_write_ctx *, u_int);
2685 void screen_write_cursordown(struct screen_write_ctx *, u_int);
2686 void screen_write_cursorright(struct screen_write_ctx *, u_int);
2687 void screen_write_cursorleft(struct screen_write_ctx *, u_int);
2689 void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int);
2690 void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int);
2691 void screen_write_clearcharacter(struct screen_write_ctx *, u_int, u_int);
2692 void screen_write_insertline(struct screen_write_ctx *, u_int, u_int);
2693 void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int);
2694 void screen_write_clearline(struct screen_write_ctx *, u_int);
2695 void screen_write_clearendofline(struct screen_write_ctx *, u_int);
2696 void screen_write_clearstartofline(struct screen_write_ctx *, u_int);
2697 void screen_write_cursormove(struct screen_write_ctx *, int, int, int);
2698 void screen_write_reverseindex(struct screen_write_ctx *, u_int);
2699 void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
2700 void screen_write_linefeed(struct screen_write_ctx *, int, u_int);
2701 void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int);
2702 void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int);
2704 void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
2706 void screen_write_clearscreen(struct screen_write_ctx *, u_int);
2710  const struct grid_cell *);
2711 void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
2712 void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
2713 void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
2715  struct grid_cell *, int);
2717  struct grid_cell *, int);
2718 
2719 /* screen-redraw.c */
2720 void screen_redraw_screen(struct client *);
2721 void screen_redraw_pane(struct client *, struct window_pane *);
2722 
2723 /* screen.c */
2724 void screen_init(struct screen *, u_int, u_int, u_int);
2725 void screen_reinit(struct screen *);
2726 void screen_free(struct screen *);
2727 void screen_reset_tabs(struct screen *);
2728 void screen_set_cursor_style(struct screen *, u_int);
2729 void screen_set_cursor_colour(struct screen *, const char *);
2730 int screen_set_title(struct screen *, const char *);
2731 void screen_set_path(struct screen *, const char *);
2732 void screen_push_title(struct screen *);
2733 void screen_pop_title(struct screen *);
2734 void screen_resize(struct screen *, u_int, u_int, int);
2735 void screen_resize_cursor(struct screen *, u_int, u_int, int, int, int);
2736 void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int,
2737  u_int, int, struct grid_cell *);
2738 void screen_clear_selection(struct screen *);
2739 void screen_hide_selection(struct screen *);
2740 int screen_check_selection(struct screen *, u_int, u_int);
2741 void screen_select_cell(struct screen *, struct grid_cell *,
2742  const struct grid_cell *);
2743 void screen_alternate_on(struct screen *, struct grid_cell *, int);
2744 void screen_alternate_off(struct screen *, struct grid_cell *, int);
2745 
2746 /* window.c */
2747 extern struct windows windows;
2748 extern struct window_pane_tree all_window_panes;
2749 int window_cmp(struct window *, struct window *);
2751 int winlink_cmp(struct winlink *, struct winlink *);
2752 RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
2753 int window_pane_cmp(struct window_pane *, struct window_pane *);
2754 RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
2755 struct winlink *winlink_find_by_index(struct winlinks *, int);
2756 struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
2757 struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
2758 u_int winlink_count(struct winlinks *);
2759 struct winlink *winlink_add(struct winlinks *, int);
2760 void winlink_set_window(struct winlink *, struct window *);
2761 void winlink_remove(struct winlinks *, struct winlink *);
2762 struct winlink *winlink_next(struct winlink *);
2763 struct winlink *winlink_previous(struct winlink *);
2764 struct winlink *winlink_next_by_number(struct winlink *, struct session *,
2765  int);
2766 struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
2767  int);
2768 void winlink_stack_push(struct winlink_stack *, struct winlink *);
2769 void winlink_stack_remove(struct winlink_stack *, struct winlink *);
2770 struct window *window_find_by_id_str(const char *);
2771 struct window *window_find_by_id(u_int);
2772 void window_update_activity(struct window *);
2773 struct window *window_create(u_int, u_int, u_int, u_int);
2774 void window_pane_set_event(struct window_pane *);
2775 struct window_pane *window_get_active_at(struct window *, u_int, u_int);
2776 struct window_pane *window_find_string(struct window *, const char *);
2777 int window_has_pane(struct window *, struct window_pane *);
2778 int window_set_active_pane(struct window *, struct window_pane *,
2779  int);
2780 void window_redraw_active_switch(struct window *,
2781  struct window_pane *);
2782 struct window_pane *window_add_pane(struct window *, struct window_pane *,
2783  u_int, int);
2784 void window_resize(struct window *, u_int, u_int, int, int);
2785 void window_pane_send_resize(struct window_pane *, u_int, u_int);
2786 int window_zoom(struct window_pane *);
2787 int window_unzoom(struct window *);
2788 int window_push_zoom(struct window *, int, int);
2789 int window_pop_zoom(struct window *);
2790 void window_lost_pane(struct window *, struct window_pane *);
2791 void window_remove_pane(struct window *, struct window_pane *);
2792 struct window_pane *window_pane_at_index(struct window *, u_int);
2794  struct window_pane *, u_int);
2796  struct window_pane *, u_int);
2797 int window_pane_index(struct window_pane *, u_int *);
2798 u_int window_count_panes(struct window *);
2799 void window_destroy_panes(struct window *);
2800 struct window_pane *window_pane_find_by_id_str(const char *);
2801 struct window_pane *window_pane_find_by_id(u_int);
2803 void window_pane_resize(struct window_pane *, u_int, u_int);
2804 void window_pane_set_palette(struct window_pane *, u_int, int);
2805 void window_pane_unset_palette(struct window_pane *, u_int);
2806 void window_pane_reset_palette(struct window_pane *);
2807 int window_pane_get_palette(struct window_pane *, int);
2808 int window_pane_set_mode(struct window_pane *,
2809  struct window_pane *, const struct window_mode *,
2810  struct cmd_find_state *, struct args *);
2811 void window_pane_reset_mode(struct window_pane *);
2813 int window_pane_key(struct window_pane *, struct client *,
2814  struct session *, struct winlink *, key_code,
2815  struct mouse_event *);
2816 int window_pane_visible(struct window_pane *);
2817 u_int window_pane_search(struct window_pane *, const char *, int,
2818  int);
2819 const char *window_printable_flags(struct winlink *, int);
2820 struct window_pane *window_pane_find_up(struct window_pane *);
2824 void window_set_name(struct window *, const char *);
2825 void window_add_ref(struct window *, const char *);
2826 void window_remove_ref(struct window *, const char *);
2827 void winlink_clear_flags(struct winlink *);
2828 int winlink_shuffle_up(struct session *, struct winlink *, int);
2830  struct cmdq_item *, char **);
2831 void *window_pane_get_new_data(struct window_pane *,
2832  struct window_pane_offset *, size_t *);
2834  struct window_pane_offset *, size_t);
2835 
2836 /* layout.c */
2837 u_int layout_count_cells(struct layout_cell *);
2838 struct layout_cell *layout_create_cell(struct layout_cell *);
2839 void layout_free_cell(struct layout_cell *);
2840 void layout_print_cell(struct layout_cell *, const char *, u_int);
2841 void layout_destroy_cell(struct window *, struct layout_cell *,
2842  struct layout_cell **);
2843 void layout_resize_layout(struct window *, struct layout_cell *,
2844  enum layout_type, int, int);
2845 struct layout_cell *layout_search_by_border(struct layout_cell *, u_int, u_int);
2846 void layout_set_size(struct layout_cell *, u_int, u_int, u_int,
2847  u_int);
2848 void layout_make_leaf(struct layout_cell *, struct window_pane *);
2849 void layout_make_node(struct layout_cell *, enum layout_type);
2850 void layout_fix_offsets(struct window *);
2851 void layout_fix_panes(struct window *, struct window_pane *);
2852 void layout_resize_adjust(struct window *, struct layout_cell *,
2853  enum layout_type, int);
2854 void layout_init(struct window *, struct window_pane *);
2855 void layout_free(struct window *);
2856 void layout_resize(struct window *, u_int, u_int);
2857 void layout_resize_pane(struct window_pane *, enum layout_type,
2858  int, int);
2859 void layout_resize_pane_to(struct window_pane *, enum layout_type,
2860  u_int);
2861 void layout_assign_pane(struct layout_cell *, struct window_pane *,
2862  int);
2863 struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type,
2864  int, int);
2865 void layout_close_pane(struct window_pane *);
2866 int layout_spread_cell(struct window *, struct layout_cell *);
2867 void layout_spread_out(struct window_pane *);
2868 
2869 /* layout-custom.c */
2870 char *layout_dump(struct layout_cell *);
2871 int layout_parse(struct window *, const char *);
2872 
2873 /* layout-set.c */
2874 int layout_set_lookup(const char *);
2875 u_int layout_set_select(struct window *, u_int);
2876 u_int layout_set_next(struct window *);
2877 u_int layout_set_previous(struct window *);
2878 
2879 /* mode-tree.c */
2880 typedef void (*mode_tree_build_cb)(void *, struct mode_tree_sort_criteria *,
2881  uint64_t *, const char *);
2882 typedef void (*mode_tree_draw_cb)(void *, void *, struct screen_write_ctx *,
2883  u_int, u_int);
2884 typedef int (*mode_tree_search_cb)(void *, void *, const char *);
2885 typedef void (*mode_tree_menu_cb)(void *, struct client *, key_code);
2886 typedef u_int (*mode_tree_height_cb)(void *, u_int);
2887 typedef key_code (*mode_tree_key_cb)(void *, void *, u_int);
2888 typedef void (*mode_tree_each_cb)(void *, void *, struct client *, key_code);
2889 u_int mode_tree_count_tagged(struct mode_tree_data *);
2890 void *mode_tree_get_current(struct mode_tree_data *);
2891 const char *mode_tree_get_current_name(struct mode_tree_data *);
2894 void mode_tree_expand(struct mode_tree_data *, uint64_t);
2895 int mode_tree_set_current(struct mode_tree_data *, uint64_t);
2897  struct client *, key_code, int);
2898 void mode_tree_up(struct mode_tree_data *, int);
2899 void mode_tree_down(struct mode_tree_data *, int);
2900 struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
2903  const struct menu_item *, const char **, u_int, struct screen **);
2904 void mode_tree_zoom(struct mode_tree_data *, struct args *);
2905 void mode_tree_build(struct mode_tree_data *);
2906 void mode_tree_free(struct mode_tree_data *);
2907 void mode_tree_resize(struct mode_tree_data *, u_int, u_int);
2909  struct mode_tree_item *, void *, uint64_t, const char *,
2910  const char *, int);
2912 void mode_tree_no_tag(struct mode_tree_item *);
2913 void mode_tree_remove(struct mode_tree_data *, struct mode_tree_item *);
2914 void mode_tree_draw(struct mode_tree_data *);
2915 int mode_tree_key(struct mode_tree_data *, struct client *, key_code *,
2916  struct mouse_event *, u_int *, u_int *);
2917 void mode_tree_run_command(struct client *, struct cmd_find_state *,
2918  const char *, const char *);
2919 
2920 /* window-buffer.c */
2921 extern const struct window_mode window_buffer_mode;
2922 
2923 /* window-tree.c */
2924 extern const struct window_mode window_tree_mode;
2925 
2926 /* window-clock.c */
2927 extern const struct window_mode window_clock_mode;
2928 extern const char window_clock_table[14][5][5];
2929 
2930 /* window-client.c */
2931 extern const struct window_mode window_client_mode;
2932 
2933 /* window-copy.c */
2934 extern const struct window_mode window_copy_mode;
2935 extern const struct window_mode window_view_mode;
2936 void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
2937 void window_copy_vadd(struct window_pane *, const char *, va_list);
2938 void window_copy_pageup(struct window_pane *, int);
2939 void window_copy_start_drag(struct client *, struct mouse_event *);
2940 char *window_copy_get_word(struct window_pane *, u_int, u_int);
2941 char *window_copy_get_line(struct window_pane *, u_int);
2942 
2943 /* window-option.c */
2944 extern const struct window_mode window_customize_mode;
2945 
2946 /* names.c */
2947 void check_window_name(struct window *);
2948 char *default_window_name(struct window *);
2949 char *parse_window_name(const char *);
2950 
2951 /* control.c */
2952 void control_discard(struct client *);
2953 void control_start(struct client *);
2954 void control_stop(struct client *);
2955 void control_set_pane_on(struct client *, struct window_pane *);
2956 void control_set_pane_off(struct client *, struct window_pane *);
2957 void control_continue_pane(struct client *, struct window_pane *);
2958 void control_pause_pane(struct client *, struct window_pane *);
2960  struct window_pane *, int *);
2961 void control_reset_offsets(struct client *);
2962 void printflike(2, 3) control_write(struct client *, const char *, ...);
2963 void control_write_output(struct client *, struct window_pane *);
2964 int control_all_done(struct client *);
2965 void control_add_sub(struct client *, const char *, enum control_sub_type,
2966  int, const char *);
2967 void control_remove_sub(struct client *, const char *);
2968 
2969 /* control-notify.c */
2970 void control_notify_input(struct client *, struct window_pane *,
2971  const u_char *, size_t);
2975 void control_notify_window_unlinked(struct session *, struct window *);
2976 void control_notify_window_linked(struct session *, struct window *);
2977 void control_notify_window_renamed(struct window *);
2979 void control_notify_client_detached(struct client *);
2982 void control_notify_session_closed(struct session *);
2984 
2985 /* session.c */
2986 extern struct sessions sessions;
2987 int session_cmp(struct session *, struct session *);
2989 int session_alive(struct session *);
2990 struct session *session_find(const char *);
2991 struct session *session_find_by_id_str(const char *);
2992 struct session *session_find_by_id(u_int);
2993 struct session *session_create(const char *, const char *, const char *,
2994  struct environ *, struct options *, struct termios *);
2995 void session_destroy(struct session *, int, const char *);
2996 void session_add_ref(struct session *, const char *);
2997 void session_remove_ref(struct session *, const char *);
2998 char *session_check_name(const char *);
2999 void session_update_activity(struct session *, struct timeval *);
3000 struct session *session_next_session(struct session *);
3001 struct session *session_previous_session(struct session *);
3002 struct winlink *session_new(struct session *, const char *, int, char **,
3003  const char *, const char *, int, char **);
3004 struct winlink *session_attach(struct session *, struct window *, int,
3005  char **);
3006 int session_detach(struct session *, struct winlink *);
3007 int session_has(struct session *, struct window *);
3008 int session_is_linked(struct session *, struct window *);
3009 int session_next(struct session *, int);
3010 int session_previous(struct session *, int);
3011 int session_select(struct session *, int);
3012 int session_last(struct session *);
3013 int session_set_current(struct session *, struct winlink *);
3014 struct session_group *session_group_contains(struct session *);
3015 struct session_group *session_group_find(const char *);
3016 struct session_group *session_group_new(const char *);
3017 void session_group_add(struct session_group *, struct session *);
3018 void session_group_synchronize_to(struct session *);
3020 u_int session_group_count(struct session_group *);
3022 void session_renumber_windows(struct session *);
3023 
3024 /* utf8.c */
3025 utf8_char utf8_build_one(u_char);
3026 enum utf8_state utf8_from_data(const struct utf8_data *, utf8_char *);
3027 void utf8_to_data(utf8_char, struct utf8_data *);
3028 void utf8_set(struct utf8_data *, u_char);
3029 void utf8_copy(struct utf8_data *, const struct utf8_data *);
3030 enum utf8_state utf8_open(struct utf8_data *, u_char);
3031 enum utf8_state utf8_append(struct utf8_data *, u_char);
3032 int utf8_isvalid(const char *);
3033 int utf8_strvis(char *, const char *, size_t, int);
3034 int utf8_stravis(char **, const char *, int);
3035 int utf8_stravisx(char **, const char *, size_t, int);
3036 char *utf8_sanitize(const char *);
3037 size_t utf8_strlen(const struct utf8_data *);
3038 u_int utf8_strwidth(const struct utf8_data *, ssize_t);
3039 struct utf8_data *utf8_fromcstr(const char *);
3040 char *utf8_tocstr(struct utf8_data *);
3041 u_int utf8_cstrwidth(const char *);
3042 char *utf8_padcstr(const char *, u_int);
3043 char *utf8_rpadcstr(const char *, u_int);
3044 int utf8_cstrhas(const char *, const struct utf8_data *);
3045 
3046 /* osdep-*.c */
3047 char *osdep_get_name(int, char *);
3048 char *osdep_get_cwd(int);
3049 struct event_base *osdep_event_init(void);
3050 
3051 /* log.c */
3052 void log_add_level(void);
3053 int log_get_level(void);
3054 void log_open(const char *);
3055 void log_toggle(const char *);
3056 void log_close(void);
3057 void printflike(1, 2) log_debug(const char *, ...);
3058 __dead void printflike(1, 2) fatal(const char *, ...);
3059 __dead void printflike(1, 2) fatalx(const char *, ...);
3060 
3061 /* menu.c */
3062 #define MENU_NOMOUSE 0x1
3063 #define MENU_TAB 0x2
3064 #define MENU_STAYOPEN 0x4
3065 struct menu *menu_create(const char *);
3066 void menu_add_items(struct menu *, const struct menu_item *,
3067  struct cmdq_item *, struct client *,
3068  struct cmd_find_state *);
3069 void menu_add_item(struct menu *, const struct menu_item *,
3070  struct cmdq_item *, struct client *,
3071  struct cmd_find_state *);
3072 void menu_free(struct menu *);
3073 int menu_display(struct menu *, int, struct cmdq_item *, u_int,
3074  u_int, struct client *, struct cmd_find_state *,
3075  menu_choice_cb, void *);
3076 
3077 /* popup.c */
3078 #define POPUP_CLOSEEXIT 0x1
3079 #define POPUP_CLOSEEXITZERO 0x2
3080 typedef void (*popup_close_cb)(int, void *);
3081 typedef void (*popup_finish_edit_cb)(char *, size_t, void *);
3082 int popup_display(int, struct cmdq_item *, u_int, u_int, u_int,
3083  u_int, const char *, int, char **, const char *,
3084  struct client *, struct session *, popup_close_cb, void *);
3085 int popup_editor(struct client *, const char *, size_t,
3086  popup_finish_edit_cb, void *);
3087 
3088 /* style.c */
3089 int style_parse(struct style *,const struct grid_cell *,
3090  const char *);
3091 const char *style_tostring(struct style *);
3092 void style_add(struct grid_cell *, struct options *,
3093  const char *, struct format_tree *);
3094 void style_apply(struct grid_cell *, struct options *,
3095  const char *, struct format_tree *);
3096 void style_set(struct style *, const struct grid_cell *);
3097 void style_copy(struct style *, struct style *);
3098 
3099 /* spawn.c */
3100 struct winlink *spawn_window(struct spawn_context *, char **);
3101 struct window_pane *spawn_pane(struct spawn_context *, char **);
3102 
3103 /* regsub.c */
3104 char *regsub(const char *, const char *, const char *, int);
3105 
3106 #endif /* TMUX_H */
static struct client_files client_files
Definition: client.c:58
#define __packed
Definition: compat.h:66
#define TTY_NAME_MAX
Definition: compat.h:261
#define __dead
Definition: compat.h:63
static struct key_tables key_tables
Definition: key-bindings.c:73
const char * name
Definition: layout-set.c:38
static int server_client_window_cmp(struct client_window *cw1, struct client_window *cw2)
Definition: server-client.c:55
struct session_groups session_groups
Definition: session.c:31
Definition: arguments.c:37
Definition: tmux.h:1435
int argc
Definition: tmux.h:1437
char ** argv
Definition: tmux.h:1438
struct args_tree tree
Definition: tmux.h:1436
int stream
Definition: tmux.h:1575
client_file_cb cb
Definition: tmux.h:1585
struct tmuxpeer * peer
Definition: tmux.h:1572
struct evbuffer * buffer
Definition: tmux.h:1578
void * data
Definition: tmux.h:1586
int references
Definition: tmux.h:1574
int error
Definition: tmux.h:1582
int fd
Definition: tmux.h:1581
struct client_files * tree
Definition: tmux.h:1573
int closed
Definition: tmux.h:1583
struct client * c
Definition: tmux.h:1571
struct bufferevent * event
Definition: tmux.h:1579
RB_ENTRY(client_file) entry
char * path
Definition: tmux.h:1577
RB_ENTRY(client_window) entry
struct window_pane * pane
Definition: tmux.h:1595
u_int window
Definition: tmux.h:1594
Definition: tmux.h:1608
char ** term_caps
Definition: tmux.h:1636
int message_ignore_keys
Definition: tmux.h:1718
u_int pan_ox
Definition: tmux.h:1749
char * term_name
Definition: tmux.h:1633
uint64_t redraw_panes
Definition: tmux.h:1716
void * pan_window
Definition: tmux.h:1748
struct session * last_session
Definition: tmux.h:1744
struct utf8_data * prompt_saved
Definition: tmux.h:1732
char * term_type
Definition: tmux.h:1635
struct cmdq_list * queue
Definition: tmux.h:1611
size_t prompt_index
Definition: tmux.h:1726
u_int prompt_hindex
Definition: tmux.h:1730
char * exit_session
Definition: tmux.h:1711
int references
Definition: tmux.h:1746
char * title
Definition: tmux.h:1630
overlay_check_cb overlay_check
Definition: tmux.h:1752
const char * cwd
Definition: tmux.h:1631
prompt_free_cb prompt_freecb
Definition: tmux.h:1728
int message_ignore_styles
Definition: tmux.h:1719
char * exit_message
Definition: tmux.h:1712
@ CLIENT_EXIT_RETURN
Definition: tmux.h:1706
@ CLIENT_EXIT_SHUTDOWN
Definition: tmux.h:1707
char * prompt_string
Definition: tmux.h:1723
const char * name
Definition: tmux.h:1609
struct session * session
Definition: tmux.h:1743
struct format_job_tree * jobs
Definition: tmux.h:1628
size_t discarded
Definition: tmux.h:1643
overlay_free_cb overlay_free
Definition: tmux.h:1756
int fd
Definition: tmux.h:1619
u_int term_ncaps
Definition: tmux.h:1637
u_int pause_age
Definition: tmux.h:1616
struct control_state * control_state
Definition: tmux.h:1615
void * prompt_data
Definition: tmux.h:1729
size_t written
Definition: tmux.h:1642
u_int pan_oy
Definition: tmux.h:1750
pid_t pid
Definition: tmux.h:1618
char * prompt_last
Definition: tmux.h:1725
overlay_key_cb overlay_key
Definition: tmux.h:1755
struct key_table * keytable
Definition: tmux.h:1714
prompt_input_cb prompt_inputcb
Definition: tmux.h:1727
struct tmuxpeer * peer
Definition: tmux.h:1610
int prompt_flags
Definition: tmux.h:1741
int term_features
Definition: tmux.h:1634
overlay_mode_cb overlay_mode
Definition: tmux.h:1753
struct utf8_data * prompt_buffer
Definition: tmux.h:1724
TAILQ_ENTRY(client) entry
u_int click_button
Definition: tmux.h:1649
overlay_draw_cb overlay_draw
Definition: tmux.h:1754
char * message_string
Definition: tmux.h:1720
struct environ * environ
Definition: tmux.h:1627
Definition: tmux.h:1518
int flags
Definition: tmux.h:1521
char flag
Definition: tmux.h:1519
enum cmd_find_type type
Definition: tmux.h:1520
Definition: tmux.h:1525
struct cmd_entry_flag source
Definition: tmux.h:1536
const char * name
Definition: tmux.h:1526
const char * alias
Definition: tmux.h:1527
struct cmd_entry_flag target
Definition: tmux.h:1537
int lower
Definition: tmux.h:1531
int flags
Definition: tmux.h:1545
const char * usage
Definition: tmux.h:1534
int upper
Definition: tmux.h:1532
struct cmd_entry::@16 args
enum cmd_retval(* exec)(struct cmd *, struct cmdq_item *)
Definition: tmux.h:1547
struct window_pane * wp
Definition: tmux.h:1454
struct cmd_find_state * current
Definition: tmux.h:1449
struct window * w
Definition: tmux.h:1453
struct session * s
Definition: tmux.h:1451
struct winlink * wl
Definition: tmux.h:1452
u_int group
Definition: tmux.h:1470
struct cmds * list
Definition: tmux.h:1471
int references
Definition: tmux.h:1469
struct cmdq_item * item
Definition: tmux.h:1504
u_int line
Definition: tmux.h:1502
struct cmd_find_state fs
Definition: tmux.h:1506
struct client * c
Definition: tmux.h:1505
const char * file
Definition: tmux.h:1501
enum cmd_parse_status status
Definition: tmux.h:1489
char * error
Definition: tmux.h:1491
struct cmd_list * cmdlist
Definition: tmux.h:1490
Definition: cmd.c:212
Definition: tmux.h:1160
RB_ENTRY(environ_entry) entry
char * value
Definition: tmux.h:1162
char * name
Definition: tmux.h:1161
int flags
Definition: tmux.h:1164
Definition: tmux.h:708
u_char flags
Definition: tmux.h:709
u_char bg
Definition: tmux.h:715
u_char fg
Definition: tmux.h:714
u_char data
Definition: tmux.h:716
u_char attr
Definition: tmux.h:713
u_int offset
Definition: tmux.h:711
u_char flags
Definition: tmux.h:691
int us
Definition: tmux.h:694
int bg
Definition: tmux.h:693
struct utf8_data data
Definition: tmux.h:689
u_short attr
Definition: tmux.h:690
int fg
Definition: tmux.h:692
Definition: tmux.h:698
int bg
Definition: tmux.h:703
u_short attr
Definition: tmux.h:700
u_char flags
Definition: tmux.h:701
int fg
Definition: tmux.h:702
utf8_char data
Definition: tmux.h:699
int us
Definition: tmux.h:704
u_int extdsize
Definition: tmux.h:727
u_int cellused
Definition: tmux.h:723
struct grid_cell_entry * celldata
Definition: tmux.h:725
struct grid_extd_entry * extddata
Definition: tmux.h:728
u_int cellsize
Definition: tmux.h:724
int flags
Definition: tmux.h:730
u_int cy
Definition: tmux.h:752
struct grid * gd
Definition: tmux.h:750
u_int cx
Definition: tmux.h:751
Definition: tmux.h:734
u_int hsize
Definition: tmux.h:742
u_int sy
Definition: tmux.h:739
u_int hlimit
Definition: tmux.h:743
struct grid_line * linedata
Definition: tmux.h:745
u_int hscrolled
Definition: tmux.h:741
int flags
Definition: tmux.h:735
u_int sx
Definition: tmux.h:738
Definition: job.c:42
int flags
Definition: tmux.h:1781
RB_ENTRY(key_binding) entry
const char * note
Definition: tmux.h:1779
struct cmd_list * cmdlist
Definition: tmux.h:1778
key_code key
Definition: tmux.h:1777
struct mouse_event m
Definition: tmux.h:1268
key_code key
Definition: tmux.h:1267
RB_ENTRY(key_table) entry
u_int references
Definition: tmux.h:1793
struct window_pane * wp
Definition: tmux.h:1153
u_int xoff
Definition: tmux.h:1150
u_int sx
Definition: tmux.h:1147
u_int sy
Definition: tmux.h:1148
u_int yoff
Definition: tmux.h:1151
enum layout_type type
Definition: tmux.h:1143
struct layout_cells cells
Definition: tmux.h:1154
TAILQ_ENTRY(layout_cell) entry
struct layout_cell * parent
Definition: tmux.h:1145
key_code key
Definition: tmux.h:889
const char * command
Definition: tmux.h:890
const char * name
Definition: tmux.h:888
Definition: tmux.h:892
struct menu_item * items
Definition: tmux.h:894
const char * title
Definition: tmux.h:893
u_int count
Definition: tmux.h:895
u_int width
Definition: tmux.h:896
Definition: tmux.h:1423
char * msg
Definition: tmux.h:1424
TAILQ_ENTRY(message_entry) entry
u_int msg_num
Definition: tmux.h:1425
struct timeval msg_time
Definition: tmux.h:1426
u_int y
Definition: tmux.h:1247
int valid
Definition: tmux.h:1238
u_int statuslines
Definition: tmux.h:1244
u_int lx
Definition: tmux.h:1250
int w
Definition: tmux.h:1258
u_int b
Definition: tmux.h:1248
u_int sgr_type
Definition: tmux.h:1261
int s
Definition: tmux.h:1257
u_int x
Definition: tmux.h:1246
int ignore
Definition: tmux.h:1239
u_int oy
Definition: tmux.h:1255
key_code key
Definition: tmux.h:1241
u_int ly
Definition: tmux.h:1251
int wp
Definition: tmux.h:1259
u_int lb
Definition: tmux.h:1252
u_int ox
Definition: tmux.h:1254
int statusat
Definition: tmux.h:1243
u_int sgr_b
Definition: tmux.h:1262
int argc
Definition: tmux.h:557
int stream
Definition: tmux.h:566
int stream
Definition: tmux.h:570
int error
Definition: tmux.h:571
int stream
Definition: tmux.h:561
int fd
Definition: tmux.h:562
int stream
Definition: tmux.h:590
int stream
Definition: tmux.h:581
int stream
Definition: tmux.h:575
int flags
Definition: tmux.h:577
int stream
Definition: tmux.h:585
Definition: options.c:50
const char * to
Definition: tmux.h:1854
const char * from
Definition: tmux.h:1853
Definition: tmux.h:1830
const char * name
Definition: tmux.h:1831
const char * pattern
Definition: tmux.h:1846
long long default_num
Definition: tmux.h:1842
const char * default_str
Definition: tmux.h:1841
u_int maximum
Definition: tmux.h:1838
const char ** default_arr
Definition: tmux.h:1843
const char * separator
Definition: tmux.h:1845
int flags
Definition: tmux.h:1835
const char * text
Definition: tmux.h:1848
u_int minimum
Definition: tmux.h:1837
int scope
Definition: tmux.h:1834
const char ** choices
Definition: tmux.h:1839
const char * unit
Definition: tmux.h:1849
const char * alternative_name
Definition: tmux.h:1832
int pane_lines
Definition: tmux.h:872
int pane_status
Definition: tmux.h:871
struct client * c
Definition: tmux.h:866
u_int statuslines
Definition: tmux.h:868
u_int bg
Definition: tmux.h:861
struct screen_write_citem * item
Definition: tmux.h:859
u_int scrolled
Definition: tmux.h:860
struct window_pane * wp
Definition: tmux.h:850
void * arg
Definition: tmux.h:857
struct screen * s
Definition: tmux.h:851
screen_write_init_ctx_cb init_ctx_cb
Definition: tmux.h:856
Definition: tmux.h:816
u_int saved_cx
Definition: tmux.h:834
u_int cy
Definition: tmux.h:824
struct grid_cell saved_cell
Definition: tmux.h:837
int mode
Definition: tmux.h:832
struct screen_sel * sel
Definition: tmux.h:841
int saved_flags
Definition: tmux.h:838
struct screen_titles * titles
Definition: tmux.h:819
struct screen_write_cline * write_list
Definition: tmux.h:843
u_int cx
Definition: tmux.h:823
char * title
Definition: tmux.h:817
struct grid * saved_grid
Definition: tmux.h:836
u_int saved_cy
Definition: tmux.h:835
bitstr_t * tabs
Definition: tmux.h:840
char * path
Definition: tmux.h:818
u_int rupper
Definition: tmux.h:829
u_int rlower
Definition: tmux.h:830
char * ccolour
Definition: tmux.h:827
u_int cstyle
Definition: tmux.h:826
struct grid * grid
Definition: tmux.h:821
RB_ENTRY(session_group) entry
TAILQ_HEAD(, session) sessions
const char * name
Definition: tmux.h:1172
Definition: tmux.h:1179
char * name
Definition: tmux.h:1182
u_int id
Definition: tmux.h:1180
u_int statuslines
Definition: tmux.h:1197
struct timeval creation_time
Definition: tmux.h:1185
struct timeval last_attached_time
Definition: tmux.h:1186
struct winlinks windows
Definition: tmux.h:1194
struct winlink_stack lastw
Definition: tmux.h:1193
struct event lock_timer
Definition: tmux.h:1190
struct timeval activity_time
Definition: tmux.h:1187
struct timeval last_activity_time
Definition: tmux.h:1188
int statusat
Definition: tmux.h:1196
TAILQ_ENTRY(session) gentry
int references
Definition: tmux.h:1211
struct environ * environ
Definition: tmux.h:1209
struct winlink * curw
Definition: tmux.h:1192
const char * cwd
Definition: tmux.h:1183
RB_ENTRY(session) entry
struct termios * tio
Definition: tmux.h:1207
struct options * options
Definition: tmux.h:1199
u_int attached
Definition: tmux.h:1205
int flags
Definition: tmux.h:1203
struct layout_cell * lc
Definition: tmux.h:1877
struct client * tc
Definition: tmux.h:1874
struct window_pane * wp0
Definition: tmux.h:1876
struct environ * environ
Definition: tmux.h:1882
struct session * s
Definition: tmux.h:1872
struct cmdq_item * item
Definition: tmux.h:1870
char ** argv
Definition: tmux.h:1880
const char * name
Definition: tmux.h:1879
int flags
Definition: tmux.h:1887
const char * cwd
Definition: tmux.h:1885
struct winlink * wl
Definition: tmux.h:1873
int argc
Definition: tmux.h:1881
Definition: tmux.h:1552
char * expanded
Definition: tmux.h:1553
struct screen * active
Definition: tmux.h:1560
TAILQ_ENTRY(style_range) entry
u_int end
Definition: tmux.h:785
u_int argument
Definition: tmux.h:782
enum style_range_type type
Definition: tmux.h:781
u_int start
Definition: tmux.h:784
Definition: tmux.h:799
enum style_align align
Definition: tmux.h:804
u_int range_argument
Definition: tmux.h:808
struct grid_cell gc
Definition: tmux.h:800
int fill
Definition: tmux.h:803
int ignore
Definition: tmux.h:801
enum style_default_type default_type
Definition: tmux.h:810
enum style_range_type range_type
Definition: tmux.h:807
enum style_list list
Definition: tmux.h:805
Definition: proc.c:54
Definition: proc.c:36
Definition: tmux.h:1375
const struct grid_cell * cell
Definition: tmux.h:1382
u_int rxoff
Definition: tmux.h:1402
int * palette
Definition: tmux.h:1412
u_int yoff
Definition: tmux.h:1401
u_int wsy
Definition: tmux.h:1419
struct screen * s
Definition: tmux.h:1376
tty_ctx_set_client_cb set_client_cb
Definition: tmux.h:1379
u_int wox
Definition: tmux.h:1416
u_int xoff
Definition: tmux.h:1400
int wrapped
Definition: tmux.h:1383
u_int woy
Definition: tmux.h:1417
u_int sx
Definition: tmux.h:1404
tty_ctx_redraw_cb redraw_cb
Definition: tmux.h:1378
u_int num
Definition: tmux.h:1385
u_int ocx
Definition: tmux.h:1393
u_int ryoff
Definition: tmux.h:1403
u_int orupper
Definition: tmux.h:1396
struct grid_cell defaults
Definition: tmux.h:1411
u_int sy
Definition: tmux.h:1405
u_int orlower
Definition: tmux.h:1397
u_int wsx
Definition: tmux.h:1418
void * arg
Definition: tmux.h:1380
int bigger
Definition: tmux.h:1415
u_int ocy
Definition: tmux.h:1394
u_int bg
Definition: tmux.h:1408
void * ptr
Definition: tmux.h:1386
Definition: tmux.h:1272
struct tty_key * right
Definition: tmux.h:1277
struct tty_key * next
Definition: tmux.h:1279
struct tty_key * left
Definition: tmux.h:1276
key_code key
Definition: tmux.h:1274
char ch
Definition: tmux.h:1273
int features
Definition: tmux.h:1286
struct tty_code * codes
Definition: tmux.h:1290
char acs[UCHAR_MAX+1][2]
Definition: tmux.h:1288
struct tty * tty
Definition: tmux.h:1285
int flags
Definition: tmux.h:1298
char * name
Definition: tmux.h:1284
LIST_ENTRY(tty_term) entry
Definition: tmux.h:1304
u_int sx
Definition: tmux.h:1308
char * ccolour
Definition: tmux.h:1316
u_int cy
Definition: tmux.h:1314
struct event event_out
Definition: tmux.h:1334
void(* mouse_drag_release)(struct client *, struct mouse_event *)
Definition: tmux.h:1365
int mouse_drag_flag
Definition: tmux.h:1362
size_t discarded
Definition: tmux.h:1337
struct grid_cell cell
Definition: tmux.h:1341
struct tty_term * term
Definition: tmux.h:1357
u_int ypixel
Definition: tmux.h:1311
u_int rright
Definition: tmux.h:1330
u_int cstyle
Definition: tmux.h:1315
u_int mouse_last_b
Definition: tmux.h:1361
struct event event_in
Definition: tmux.h:1332
struct termios tio
Definition: tmux.h:1339
u_int osx
Definition: tmux.h:1321
u_int sy
Definition: tmux.h:1309
u_int rleft
Definition: tmux.h:1329
u_int osy
Definition: tmux.h:1322
u_int xpixel
Definition: tmux.h:1310
int mode
Definition: tmux.h:1324
struct event timer
Definition: tmux.h:1336
u_int mouse_last_x
Definition: tmux.h:1359
u_int cx
Definition: tmux.h:1313
struct event start_timer
Definition: tmux.h:1306
int flags
Definition: tmux.h:1355
int oflag
Definition: tmux.h:1318
u_int rupper
Definition: tmux.h:1327
struct grid_cell last_cell
Definition: tmux.h:1342
struct event key_timer
Definition: tmux.h:1368
void(* mouse_drag_update)(struct client *, struct mouse_event *)
Definition: tmux.h:1363
struct evbuffer * in
Definition: tmux.h:1333
u_int oox
Definition: tmux.h:1319
struct client * client
Definition: tmux.h:1305
struct tty_key * key_tree
Definition: tmux.h:1369
struct evbuffer * out
Definition: tmux.h:1335
u_int ooy
Definition: tmux.h:1320
u_int rlower
Definition: tmux.h:1326
u_int mouse_last_y
Definition: tmux.h:1360
u_char data[21]
Definition: tmux.h:629
u_char size
Definition: tmux.h:632
u_char have
Definition: tmux.h:631
u_char width
Definition: tmux.h:634
Definition: tmux.h:927
struct window_pane * swp
Definition: tmux.h:929
const struct window_mode * mode
Definition: tmux.h:931
struct screen * screen
Definition: tmux.h:934
TAILQ_ENTRY(window_mode_entry) entry
void * data
Definition: tmux.h:932
struct window_pane * wp
Definition: tmux.h:928
u_int prefix
Definition: tmux.h:935
void(* resize)(struct window_mode_entry *, u_int, u_int)
Definition: tmux.h:912
void(* free)(struct window_mode_entry *)
Definition: tmux.h:911
void(* command)(struct window_mode_entry *, struct client *, struct session *, struct winlink *, struct args *, struct mouse_event *)
Definition: tmux.h:919
void(* update)(struct window_mode_entry *)
Definition: tmux.h:913
const char * default_format
Definition: tmux.h:907
const char * name
Definition: tmux.h:906
void(* key)(struct window_mode_entry *, struct client *, struct session *, struct winlink *, key_code, struct mouse_event *)
Definition: tmux.h:914
void(* formats)(struct window_mode_entry *, struct format_tree *)
Definition: tmux.h:922
size_t used
Definition: tmux.h:942
TAILQ_ENTRY(window_pane_resize) entry
pid_t pid
Definition: tmux.h:997
char * shell
Definition: tmux.h:994
struct screen * screen
Definition: tmux.h:1020
int * palette
Definition: tmux.h:1014
int argc
Definition: tmux.h:992
int border_gc_set
Definition: tmux.h:1031
struct event resize_timer
Definition: tmux.h:1008
TAILQ_HEAD(, window_mode_entry) modes
char * searchstr
Definition: tmux.h:1028
u_int xoff
Definition: tmux.h:971
struct window_pane_offset pipe_offset
Definition: tmux.h:1018
u_int active_point
Definition: tmux.h:960
struct layout_cell * saved_layout_cell
Definition: tmux.h:966
struct layout_cell * layout_cell
Definition: tmux.h:965
int fd
Definition: tmux.h:1001
struct window_pane_resizes resize_queue
Definition: tmux.h:1007
struct window_pane_offset offset
Definition: tmux.h:1004
int fg
Definition: tmux.h:974
int bg
Definition: tmux.h:975
u_int yoff
Definition: tmux.h:972
RB_ENTRY(window_pane) tree_entry
char ** argv
Definition: tmux.h:993
size_t status_size
Definition: tmux.h:1024
TAILQ_ENTRY(window_pane) entry
int status
Definition: tmux.h:999
int flags
Definition: tmux.h:977
struct grid_cell cached_active_gc
Definition: tmux.h:1013
int pipe_fd
Definition: tmux.h:1016
struct grid_cell border_gc
Definition: tmux.h:1032
char * cwd
Definition: tmux.h:995
struct input_ctx * ictx
Definition: tmux.h:1010
struct screen base
Definition: tmux.h:1021
u_int sy
Definition: tmux.h:969
struct bufferevent * event
Definition: tmux.h:1002
struct window * window
Definition: tmux.h:962
struct options * options
Definition: tmux.h:963
u_int sx
Definition: tmux.h:968
struct grid_cell cached_gc
Definition: tmux.h:1012
size_t base_offset
Definition: tmux.h:1005
int searchregex
Definition: tmux.h:1029
struct bufferevent * pipe_event
Definition: tmux.h:1017
struct screen status_screen
Definition: tmux.h:1023
u_int id
Definition: tmux.h:959
Definition: tmux.h:1041
struct event alerts_timer
Definition: tmux.h:1049
struct event offset_timer
Definition: tmux.h:1050
u_int ypixel
Definition: tmux.h:1066
u_int id
Definition: tmux.h:1042
struct timeval name_time
Definition: tmux.h:1047
int lastlayout
Definition: tmux.h:1058
struct timeval activity_time
Definition: tmux.h:1052
struct layout_cell * layout_root
Definition: tmux.h:1059
struct layout_cell * saved_layout_root
Definition: tmux.h:1060
TAILQ_HEAD(, winlink) winlinks
char * old_layout
Definition: tmux.h:1061
char * name
Definition: tmux.h:1045
int flags
Definition: tmux.h:1073
u_int new_sx
Definition: tmux.h:1068
u_int references
Definition: tmux.h:1087
struct options * options
Definition: tmux.h:1085
u_int sx
Definition: tmux.h:1063
int alerts_queued
Definition: tmux.h:1082
TAILQ_ENTRY(window) alerts_entry
u_int new_xpixel
Definition: tmux.h:1070
void * latest
Definition: tmux.h:1043
u_int new_sy
Definition: tmux.h:1069
struct event name_event
Definition: tmux.h:1046
struct window_panes panes
Definition: tmux.h:1056
u_int new_ypixel
Definition: tmux.h:1071
u_int xpixel
Definition: tmux.h:1065
struct window_pane * active
Definition: tmux.h:1054
u_int sy
Definition: tmux.h:1064
RB_ENTRY(window) entry
struct window_pane * last
Definition: tmux.h:1055
void log_toggle(const char *)
Definition: log.c:78
void session_group_synchronize_to(struct session *)
Definition: session.c:598
int winlink_cmp(struct winlink *, struct winlink *)
Definition: window.c:84
int session_alive(struct session *)
Definition: session.c:62
void tty_cell(struct tty *, const struct grid_cell *, const struct grid_cell *, int *)
Definition: tty.c:1930
u_int layout_set_select(struct window *, u_int)
Definition: layout-set.c:66
struct key_table * key_bindings_next_table(struct key_table *)
Definition: key-bindings.c:127
int menu_display(struct menu *, int, struct cmdq_item *, u_int, u_int, struct client *, struct cmd_find_state *, menu_choice_cb, void *)
Definition: menu.c:346
char * regsub(const char *, const char *, const char *, int)
Definition: regsub.c:61
void cmd_free(struct cmd *)
Definition: cmd.c:547
int(* prompt_input_cb)(struct client *, void *, const char *, int)
Definition: tmux.h:1601
options_table_type
Definition: tmux.h:1810
@ OPTIONS_TABLE_CHOICE
Definition: tmux.h:1816
@ OPTIONS_TABLE_KEY
Definition: tmux.h:1813
@ OPTIONS_TABLE_STRING
Definition: tmux.h:1811
@ OPTIONS_TABLE_NUMBER
Definition: tmux.h:1812
@ OPTIONS_TABLE_COMMAND
Definition: tmux.h:1817
@ OPTIONS_TABLE_COLOUR
Definition: tmux.h:1814
@ OPTIONS_TABLE_FLAG
Definition: tmux.h:1815
time_t paste_buffer_created(struct paste_buffer *)
Definition: paste.c:91
struct options_entry * options_set_number(struct options *, const char *, long long)
Definition: options.c:752
int grid_reader_cursor_jump(struct grid_reader *, const struct utf8_data *)
Definition: grid-reader.c:310
void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *, const void *)
Definition: tty.c:528
int colour_fromstring(const char *s)
Definition: colour.c:172
void server_lock(void)
Definition: server-fn.c:133
void screen_write_alternateon(struct screen_write_ctx *, struct grid_cell *, int)
int tty_apply_features(struct tty_term *, int)
Definition: tty-features.c:311
void layout_spread_out(struct window_pane *)
Definition: layout.c:1104
void paste_replace(struct paste_buffer *, char *, size_t)
Definition: paste.c:301
void environ_put(struct environ *, const char *, int)
Definition: environ.c:150
int cmd_find_valid_state(struct cmd_find_state *)
Definition: cmd-find.c:664
void style_set(struct style *, const struct grid_cell *)
Definition: style.c:307
void layout_init(struct window *, struct window_pane *)
Definition: layout.c:478
struct style_range * status_get_range(struct client *, u_int, u_int)
Definition: status.c:236
void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int)
Definition: screen-write.c:931
void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *, u_char)
Definition: screen-write.c:321
#define KEYC_MOUSE_KEY(name)
Definition: tmux.h:158
int cmdq_get_flags(struct cmdq_item *)
Definition: cmd-queue.c:199
int ptm_fd
Definition: tmux.c:43
void tty_free(struct tty *)
Definition: tty.c:445
void status_prompt_set(struct client *, struct cmd_find_state *, const char *, const char *, prompt_input_cb, prompt_free_cb, void *, int)
Definition: status.c:546
void tty_add_features(int *, const char *, const char *)
Definition: tty-features.c:262
void layout_close_pane(struct window_pane *)
Definition: layout.c:1037
struct job * job_run(const char *, int, char **, struct session *, const char *, job_update_cb, job_complete_cb, job_free_cb, void *, int, int, int)
void screen_write_reset(struct screen_write_ctx *)
Definition: screen-write.c:306
void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int, u_int, int, struct grid_cell *)
Definition: screen.c:369
void winlink_stack_push(struct winlink_stack *, struct winlink *)
Definition: window.c:241
const char * server_client_get_key_table(struct client *)
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *)
Definition: grid.c:529
void server_lock_session(struct session *)
Definition: server-fn.c:144
void grid_adjust_lines(struct grid *, u_int)
Definition: grid.c:188
void server_destroy_session(struct session *)
Definition: server-fn.c:433
tty_code_code
Definition: tmux.h:274
@ TTYC_KIC6
Definition: tmux.h:429
@ TTYC_KF7
Definition: tmux.h:415
@ TTYC_OL
Definition: tmux.h:468
@ TTYC_KEND4
Definition: tmux.h:351
@ TTYC_KF32
Definition: tmux.h:380
@ TTYC_KDC4
Definition: tmux.h:337
@ TTYC_KEND5
Definition: tmux.h:352
@ TTYC_CLMG
Definition: tmux.h:285
@ TTYC_KCUF1
Definition: tmux.h:333
@ TTYC_KF4
Definition: tmux.h:388
@ TTYC_U8
Definition: tmux.h:499
@ TTYC_KCUU1
Definition: tmux.h:334
@ TTYC_KF34
Definition: tmux.h:382
@ TTYC_ENACS
Definition: tmux.h:316
@ TTYC_CMG
Definition: tmux.h:286
@ TTYC_KHOM2
Definition: tmux.h:418
@ TTYC_KRIT6
Definition: tmux.h:459
@ TTYC_KF13
Definition: tmux.h:359
@ TTYC_E3
Definition: tmux.h:311
@ TTYC_KF10
Definition: tmux.h:356
@ TTYC_KEND2
Definition: tmux.h:349
@ TTYC_DSMG
Definition: tmux.h:310
@ TTYC_KF15
Definition: tmux.h:361
@ TTYC_KPRV4
Definition: tmux.h:450
@ TTYC_KMOUS
Definition: tmux.h:439
@ TTYC_ENMG
Definition: tmux.h:320
@ TTYC_SMOL
Definition: tmux.h:490
@ TTYC_RMACS
Definition: tmux.h:475
@ TTYC_IL1
Definition: tmux.h:327
@ TTYC_KNXT2
Definition: tmux.h:441
@ TTYC_KF53
Definition: tmux.h:403
@ TTYC_REV
Definition: tmux.h:471
@ TTYC_SMACS
Definition: tmux.h:487
@ TTYC_KCUB1
Definition: tmux.h:331
@ TTYC_INVIS
Definition: tmux.h:329
@ TTYC_KIC5
Definition: tmux.h:428
@ TTYC_KF30
Definition: tmux.h:378
@ TTYC_CUD1
Definition: tmux.h:295
@ TTYC_KLFT7
Definition: tmux.h:438
@ TTYC_CUP
Definition: tmux.h:298
@ TTYC_KRIT3
Definition: tmux.h:456
@ TTYC_KF26
Definition: tmux.h:373
@ TTYC_KF54
Definition: tmux.h:404
@ TTYC_KF36
Definition: tmux.h:384
@ TTYC_KF29
Definition: tmux.h:376
@ TTYC_AM
Definition: tmux.h:276
@ TTYC_EL
Definition: tmux.h:314
@ TTYC_KDN4
Definition: tmux.h:344
@ TTYC_SITM
Definition: tmux.h:486
@ TTYC_CUU1
Definition: tmux.h:300
@ TTYC_KNXT6
Definition: tmux.h:445
@ TTYC_CIVIS
Definition: tmux.h:283
@ TTYC_CUF
Definition: tmux.h:296
@ TTYC_KEND3
Definition: tmux.h:350
@ TTYC_KF45
Definition: tmux.h:394
@ TTYC_KDC7
Definition: tmux.h:340
@ TTYC_OP
Definition: tmux.h:469
@ TTYC_KF51
Definition: tmux.h:401
@ TTYC_CS
Definition: tmux.h:290
@ TTYC_KF20
Definition: tmux.h:367
@ TTYC_KF31
Definition: tmux.h:379
@ TTYC_ENBP
Definition: tmux.h:317
@ TTYC_KF55
Definition: tmux.h:405
@ TTYC_SE
Definition: tmux.h:478
@ TTYC_BEL
Definition: tmux.h:279
@ TTYC_KF3
Definition: tmux.h:377
@ TTYC_XT
Definition: tmux.h:501
@ TTYC_KCUD1
Definition: tmux.h:332
@ TTYC_SETAB
Definition: tmux.h:479
@ TTYC_KIND
Definition: tmux.h:432
@ TTYC_KF21
Definition: tmux.h:368
@ TTYC_KUP6
Definition: tmux.h:465
@ TTYC_KF9
Definition: tmux.h:417
@ TTYC_KNP
Definition: tmux.h:440
@ TTYC_CUB
Definition: tmux.h:292
@ TTYC_KF27
Definition: tmux.h:374
@ TTYC_KF61
Definition: tmux.h:412
@ TTYC_KF44
Definition: tmux.h:393
@ TTYC_KF8
Definition: tmux.h:416
@ TTYC_KICH1
Definition: tmux.h:431
@ TTYC_KDN7
Definition: tmux.h:347
@ TTYC_KIC2
Definition: tmux.h:425
@ TTYC_KF33
Definition: tmux.h:381
@ TTYC_BIDI
Definition: tmux.h:280
@ TTYC_KF24
Definition: tmux.h:371
@ TTYC_DCH
Definition: tmux.h:302
@ TTYC_DSFCS
Definition: tmux.h:309
@ TTYC_SETAF
Definition: tmux.h:480
@ TTYC_CR
Definition: tmux.h:289
@ TTYC_KDN5
Definition: tmux.h:345
@ TTYC_KLFT3
Definition: tmux.h:434
@ TTYC_KRIT2
Definition: tmux.h:455
@ TTYC_SYNC
Definition: tmux.h:496
@ TTYC_KF42
Definition: tmux.h:391
@ TTYC_KRIT7
Definition: tmux.h:460
@ TTYC_KRIT4
Definition: tmux.h:457
@ TTYC_DIM
Definition: tmux.h:304
@ TTYC_KF37
Definition: tmux.h:385
@ TTYC_KNXT4
Definition: tmux.h:443
@ TTYC_KPRV3
Definition: tmux.h:449
@ TTYC_KIC7
Definition: tmux.h:430
@ TTYC_KIC4
Definition: tmux.h:427
@ TTYC_KPP
Definition: tmux.h:447
@ TTYC_FSL
Definition: tmux.h:321
@ TTYC_ED
Definition: tmux.h:313
@ TTYC_KF38
Definition: tmux.h:386
@ TTYC_KHOM7
Definition: tmux.h:423
@ TTYC_CVVIS
Definition: tmux.h:301
@ TTYC_KDC5
Definition: tmux.h:338
@ TTYC_KF63
Definition: tmux.h:414
@ TTYC_KHOM4
Definition: tmux.h:420
@ TTYC_KF11
Definition: tmux.h:357
@ TTYC_KDN6
Definition: tmux.h:346
@ TTYC_KLFT5
Definition: tmux.h:436
@ TTYC_KRIT5
Definition: tmux.h:458
@ TTYC_KF48
Definition: tmux.h:397
@ TTYC_ACSC
Definition: tmux.h:275
@ TTYC_KF62
Definition: tmux.h:413
@ TTYC_KF18
Definition: tmux.h:364
@ TTYC_CUF1
Definition: tmux.h:297
@ TTYC_CUD
Definition: tmux.h:294
@ TTYC_KF56
Definition: tmux.h:406
@ TTYC_KDCH1
Definition: tmux.h:341
@ TTYC_KHOM5
Definition: tmux.h:421
@ TTYC_KF59
Definition: tmux.h:409
@ TTYC_AX
Definition: tmux.h:277
@ TTYC_SMSO
Definition: tmux.h:491
@ TTYC_BOLD
Definition: tmux.h:282
@ TTYC_KF46
Definition: tmux.h:395
@ TTYC_KF35
Definition: tmux.h:383
@ TTYC_TSL
Definition: tmux.h:498
@ TTYC_KIC3
Definition: tmux.h:426
@ TTYC_SMKX
Definition: tmux.h:489
@ TTYC_KF47
Definition: tmux.h:396
@ TTYC_KF28
Definition: tmux.h:375
@ TTYC_KHOM6
Definition: tmux.h:422
@ TTYC_KLFT2
Definition: tmux.h:433
@ TTYC_KLFT4
Definition: tmux.h:435
@ TTYC_KPRV2
Definition: tmux.h:448
@ TTYC_KF16
Definition: tmux.h:362
@ TTYC_SMCUP
Definition: tmux.h:488
@ TTYC_KF50
Definition: tmux.h:400
@ TTYC_KUP3
Definition: tmux.h:462
@ TTYC_SETRGBF
Definition: tmux.h:483
@ TTYC_KF60
Definition: tmux.h:411
@ TTYC_RIN
Definition: tmux.h:474
@ TTYC_ENEKS
Definition: tmux.h:318
@ TTYC_KF14
Definition: tmux.h:360
@ TTYC_VPA
Definition: tmux.h:500
@ TTYC_KEND6
Definition: tmux.h:353
@ TTYC_KF57
Definition: tmux.h:407