diff options
Diffstat (limited to 'tmux.h')
-rw-r--r-- | tmux.h | 120 |
1 files changed, 71 insertions, 49 deletions
@@ -39,6 +39,7 @@ extern char **environ; struct args; +struct args_value; struct client; struct cmd_find_state; struct cmdq_item; @@ -235,8 +236,8 @@ enum { /* Termcap codes. */ enum tty_code_code { - TTYC_AX = 0, TTYC_ACSC, + TTYC_AX, TTYC_BCE, TTYC_BEL, TTYC_BLINK, @@ -685,15 +686,6 @@ struct style { u_int range_argument; }; -/* Hook data structures. */ -struct hook { - const char *name; - - struct cmd_list *cmdlist; - - RB_ENTRY(hook) entry; -}; - /* Virtual screen. */ struct screen_sel; struct screen_titles; @@ -816,7 +808,7 @@ struct window_pane { int argc; char **argv; char *shell; - const char *cwd; + char *cwd; pid_t pid; char tty[TTY_NAME_MAX]; @@ -997,7 +989,6 @@ struct session { int statusat; u_int statuslines; - struct hooks *hooks; struct options *options; #define SESSION_PASTING 0x1 @@ -1516,6 +1507,16 @@ struct key_table { }; RB_HEAD(key_tables, key_table); +/* Option data. */ +RB_HEAD(options_array, options_array_item); +union options_value { + char *string; + long long number; + struct style style; + struct options_array array; + struct cmd_list *cmdlist; +}; + /* Option table entries. */ enum options_table_type { OPTIONS_TABLE_STRING, @@ -1525,20 +1526,24 @@ enum options_table_type { OPTIONS_TABLE_FLAG, OPTIONS_TABLE_CHOICE, OPTIONS_TABLE_STYLE, - OPTIONS_TABLE_ARRAY, + OPTIONS_TABLE_COMMAND }; enum options_table_scope { OPTIONS_TABLE_NONE, OPTIONS_TABLE_SERVER, OPTIONS_TABLE_SESSION, - OPTIONS_TABLE_WINDOW, + OPTIONS_TABLE_WINDOW }; +#define OPTIONS_TABLE_IS_ARRAY 0x1 +#define OPTIONS_TABLE_IS_HOOK 0x2 + struct options_table_entry { const char *name; enum options_table_type type; enum options_table_scope scope; + int flags; u_int minimum; u_int maximum; @@ -1563,8 +1568,34 @@ struct options_table_entry { #define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]" #define CMD_BUFFER_USAGE "[-b buffer-name]" +/* Spawn common context. */ +struct spawn_context { + struct cmdq_item *item; + + struct session *s; + struct winlink *wl; + + struct window_pane *wp0; + struct layout_cell *lc; + + const char *name; + char **argv; + int argc; + struct environ *environ; + + int idx; + const char *cwd; + + int flags; +#define SPAWN_KILL 0x1 +#define SPAWN_DETACHED 0x2 +#define SPAWN_RESPAWN 0x4 +#define SPAWN_BEFORE 0x8 +#define SPAWN_NONOTIFY 0x10 +#define SPAWN_FULLSIZE 0x20 +}; + /* tmux.c */ -extern struct hooks *global_hooks; extern struct options *global_options; extern struct options *global_s_options; extern struct options *global_w_options; @@ -1613,7 +1644,7 @@ struct paste_buffer *paste_walk(struct paste_buffer *); struct paste_buffer *paste_get_top(const char **); struct paste_buffer *paste_get_name(const char *); void paste_free(struct paste_buffer *); -void paste_add(char *, size_t); +void paste_add(const char *, char *, size_t); int paste_rename(const char *, const char *, char **); int paste_set(char *, size_t, const char *, char **); char *paste_make_sample(struct paste_buffer *); @@ -1658,20 +1689,6 @@ u_int format_width(const char *); char *format_trim_left(const char *, u_int); char *format_trim_right(const char *, u_int); -/* hooks.c */ -struct hook; -struct hooks *hooks_get(struct session *); -struct hooks *hooks_create(struct hooks *); -void hooks_free(struct hooks *); -struct hook *hooks_first(struct hooks *); -struct hook *hooks_next(struct hook *); -void hooks_add(struct hooks *, const char *, struct cmd_list *); -void hooks_copy(struct hooks *, struct hooks *); -void hooks_remove(struct hooks *, const char *); -struct hook *hooks_find(struct hooks *, const char *); -void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *, - struct cmd_find_state *, const char *, ...); - /* notify.c */ void notify_hook(struct cmdq_item *, const char *); void notify_input(struct window_pane *, struct evbuffer *); @@ -1697,17 +1714,18 @@ struct options_entry *options_get_only(struct options *, const char *); struct options_entry *options_get(struct options *, const char *); void options_remove(struct options_entry *); void options_array_clear(struct options_entry *); -const char *options_array_get(struct options_entry *, u_int); +union options_value *options_array_get(struct options_entry *, u_int); int options_array_set(struct options_entry *, u_int, const char *, - int); -void options_array_assign(struct options_entry *, const char *); + int, char **); +int options_array_assign(struct options_entry *, const char *, + char **); struct options_array_item *options_array_first(struct options_entry *); struct options_array_item *options_array_next(struct options_array_item *); u_int options_array_item_index(struct options_array_item *); -const char *options_array_item_value(struct options_array_item *); +union options_value *options_array_item_value(struct options_array_item *); int options_isarray(struct options_entry *); int options_isstring(struct options_entry *); -const char *options_tostring(struct options_entry *, int, int); +char *options_tostring(struct options_entry *, int, int); char *options_parse(const char *, int *); struct options_entry *options_parse_get(struct options *, const char *, int *, int); @@ -1857,6 +1875,8 @@ void args_free(struct args *); char *args_print(struct args *); int args_has(struct args *, u_char); const char *args_get(struct args *, u_char); +const char *args_first_value(struct args *, u_char, struct args_value **); +const char *args_next_value(struct args_value **); long long args_strtonum(struct args *, u_char, long long, long long, char **); @@ -1921,6 +1941,8 @@ struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *, struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *); void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *); void cmdq_append(struct client *, struct cmdq_item *); +void cmdq_insert_hook(struct session *, struct cmdq_item *, + struct cmd_find_state *, const char *, ...); void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *, const char *, ...); u_int cmdq_next(struct client *); @@ -2234,17 +2256,17 @@ struct window *window_find_by_id_str(const char *); struct window *window_find_by_id(u_int); void window_update_activity(struct window *); struct window *window_create(u_int, u_int); -struct window *window_create_spawn(const char *, int, char **, const char *, - const char *, const char *, struct environ *, - struct termios *, u_int, u_int, u_int, char **); +void window_destroy(struct window *); +void window_pane_set_event(struct window_pane *); struct window_pane *window_get_active_at(struct window *, u_int, u_int); struct window_pane *window_find_string(struct window *, const char *); int window_has_pane(struct window *, struct window_pane *); -int window_set_active_pane(struct window *, struct window_pane *); +int window_set_active_pane(struct window *, struct window_pane *, + int); void window_redraw_active_switch(struct window *, struct window_pane *); -struct window_pane *window_add_pane(struct window *, struct window_pane *, int, - int, u_int); +struct window_pane *window_add_pane(struct window *, struct window_pane *, + u_int, int); void window_resize(struct window *, u_int, u_int); int window_zoom(struct window_pane *); int window_unzoom(struct window *); @@ -2261,9 +2283,6 @@ void window_destroy_panes(struct window *); struct window_pane *window_pane_find_by_id_str(const char *); struct window_pane *window_pane_find_by_id(u_int); int window_pane_destroy_ready(struct window_pane *); -int window_pane_spawn(struct window_pane *, int, char **, - const char *, const char *, const char *, struct environ *, - struct termios *, char **); void window_pane_resize(struct window_pane *, u_int, u_int); void window_pane_alternate_on(struct window_pane *, struct grid_cell *, int); @@ -2321,7 +2340,7 @@ void layout_resize_pane_to(struct window_pane *, enum layout_type, u_int); void layout_assign_pane(struct layout_cell *, struct window_pane *); struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type, - int, int, int); + int, int); void layout_close_pane(struct window_pane *); int layout_spread_cell(struct window *, struct layout_cell *); void layout_spread_out(struct window_pane *); @@ -2420,10 +2439,9 @@ int session_alive(struct session *); struct session *session_find(const char *); struct session *session_find_by_id_str(const char *); struct session *session_find_by_id(u_int); -struct session *session_create(const char *, const char *, int, char **, - const char *, const char *, struct environ *, - struct options *, struct termios *, int, char **); -void session_destroy(struct session *, const char *); +struct session *session_create(const char *, const char *, const char *, + struct environ *, struct options *, struct termios *); +void session_destroy(struct session *, int, const char *); void session_add_ref(struct session *, const char *); void session_remove_ref(struct session *, const char *); int session_check_name(const char *); @@ -2497,4 +2515,8 @@ void style_set(struct style *, const struct grid_cell *); void style_copy(struct style *, struct style *); int style_is_default(struct style *); +/* spawn.c */ +struct winlink *spawn_window(struct spawn_context *, char **); +struct window_pane *spawn_pane(struct spawn_context *, char **); + #endif /* TMUX_H */ |