2009-06-02 00:58:49 +02:00
|
|
|
/* $OpenBSD$ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TMUX_H
|
|
|
|
#define TMUX_H
|
|
|
|
|
2012-05-21 20:27:42 +02:00
|
|
|
#define PROTOCOL_VERSION 7
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/tree.h>
|
2009-08-11 19:18:35 +02:00
|
|
|
#include <sys/uio.h>
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-06-04 20:48:24 +02:00
|
|
|
#include <bitstring.h>
|
2009-11-04 21:50:11 +01:00
|
|
|
#include <event.h>
|
2009-06-02 00:58:49 +02:00
|
|
|
#include <getopt.h>
|
2010-05-26 18:44:32 +02:00
|
|
|
#include <imsg.h>
|
2009-06-02 00:58:49 +02:00
|
|
|
#include <limits.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
#include "array.h"
|
|
|
|
|
2009-07-21 20:38:52 +02:00
|
|
|
extern char *__progname;
|
2009-08-08 23:52:43 +02:00
|
|
|
extern char **environ;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-07-12 18:07:56 +02:00
|
|
|
/* Default configuration files. */
|
2009-06-02 00:58:49 +02:00
|
|
|
#define DEFAULT_CFG ".tmux.conf"
|
2009-07-12 18:07:56 +02:00
|
|
|
#define SYSTEM_CFG "/etc/tmux.conf"
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Default prompt history length. */
|
|
|
|
#define PROMPT_HISTORY 100
|
|
|
|
|
2009-12-14 11:43:41 +01:00
|
|
|
/*
|
2009-07-19 15:21:40 +02:00
|
|
|
* Minimum layout cell size, NOT including separator line. The scroll region
|
|
|
|
* cannot be one line in height so this must be at least two.
|
|
|
|
*/
|
|
|
|
#define PANE_MINIMUM 2
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Automatic name refresh interval, in milliseconds. */
|
|
|
|
#define NAME_INTERVAL 500
|
|
|
|
|
2009-07-26 14:58:44 +02:00
|
|
|
/*
|
|
|
|
* Maximum sizes of strings in message data. Don't forget to bump
|
|
|
|
* PROTOCOL_VERSION if any of these change!
|
|
|
|
*/
|
|
|
|
#define COMMAND_LENGTH 2048 /* packed argv size */
|
|
|
|
#define TERMINAL_LENGTH 128 /* length of TERM environment variable */
|
2009-08-08 23:52:43 +02:00
|
|
|
#define ENVIRON_LENGTH 1024 /* environment variable length */
|
2009-07-26 14:58:44 +02:00
|
|
|
|
2009-11-18 18:02:17 +01:00
|
|
|
/*
|
|
|
|
* UTF-8 data size. This must be big enough to hold combined characters as well
|
|
|
|
* as single.
|
|
|
|
*/
|
|
|
|
#define UTF8_SIZE 9
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Fatal errors. */
|
|
|
|
#define fatal(msg) log_fatal("%s: %s", __func__, msg);
|
|
|
|
#define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
|
|
|
|
|
|
|
|
/* Definition to shut gcc up about unused arguments. */
|
|
|
|
#define unused __attribute__ ((unused))
|
|
|
|
|
|
|
|
/* Attribute to make gcc check printf-like arguments. */
|
|
|
|
#define printflike1 __attribute__ ((format (printf, 1, 2)))
|
|
|
|
#define printflike2 __attribute__ ((format (printf, 2, 3)))
|
|
|
|
#define printflike3 __attribute__ ((format (printf, 3, 4)))
|
|
|
|
#define printflike4 __attribute__ ((format (printf, 4, 5)))
|
2009-06-03 18:54:26 +02:00
|
|
|
#define printflike5 __attribute__ ((format (printf, 5, 6)))
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Number of items in array. */
|
2009-06-26 00:08:15 +02:00
|
|
|
#ifndef nitems
|
2009-06-02 00:58:49 +02:00
|
|
|
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
2009-06-26 00:08:15 +02:00
|
|
|
#endif
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2012-08-14 10:51:53 +02:00
|
|
|
/* Default template for choose-buffer. */
|
|
|
|
#define CHOOSE_BUFFER_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"#{line}: #{buffer_size} bytes: \"#{buffer_sample}\""
|
2012-08-14 10:51:53 +02:00
|
|
|
|
|
|
|
/* Default template for choose-client. */
|
|
|
|
#define CHOOSE_CLIENT_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"#{client_tty}: #{session_name} " \
|
2012-05-27 23:43:57 +02:00
|
|
|
"[#{client_width}x#{client_height} #{client_termname}]" \
|
2012-11-05 14:13:04 +01:00
|
|
|
"#{?client_utf8, (utf8),}#{?client_readonly, (ro),} " \
|
|
|
|
"(last used #{client_activity_string})"
|
2012-08-14 10:51:53 +02:00
|
|
|
|
|
|
|
/* Default templates for choose-tree. */
|
|
|
|
#define CHOOSE_TREE_SESSION_TEMPLATE \
|
2013-03-22 11:38:13 +01:00
|
|
|
"#{session_name}: #{session_windows} windows" \
|
2012-08-14 10:51:53 +02:00
|
|
|
"#{?session_grouped, (group ,}" \
|
|
|
|
"#{session_group}#{?session_grouped,),}" \
|
|
|
|
"#{?session_attached, (attached),}"
|
|
|
|
#define CHOOSE_TREE_WINDOW_TEMPLATE \
|
|
|
|
"#{window_index}: #{window_name}#{window_flags} " \
|
|
|
|
"\"#{pane_title}\""
|
|
|
|
|
|
|
|
/* Default template for display-message. */
|
|
|
|
#define DISPLAY_MESSAGE_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"[#{session_name}] #{window_index}:" \
|
|
|
|
"#{window_name}, current pane #{pane_index} " \
|
|
|
|
"- (%H:%M %d-%b-%y)"
|
2012-08-14 10:51:53 +02:00
|
|
|
|
|
|
|
/* Default template for find-window. */
|
|
|
|
#define FIND_WINDOW_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"#{window_index}: #{window_name} " \
|
|
|
|
"[#{window_width}x#{window_height}] " \
|
|
|
|
"(#{window_panes} panes) #{window_find_matches}"
|
2012-08-14 10:51:53 +02:00
|
|
|
|
|
|
|
/* Default template for list-buffers. */
|
|
|
|
#define LIST_BUFFERS_TEMPLATE \
|
|
|
|
"#{line}: #{buffer_size} bytes: \"#{buffer_sample}\""
|
|
|
|
|
|
|
|
/* Default template for list-clients. */
|
|
|
|
#define LIST_CLIENTS_TEMPLATE \
|
|
|
|
"#{client_tty}: #{session_name} " \
|
|
|
|
"[#{client_width}x#{client_height} #{client_termname}]" \
|
|
|
|
"#{?client_utf8, (utf8),} #{?client_readonly, (ro),}"
|
|
|
|
|
|
|
|
/* Default template for list-sessions. */
|
|
|
|
#define LIST_SESSIONS_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"#{session_name}: #{session_windows} windows " \
|
|
|
|
"(created #{session_created_string}) " \
|
|
|
|
"[#{session_width}x#{session_height}]" \
|
|
|
|
"#{?session_grouped, (group ,}" \
|
|
|
|
"#{session_group}#{?session_grouped,),}" \
|
|
|
|
"#{?session_attached, (attached),}"
|
2012-08-14 10:51:53 +02:00
|
|
|
|
|
|
|
/* Default templates for list-windows. */
|
|
|
|
#define LIST_WINDOWS_TEMPLATE \
|
2012-05-22 13:35:37 +02:00
|
|
|
"#{window_index}: #{window_name}#{window_flags} " \
|
|
|
|
"(#{window_panes} panes) " \
|
2012-08-14 10:51:53 +02:00
|
|
|
"[#{window_width}x#{window_height}] " \
|
|
|
|
"[layout #{window_layout}] #{window_id}" \
|
|
|
|
"#{?window_active, (active),}";
|
|
|
|
#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
|
|
|
|
"#{session_name}: " \
|
|
|
|
"#{window_index}: #{window_name}#{window_flags} " \
|
|
|
|
"(#{window_panes} panes) " \
|
|
|
|
"[#{window_width}x#{window_height}] "
|
|
|
|
|
|
|
|
/* Default templates for break-pane, new-window and split-window. */
|
|
|
|
#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
|
2013-03-25 12:44:00 +01:00
|
|
|
#define NEW_SESSION_TEMPLATE "#{session_name}:"
|
2012-08-14 10:51:53 +02:00
|
|
|
#define NEW_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE
|
|
|
|
#define SPLIT_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE
|
2012-05-22 13:35:37 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Bell option values. */
|
|
|
|
#define BELL_NONE 0
|
|
|
|
#define BELL_ANY 1
|
|
|
|
#define BELL_CURRENT 2
|
|
|
|
|
2009-11-10 18:41:35 +01:00
|
|
|
/* Special key codes. */
|
2009-07-24 16:52:47 +02:00
|
|
|
#define KEYC_NONE 0xfff
|
2009-11-10 18:41:35 +01:00
|
|
|
#define KEYC_BASE 0x1000
|
|
|
|
|
|
|
|
/* Key modifier bits. */
|
2009-07-24 16:52:47 +02:00
|
|
|
#define KEYC_ESCAPE 0x2000
|
|
|
|
#define KEYC_CTRL 0x4000
|
|
|
|
#define KEYC_SHIFT 0x8000
|
|
|
|
#define KEYC_PREFIX 0x10000
|
2009-07-21 19:57:29 +02:00
|
|
|
|
2011-03-27 22:31:25 +02:00
|
|
|
/* Mask to obtain key w/o modifiers. */
|
2010-06-06 21:00:13 +02:00
|
|
|
#define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT|KEYC_PREFIX)
|
|
|
|
#define KEYC_MASK_KEY (~KEYC_MASK_MOD)
|
|
|
|
|
2009-11-10 18:41:35 +01:00
|
|
|
/* Other key codes. */
|
2009-07-21 19:57:29 +02:00
|
|
|
enum key_code {
|
|
|
|
/* Mouse key. */
|
2009-11-10 18:41:35 +01:00
|
|
|
KEYC_MOUSE = KEYC_BASE,
|
2009-07-21 19:57:29 +02:00
|
|
|
|
2009-07-26 23:42:08 +02:00
|
|
|
/* Backspace key. */
|
|
|
|
KEYC_BSPACE,
|
|
|
|
|
2009-07-21 19:57:29 +02:00
|
|
|
/* Function keys. */
|
|
|
|
KEYC_F1,
|
|
|
|
KEYC_F2,
|
|
|
|
KEYC_F3,
|
|
|
|
KEYC_F4,
|
|
|
|
KEYC_F5,
|
|
|
|
KEYC_F6,
|
|
|
|
KEYC_F7,
|
|
|
|
KEYC_F8,
|
|
|
|
KEYC_F9,
|
|
|
|
KEYC_F10,
|
|
|
|
KEYC_F11,
|
|
|
|
KEYC_F12,
|
|
|
|
KEYC_F13,
|
|
|
|
KEYC_F14,
|
|
|
|
KEYC_F15,
|
|
|
|
KEYC_F16,
|
|
|
|
KEYC_F17,
|
|
|
|
KEYC_F18,
|
|
|
|
KEYC_F19,
|
|
|
|
KEYC_F20,
|
|
|
|
KEYC_IC,
|
|
|
|
KEYC_DC,
|
|
|
|
KEYC_HOME,
|
|
|
|
KEYC_END,
|
|
|
|
KEYC_NPAGE,
|
|
|
|
KEYC_PPAGE,
|
|
|
|
KEYC_BTAB,
|
|
|
|
|
|
|
|
/* Arrow keys. */
|
|
|
|
KEYC_UP,
|
|
|
|
KEYC_DOWN,
|
|
|
|
KEYC_LEFT,
|
|
|
|
KEYC_RIGHT,
|
|
|
|
|
2009-10-26 14:13:33 +01:00
|
|
|
/* Numeric keypad. */
|
|
|
|
KEYC_KP_SLASH,
|
|
|
|
KEYC_KP_STAR,
|
|
|
|
KEYC_KP_MINUS,
|
|
|
|
KEYC_KP_SEVEN,
|
|
|
|
KEYC_KP_EIGHT,
|
|
|
|
KEYC_KP_NINE,
|
|
|
|
KEYC_KP_PLUS,
|
|
|
|
KEYC_KP_FOUR,
|
|
|
|
KEYC_KP_FIVE,
|
|
|
|
KEYC_KP_SIX,
|
|
|
|
KEYC_KP_ONE,
|
|
|
|
KEYC_KP_TWO,
|
|
|
|
KEYC_KP_THREE,
|
|
|
|
KEYC_KP_ENTER,
|
|
|
|
KEYC_KP_ZERO,
|
|
|
|
KEYC_KP_PERIOD,
|
2013-03-24 10:28:59 +01:00
|
|
|
|
|
|
|
KEYC_FOCUS_IN,
|
|
|
|
KEYC_FOCUS_OUT,
|
2009-07-21 19:57:29 +02:00
|
|
|
};
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Termcap codes. */
|
|
|
|
enum tty_code_code {
|
|
|
|
TTYC_AX = 0,
|
|
|
|
TTYC_ACSC, /* acs_chars, ac */
|
|
|
|
TTYC_BEL, /* bell, bl */
|
|
|
|
TTYC_BLINK, /* enter_blink_mode, mb */
|
|
|
|
TTYC_BOLD, /* enter_bold_mode, md */
|
2011-05-20 21:03:58 +02:00
|
|
|
TTYC_CC, /* set colour cursor, Cc */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_CIVIS, /* cursor_invisible, vi */
|
|
|
|
TTYC_CLEAR, /* clear_screen, cl */
|
|
|
|
TTYC_CNORM, /* cursor_normal, ve */
|
|
|
|
TTYC_COLORS, /* max_colors, Co */
|
2011-05-20 21:03:58 +02:00
|
|
|
TTYC_CR, /* restore cursor colour, Cr */
|
2011-05-20 21:17:39 +02:00
|
|
|
TTYC_CS1, /* set cursor style, Cs */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_CSR, /* change_scroll_region, cs */
|
2011-05-20 21:17:39 +02:00
|
|
|
TTYC_CSR1, /* reset cursor style, Csr */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_CUB, /* parm_left_cursor, LE */
|
|
|
|
TTYC_CUB1, /* cursor_left, le */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_CUD, /* parm_down_cursor, DO */
|
|
|
|
TTYC_CUD1, /* cursor_down, do */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_CUF, /* parm_right_cursor, RI */
|
|
|
|
TTYC_CUF1, /* cursor_right, nd */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_CUP, /* cursor_address, cm */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_CUU, /* parm_up_cursor, UP */
|
|
|
|
TTYC_CUU1, /* cursor_up, up */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_DCH, /* parm_dch, DC */
|
|
|
|
TTYC_DCH1, /* delete_character, dc */
|
|
|
|
TTYC_DIM, /* enter_dim_mode, mh */
|
|
|
|
TTYC_DL, /* parm_delete_line, DL */
|
|
|
|
TTYC_DL1, /* delete_line, dl */
|
2011-10-23 12:16:14 +02:00
|
|
|
TTYC_E3,
|
2013-01-16 00:18:55 +01:00
|
|
|
TTYC_ECH, /* erase_chars, ec */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_EL, /* clr_eol, ce */
|
|
|
|
TTYC_EL1, /* clr_bol, cb */
|
|
|
|
TTYC_ENACS, /* ena_acs, eA */
|
2011-05-08 21:53:06 +02:00
|
|
|
TTYC_FSL, /* from_status_line, fsl */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_HOME, /* cursor_home, ho */
|
|
|
|
TTYC_HPA, /* column_address, ch */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_ICH, /* parm_ich, IC */
|
|
|
|
TTYC_ICH1, /* insert_character, ic */
|
|
|
|
TTYC_IL, /* parm_insert_line, IL */
|
|
|
|
TTYC_IL1, /* insert_line, il */
|
|
|
|
TTYC_INVIS, /* enter_secure_mode, mk */
|
|
|
|
TTYC_IS1, /* init_1string, i1 */
|
|
|
|
TTYC_IS2, /* init_2string, i2 */
|
|
|
|
TTYC_IS3, /* init_3string, i3 */
|
|
|
|
TTYC_KCBT, /* key_btab, kB */
|
|
|
|
TTYC_KCUB1, /* key_left, kl */
|
|
|
|
TTYC_KCUD1, /* key_down, kd */
|
|
|
|
TTYC_KCUF1, /* key_right, kr */
|
|
|
|
TTYC_KCUU1, /* key_up, ku */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KDC2,
|
|
|
|
TTYC_KDC3,
|
|
|
|
TTYC_KDC4,
|
|
|
|
TTYC_KDC5,
|
|
|
|
TTYC_KDC6,
|
|
|
|
TTYC_KDC7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KDCH1, /* key_dc, kD */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KDN2,
|
|
|
|
TTYC_KDN3,
|
|
|
|
TTYC_KDN4,
|
|
|
|
TTYC_KDN5,
|
|
|
|
TTYC_KDN6,
|
|
|
|
TTYC_KDN7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KEND, /* key_end, ke */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KEND2,
|
|
|
|
TTYC_KEND3,
|
|
|
|
TTYC_KEND4,
|
|
|
|
TTYC_KEND5,
|
|
|
|
TTYC_KEND6,
|
|
|
|
TTYC_KEND7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KF1, /* key_f1, k1 */
|
|
|
|
TTYC_KF10, /* key_f10, k; */
|
|
|
|
TTYC_KF11, /* key_f11, F1 */
|
|
|
|
TTYC_KF12, /* key_f12, F2 */
|
|
|
|
TTYC_KF13, /* key_f13, F3 */
|
|
|
|
TTYC_KF14, /* key_f14, F4 */
|
|
|
|
TTYC_KF15, /* key_f15, F5 */
|
|
|
|
TTYC_KF16, /* key_f16, F6 */
|
|
|
|
TTYC_KF17, /* key_f17, F7 */
|
|
|
|
TTYC_KF18, /* key_f18, F8 */
|
|
|
|
TTYC_KF19, /* key_f19, F9 */
|
|
|
|
TTYC_KF2, /* key_f2, k2 */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_KF20, /* key_f20, F10 */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KF3, /* key_f3, k3 */
|
|
|
|
TTYC_KF4, /* key_f4, k4 */
|
|
|
|
TTYC_KF5, /* key_f5, k5 */
|
|
|
|
TTYC_KF6, /* key_f6, k6 */
|
|
|
|
TTYC_KF7, /* key_f7, k7 */
|
|
|
|
TTYC_KF8, /* key_f8, k8 */
|
|
|
|
TTYC_KF9, /* key_f9, k9 */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KHOM2,
|
|
|
|
TTYC_KHOM3,
|
|
|
|
TTYC_KHOM4,
|
|
|
|
TTYC_KHOM5,
|
|
|
|
TTYC_KHOM6,
|
|
|
|
TTYC_KHOM7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KHOME, /* key_home, kh */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KIC2,
|
|
|
|
TTYC_KIC3,
|
|
|
|
TTYC_KIC4,
|
|
|
|
TTYC_KIC5,
|
|
|
|
TTYC_KIC6,
|
|
|
|
TTYC_KIC7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KICH1, /* key_ic, kI */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KLFT2,
|
|
|
|
TTYC_KLFT3,
|
|
|
|
TTYC_KLFT4,
|
|
|
|
TTYC_KLFT5,
|
|
|
|
TTYC_KLFT6,
|
|
|
|
TTYC_KLFT7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KMOUS, /* key_mouse, Km */
|
|
|
|
TTYC_KNP, /* key_npage, kN */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KNXT2,
|
|
|
|
TTYC_KNXT3,
|
|
|
|
TTYC_KNXT4,
|
|
|
|
TTYC_KNXT5,
|
|
|
|
TTYC_KNXT6,
|
|
|
|
TTYC_KNXT7,
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_KPP, /* key_ppage, kP */
|
2009-10-26 17:00:51 +01:00
|
|
|
TTYC_KPRV2,
|
|
|
|
TTYC_KPRV3,
|
|
|
|
TTYC_KPRV4,
|
|
|
|
TTYC_KPRV5,
|
|
|
|
TTYC_KPRV6,
|
|
|
|
TTYC_KPRV7,
|
|
|
|
TTYC_KRIT2,
|
|
|
|
TTYC_KRIT3,
|
|
|
|
TTYC_KRIT4,
|
|
|
|
TTYC_KRIT5,
|
|
|
|
TTYC_KRIT6,
|
|
|
|
TTYC_KRIT7,
|
|
|
|
TTYC_KUP2,
|
|
|
|
TTYC_KUP3,
|
|
|
|
TTYC_KUP4,
|
|
|
|
TTYC_KUP5,
|
|
|
|
TTYC_KUP6,
|
|
|
|
TTYC_KUP7,
|
2011-05-18 22:24:29 +02:00
|
|
|
TTYC_MS, /* modify xterm(1) selection */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_OP, /* orig_pair, op */
|
|
|
|
TTYC_REV, /* enter_reverse_mode, mr */
|
|
|
|
TTYC_RI, /* scroll_reverse, sr */
|
|
|
|
TTYC_RMACS, /* exit_alt_charset_mode */
|
|
|
|
TTYC_RMCUP, /* exit_ca_mode, te */
|
|
|
|
TTYC_RMKX, /* keypad_local, ke */
|
|
|
|
TTYC_SETAB, /* set_a_background, AB */
|
|
|
|
TTYC_SETAF, /* set_a_foreground, AF */
|
|
|
|
TTYC_SGR0, /* exit_attribute_mode, me */
|
2011-05-08 21:53:06 +02:00
|
|
|
TTYC_SITM, /* enter_italics_mode, it */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_SMACS, /* enter_alt_charset_mode, as */
|
|
|
|
TTYC_SMCUP, /* enter_ca_mode, ti */
|
|
|
|
TTYC_SMKX, /* keypad_xmit, ks */
|
|
|
|
TTYC_SMSO, /* enter_standout_mode, so */
|
|
|
|
TTYC_SMUL, /* enter_underline_mode, us */
|
2011-05-08 21:53:06 +02:00
|
|
|
TTYC_TSL, /* to_status_line, tsl */
|
2009-10-12 15:01:18 +02:00
|
|
|
TTYC_VPA, /* row_address, cv */
|
2009-06-02 00:58:49 +02:00
|
|
|
TTYC_XENL, /* eat_newline_glitch, xn */
|
2011-05-08 21:53:06 +02:00
|
|
|
TTYC_XT, /* xterm(1)-compatible title, XT */
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
2011-05-08 21:53:06 +02:00
|
|
|
#define NTTYCODE (TTYC_XT + 1)
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Termcap types. */
|
|
|
|
enum tty_code_type {
|
|
|
|
TTYCODE_NONE = 0,
|
|
|
|
TTYCODE_STRING,
|
|
|
|
TTYCODE_NUMBER,
|
|
|
|
TTYCODE_FLAG,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Termcap code. */
|
|
|
|
struct tty_code {
|
|
|
|
enum tty_code_type type;
|
|
|
|
union {
|
2009-12-03 23:50:09 +01:00
|
|
|
char *string;
|
|
|
|
int number;
|
|
|
|
int flag;
|
2009-06-02 00:58:49 +02:00
|
|
|
} value;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Entry in terminal code table. */
|
|
|
|
struct tty_term_code_entry {
|
|
|
|
enum tty_code_code code;
|
|
|
|
enum tty_code_type type;
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
/* List of error causes. */
|
|
|
|
ARRAY_DECL(causelist, char *);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Message codes. */
|
2009-07-29 16:17:26 +02:00
|
|
|
enum msgtype {
|
2009-06-02 00:58:49 +02:00
|
|
|
MSG_COMMAND,
|
|
|
|
MSG_DETACH,
|
|
|
|
MSG_ERROR,
|
|
|
|
MSG_EXIT,
|
|
|
|
MSG_EXITED,
|
|
|
|
MSG_EXITING,
|
|
|
|
MSG_IDENTIFY,
|
2012-05-21 20:27:42 +02:00
|
|
|
MSG_STDIN,
|
2009-06-02 00:58:49 +02:00
|
|
|
MSG_READY,
|
|
|
|
MSG_RESIZE,
|
|
|
|
MSG_SHUTDOWN,
|
|
|
|
MSG_SUSPEND,
|
2009-08-11 19:18:35 +02:00
|
|
|
MSG_VERSION,
|
2009-06-02 00:58:49 +02:00
|
|
|
MSG_WAKEUP,
|
2009-09-23 08:18:47 +02:00
|
|
|
MSG_ENVIRON,
|
|
|
|
MSG_UNLOCK,
|
2009-09-23 14:03:30 +02:00
|
|
|
MSG_LOCK,
|
2010-06-29 00:10:42 +02:00
|
|
|
MSG_SHELL,
|
|
|
|
MSG_STDERR,
|
|
|
|
MSG_STDOUT,
|
2011-03-03 09:51:47 +01:00
|
|
|
MSG_DETACHKILL
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
2009-07-26 14:58:44 +02:00
|
|
|
/*
|
2009-08-11 19:18:35 +02:00
|
|
|
* Message data.
|
2009-07-26 14:58:44 +02:00
|
|
|
*
|
|
|
|
* Don't forget to bump PROTOCOL_VERSION if any of these change!
|
|
|
|
*/
|
2009-06-02 00:58:49 +02:00
|
|
|
struct msg_command_data {
|
2013-03-25 11:11:45 +01:00
|
|
|
pid_t pid; /* from $TMUX or -1 */
|
|
|
|
int session_id; /* from $TMUX or -1 */
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-07-26 14:58:44 +02:00
|
|
|
int argc;
|
|
|
|
char argv[COMMAND_LENGTH];
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct msg_identify_data {
|
|
|
|
char cwd[MAXPATHLEN];
|
|
|
|
|
2009-07-26 14:58:44 +02:00
|
|
|
char term[TERMINAL_LENGTH];
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
#define IDENTIFY_UTF8 0x1
|
|
|
|
#define IDENTIFY_256COLOURS 0x2
|
2013-03-27 12:17:12 +01:00
|
|
|
/* 0x4 unused */
|
2012-06-18 15:16:42 +02:00
|
|
|
#define IDENTIFY_CONTROL 0x8
|
|
|
|
#define IDENTIFY_TERMIOS 0x10
|
2009-06-02 00:58:49 +02:00
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2009-09-23 08:18:47 +02:00
|
|
|
struct msg_lock_data {
|
2009-12-03 23:50:09 +01:00
|
|
|
char cmd[COMMAND_LENGTH];
|
2009-07-26 14:58:44 +02:00
|
|
|
};
|
|
|
|
|
2009-08-08 23:52:43 +02:00
|
|
|
struct msg_environ_data {
|
2009-12-03 23:50:09 +01:00
|
|
|
char var[ENVIRON_LENGTH];
|
2009-08-08 23:52:43 +02:00
|
|
|
};
|
|
|
|
|
2009-09-23 14:03:30 +02:00
|
|
|
struct msg_shell_data {
|
2009-12-03 23:50:09 +01:00
|
|
|
char shell[MAXPATHLEN];
|
2009-09-23 14:03:30 +02:00
|
|
|
};
|
|
|
|
|
2010-07-11 19:06:45 +02:00
|
|
|
struct msg_exit_data {
|
|
|
|
int retcode;
|
|
|
|
};
|
|
|
|
|
2012-05-21 20:27:42 +02:00
|
|
|
struct msg_stdin_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct msg_stdout_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct msg_stderr_data {
|
|
|
|
ssize_t size;
|
|
|
|
char data[BUFSIZ];
|
|
|
|
};
|
|
|
|
|
2009-07-28 09:03:32 +02:00
|
|
|
/* Mode key commands. */
|
2009-06-02 00:58:49 +02:00
|
|
|
enum mode_key_cmd {
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEY_NONE,
|
|
|
|
MODEKEY_OTHER,
|
|
|
|
|
|
|
|
/* Editing keys. */
|
|
|
|
MODEKEYEDIT_BACKSPACE,
|
|
|
|
MODEKEYEDIT_CANCEL,
|
|
|
|
MODEKEYEDIT_COMPLETE,
|
|
|
|
MODEKEYEDIT_CURSORLEFT,
|
|
|
|
MODEKEYEDIT_CURSORRIGHT,
|
|
|
|
MODEKEYEDIT_DELETE,
|
2009-08-18 09:23:43 +02:00
|
|
|
MODEKEYEDIT_DELETELINE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYEDIT_DELETETOENDOFLINE,
|
2011-11-16 00:34:12 +01:00
|
|
|
MODEKEYEDIT_DELETEWORD,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYEDIT_ENDOFLINE,
|
|
|
|
MODEKEYEDIT_ENTER,
|
|
|
|
MODEKEYEDIT_HISTORYDOWN,
|
|
|
|
MODEKEYEDIT_HISTORYUP,
|
2012-01-20 20:10:29 +01:00
|
|
|
MODEKEYEDIT_NEXTSPACE,
|
|
|
|
MODEKEYEDIT_NEXTSPACEEND,
|
2011-11-16 00:34:12 +01:00
|
|
|
MODEKEYEDIT_NEXTWORD,
|
|
|
|
MODEKEYEDIT_NEXTWORDEND,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYEDIT_PASTE,
|
2012-01-20 20:10:29 +01:00
|
|
|
MODEKEYEDIT_PREVIOUSSPACE,
|
2011-11-16 00:34:12 +01:00
|
|
|
MODEKEYEDIT_PREVIOUSWORD,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYEDIT_STARTOFLINE,
|
|
|
|
MODEKEYEDIT_SWITCHMODE,
|
|
|
|
MODEKEYEDIT_SWITCHMODEAPPEND,
|
2012-03-04 08:38:11 +01:00
|
|
|
MODEKEYEDIT_SWITCHMODEAPPENDLINE,
|
|
|
|
MODEKEYEDIT_SWITCHMODEBEGINLINE,
|
2009-09-02 08:33:20 +02:00
|
|
|
MODEKEYEDIT_TRANSPOSECHARS,
|
2009-12-03 23:50:09 +01:00
|
|
|
|
2009-07-27 21:29:35 +02:00
|
|
|
/* Menu (choice) keys. */
|
2012-08-11 08:45:33 +02:00
|
|
|
MODEKEYCHOICE_BACKSPACE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCHOICE_CANCEL,
|
|
|
|
MODEKEYCHOICE_CHOOSE,
|
|
|
|
MODEKEYCHOICE_DOWN,
|
|
|
|
MODEKEYCHOICE_PAGEDOWN,
|
|
|
|
MODEKEYCHOICE_PAGEUP,
|
2010-02-01 23:15:51 +01:00
|
|
|
MODEKEYCHOICE_SCROLLDOWN,
|
|
|
|
MODEKEYCHOICE_SCROLLUP,
|
2012-08-11 08:45:33 +02:00
|
|
|
MODEKEYCHOICE_STARTNUMBERPREFIX,
|
2012-10-02 10:16:28 +02:00
|
|
|
MODEKEYCHOICE_TREE_COLLAPSE,
|
|
|
|
MODEKEYCHOICE_TREE_COLLAPSE_ALL,
|
|
|
|
MODEKEYCHOICE_TREE_EXPAND,
|
|
|
|
MODEKEYCHOICE_TREE_EXPAND_ALL,
|
|
|
|
MODEKEYCHOICE_TREE_TOGGLE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCHOICE_UP,
|
|
|
|
|
|
|
|
/* Copy keys. */
|
|
|
|
MODEKEYCOPY_BACKTOINDENTATION,
|
2009-10-13 15:45:56 +02:00
|
|
|
MODEKEYCOPY_BOTTOMLINE,
|
2009-08-14 00:32:18 +02:00
|
|
|
MODEKEYCOPY_CANCEL,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_CLEARSELECTION,
|
2013-03-22 17:00:26 +01:00
|
|
|
MODEKEYCOPY_COPYPIPE,
|
2011-05-18 20:06:36 +02:00
|
|
|
MODEKEYCOPY_COPYLINE,
|
|
|
|
MODEKEYCOPY_COPYENDOFLINE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_COPYSELECTION,
|
|
|
|
MODEKEYCOPY_DOWN,
|
|
|
|
MODEKEYCOPY_ENDOFLINE,
|
2009-08-18 09:08:26 +02:00
|
|
|
MODEKEYCOPY_GOTOLINE,
|
2009-08-14 00:32:18 +02:00
|
|
|
MODEKEYCOPY_HALFPAGEDOWN,
|
|
|
|
MODEKEYCOPY_HALFPAGEUP,
|
2010-01-25 22:33:39 +01:00
|
|
|
MODEKEYCOPY_HISTORYBOTTOM,
|
|
|
|
MODEKEYCOPY_HISTORYTOP,
|
2010-03-22 20:10:42 +01:00
|
|
|
MODEKEYCOPY_JUMP,
|
|
|
|
MODEKEYCOPY_JUMPAGAIN,
|
|
|
|
MODEKEYCOPY_JUMPREVERSE,
|
|
|
|
MODEKEYCOPY_JUMPBACK,
|
2011-12-04 17:18:01 +01:00
|
|
|
MODEKEYCOPY_JUMPTO,
|
|
|
|
MODEKEYCOPY_JUMPTOBACK,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_LEFT,
|
2009-10-13 15:45:56 +02:00
|
|
|
MODEKEYCOPY_MIDDLELINE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_NEXTPAGE,
|
2010-02-04 21:00:26 +01:00
|
|
|
MODEKEYCOPY_NEXTSPACE,
|
|
|
|
MODEKEYCOPY_NEXTSPACEEND,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_NEXTWORD,
|
2010-01-27 21:18:52 +01:00
|
|
|
MODEKEYCOPY_NEXTWORDEND,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_PREVIOUSPAGE,
|
2010-02-04 21:00:26 +01:00
|
|
|
MODEKEYCOPY_PREVIOUSSPACE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_PREVIOUSWORD,
|
2010-02-06 18:35:01 +01:00
|
|
|
MODEKEYCOPY_RECTANGLETOGGLE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_RIGHT,
|
2009-10-06 09:09:00 +02:00
|
|
|
MODEKEYCOPY_SCROLLDOWN,
|
|
|
|
MODEKEYCOPY_SCROLLUP,
|
2009-08-18 09:08:26 +02:00
|
|
|
MODEKEYCOPY_SEARCHAGAIN,
|
|
|
|
MODEKEYCOPY_SEARCHDOWN,
|
2010-02-11 21:39:40 +01:00
|
|
|
MODEKEYCOPY_SEARCHREVERSE,
|
2009-08-18 09:08:26 +02:00
|
|
|
MODEKEYCOPY_SEARCHUP,
|
2011-05-18 20:06:36 +02:00
|
|
|
MODEKEYCOPY_SELECTLINE,
|
2010-03-02 01:32:41 +01:00
|
|
|
MODEKEYCOPY_STARTNUMBERPREFIX,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_STARTOFLINE,
|
|
|
|
MODEKEYCOPY_STARTSELECTION,
|
2009-10-13 15:45:56 +02:00
|
|
|
MODEKEYCOPY_TOPLINE,
|
2009-07-27 21:29:35 +02:00
|
|
|
MODEKEYCOPY_UP,
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
2009-07-28 09:03:32 +02:00
|
|
|
/* Entry in the default mode key tables. */
|
2009-07-27 21:29:35 +02:00
|
|
|
struct mode_key_entry {
|
|
|
|
int key;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-07-27 21:29:35 +02:00
|
|
|
/*
|
|
|
|
* Editing mode for vi: 0 is edit mode, keys not in the table are
|
|
|
|
* returned as MODEKEY_OTHER; 1 is command mode, keys not in the table
|
|
|
|
* are returned as MODEKEY_NONE. This is also matched on, allowing some
|
|
|
|
* keys to be bound in edit mode.
|
|
|
|
*/
|
|
|
|
int mode;
|
|
|
|
enum mode_key_cmd cmd;
|
|
|
|
};
|
2009-07-28 09:03:32 +02:00
|
|
|
|
|
|
|
/* Data required while mode keys are in use. */
|
2009-07-27 21:29:35 +02:00
|
|
|
struct mode_key_data {
|
2009-07-28 09:03:32 +02:00
|
|
|
struct mode_key_tree *tree;
|
|
|
|
int mode;
|
2009-07-27 21:29:35 +02:00
|
|
|
};
|
2009-06-02 00:58:49 +02:00
|
|
|
#define MODEKEY_EMACS 0
|
|
|
|
#define MODEKEY_VI 1
|
|
|
|
|
2009-07-28 09:03:32 +02:00
|
|
|
/* Binding between a key and a command. */
|
|
|
|
struct mode_key_binding {
|
2013-03-22 17:00:26 +01:00
|
|
|
int key;
|
2009-07-28 09:03:32 +02:00
|
|
|
|
2013-03-22 17:00:26 +01:00
|
|
|
int mode;
|
|
|
|
enum mode_key_cmd cmd;
|
|
|
|
const char *arg;
|
2009-07-28 09:03:32 +02:00
|
|
|
|
2013-03-22 17:00:26 +01:00
|
|
|
RB_ENTRY(mode_key_binding) entry;
|
2009-07-28 09:03:32 +02:00
|
|
|
};
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_HEAD(mode_key_tree, mode_key_binding);
|
2009-07-28 09:03:32 +02:00
|
|
|
|
|
|
|
/* Command to string mapping. */
|
|
|
|
struct mode_key_cmdstr {
|
2009-12-03 23:50:09 +01:00
|
|
|
enum mode_key_cmd cmd;
|
2009-07-28 09:03:32 +02:00
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Named mode key table description. */
|
|
|
|
struct mode_key_table {
|
2011-01-01 04:39:21 +01:00
|
|
|
const char *name;
|
|
|
|
const struct mode_key_cmdstr *cmdstr;
|
|
|
|
struct mode_key_tree *tree;
|
|
|
|
const struct mode_key_entry *table; /* default entries */
|
2009-07-28 09:03:32 +02:00
|
|
|
};
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Modes. */
|
|
|
|
#define MODE_CURSOR 0x1
|
|
|
|
#define MODE_INSERT 0x2
|
|
|
|
#define MODE_KCURSOR 0x4
|
2009-11-25 13:24:31 +01:00
|
|
|
#define MODE_KKEYPAD 0x8 /* set = application, clear = number */
|
2010-12-29 22:49:06 +01:00
|
|
|
#define MODE_WRAP 0x10 /* whether lines wrap */
|
|
|
|
#define MODE_MOUSE_STANDARD 0x20
|
2011-01-15 01:16:00 +01:00
|
|
|
#define MODE_MOUSE_BUTTON 0x40
|
|
|
|
#define MODE_MOUSE_ANY 0x80
|
|
|
|
#define MODE_MOUSE_UTF8 0x100
|
2013-03-22 11:33:50 +01:00
|
|
|
#define MODE_MOUSE_SGR 0x200
|
|
|
|
#define MODE_BRACKETPASTE 0x400
|
2013-03-24 10:28:59 +01:00
|
|
|
#define MODE_FOCUSON 0x800
|
2010-12-29 22:49:06 +01:00
|
|
|
|
2011-01-15 01:16:00 +01:00
|
|
|
#define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ANY)
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2013-01-18 03:16:21 +01:00
|
|
|
/* A single UTF-8 character. */
|
2009-10-20 21:18:28 +02:00
|
|
|
struct utf8_data {
|
|
|
|
u_char data[UTF8_SIZE];
|
|
|
|
|
|
|
|
size_t have;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
u_int width;
|
|
|
|
};
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Grid output. */
|
|
|
|
#if defined(DEBUG) && \
|
|
|
|
((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
|
|
|
(defined(__GNUC__) && __GNUC__ >= 3))
|
2009-07-22 20:06:58 +02:00
|
|
|
#define GRID_DEBUG(gd, fmt, ...) log_debug2("%s: (sx=%u, sy=%u, hsize=%u) " \
|
2009-06-02 00:58:49 +02:00
|
|
|
fmt, __func__, (gd)->sx, (gd)->sy, (gd)->hsize, ## __VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define GRID_DEBUG(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Grid attributes. */
|
|
|
|
#define GRID_ATTR_BRIGHT 0x1
|
|
|
|
#define GRID_ATTR_DIM 0x2
|
|
|
|
#define GRID_ATTR_UNDERSCORE 0x4
|
|
|
|
#define GRID_ATTR_BLINK 0x8
|
|
|
|
#define GRID_ATTR_REVERSE 0x10
|
|
|
|
#define GRID_ATTR_HIDDEN 0x20
|
|
|
|
#define GRID_ATTR_ITALICS 0x40
|
|
|
|
#define GRID_ATTR_CHARSET 0x80 /* alternative character set */
|
|
|
|
|
|
|
|
/* Grid flags. */
|
|
|
|
#define GRID_FLAG_FG256 0x1
|
|
|
|
#define GRID_FLAG_BG256 0x2
|
|
|
|
#define GRID_FLAG_PADDING 0x4
|
|
|
|
|
2009-08-08 17:57:49 +02:00
|
|
|
/* Grid line flags. */
|
|
|
|
#define GRID_LINE_WRAPPED 0x1
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Grid cell data. */
|
|
|
|
struct grid_cell {
|
|
|
|
u_char attr;
|
|
|
|
u_char flags;
|
|
|
|
u_char fg;
|
|
|
|
u_char bg;
|
|
|
|
|
2013-01-18 03:16:21 +01:00
|
|
|
u_char xstate; /* top 4 bits width, bottom 4 bits size */
|
|
|
|
u_char xdata[UTF8_SIZE];
|
2009-06-02 00:58:49 +02:00
|
|
|
} __packed;
|
|
|
|
|
2009-08-08 15:29:27 +02:00
|
|
|
/* Grid line. */
|
|
|
|
struct grid_line {
|
|
|
|
u_int cellsize;
|
|
|
|
struct grid_cell *celldata;
|
|
|
|
|
2009-08-08 17:57:49 +02:00
|
|
|
int flags;
|
2009-08-08 15:29:27 +02:00
|
|
|
} __packed;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Entire grid of cells. */
|
|
|
|
struct grid {
|
2009-07-13 12:43:52 +02:00
|
|
|
int flags;
|
|
|
|
#define GRID_HISTORY 0x1 /* scroll lines into history */
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int hsize;
|
|
|
|
u_int hlimit;
|
|
|
|
|
2009-08-08 15:29:27 +02:00
|
|
|
struct grid_line *linedata;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Option data structures. */
|
|
|
|
struct options_entry {
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
OPTIONS_STRING,
|
|
|
|
OPTIONS_NUMBER,
|
2009-09-22 14:38:10 +02:00
|
|
|
OPTIONS_DATA,
|
2009-06-02 00:58:49 +02:00
|
|
|
} type;
|
2009-09-21 09:00:09 +02:00
|
|
|
|
|
|
|
char *str;
|
|
|
|
long long num;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_ENTRY(options_entry) entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct options {
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_HEAD(options_tree, options_entry) tree;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct options *parent;
|
|
|
|
};
|
|
|
|
|
2009-10-10 17:03:01 +02:00
|
|
|
/* Scheduled job. */
|
|
|
|
struct job {
|
|
|
|
char *cmd;
|
|
|
|
pid_t pid;
|
2009-10-11 09:20:16 +02:00
|
|
|
int status;
|
2009-10-10 17:03:01 +02:00
|
|
|
|
|
|
|
int fd;
|
2009-11-04 22:04:43 +01:00
|
|
|
struct bufferevent *event;
|
2009-10-10 17:03:01 +02:00
|
|
|
|
|
|
|
void (*callbackfn)(struct job *);
|
|
|
|
void (*freefn)(void *);
|
|
|
|
void *data;
|
|
|
|
|
2011-01-26 01:11:47 +01:00
|
|
|
LIST_ENTRY(job) lentry;
|
2009-10-10 17:03:01 +02:00
|
|
|
};
|
2011-01-26 01:11:47 +01:00
|
|
|
LIST_HEAD(joblist, job);
|
2009-10-10 17:03:01 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Screen selection. */
|
|
|
|
struct screen_sel {
|
|
|
|
int flag;
|
2010-02-06 18:35:01 +01:00
|
|
|
int rectflag;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int ex;
|
|
|
|
u_int ey;
|
|
|
|
|
|
|
|
struct grid_cell cell;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Virtual screen. */
|
|
|
|
struct screen {
|
|
|
|
char *title;
|
|
|
|
|
2009-12-03 23:50:09 +01:00
|
|
|
struct grid *grid; /* grid data */
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int cx; /* cursor x */
|
|
|
|
u_int cy; /* cursor y */
|
|
|
|
|
2011-05-20 21:17:39 +02:00
|
|
|
u_int cstyle; /* cursor style */
|
2011-05-20 21:03:58 +02:00
|
|
|
char *ccolour; /* cursor colour string */
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
u_int rupper; /* scroll region top */
|
|
|
|
u_int rlower; /* scroll region bottom */
|
|
|
|
|
|
|
|
int mode;
|
|
|
|
|
2009-12-03 23:50:09 +01:00
|
|
|
bitstr_t *tabs;
|
2009-06-04 20:48:24 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct screen_sel sel;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Screen write context. */
|
|
|
|
struct screen_write_ctx {
|
|
|
|
struct window_pane *wp;
|
|
|
|
struct screen *s;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Screen size. */
|
|
|
|
#define screen_size_x(s) ((s)->grid->sx)
|
|
|
|
#define screen_size_y(s) ((s)->grid->sy)
|
|
|
|
#define screen_hsize(s) ((s)->grid->hsize)
|
|
|
|
#define screen_hlimit(s) ((s)->grid->hlimit)
|
|
|
|
|
|
|
|
/* Input parser context. */
|
|
|
|
struct input_ctx {
|
2010-03-22 20:02:54 +01:00
|
|
|
struct window_pane *wp;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct screen_write_ctx ctx;
|
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
struct grid_cell cell;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
struct grid_cell old_cell;
|
|
|
|
u_int old_cx;
|
|
|
|
u_int old_cy;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
u_char interm_buf[4];
|
|
|
|
size_t interm_len;
|
|
|
|
|
|
|
|
u_char param_buf[64];
|
|
|
|
size_t param_len;
|
|
|
|
|
|
|
|
u_char input_buf[256];
|
|
|
|
size_t input_len;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
int param_list[24]; /* -1 not present */
|
|
|
|
u_int param_list_len;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
struct utf8_data utf8data;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
int ch;
|
|
|
|
int flags;
|
|
|
|
#define INPUT_DISCARD 0x1
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-03-22 20:02:54 +01:00
|
|
|
const struct input_state *state;
|
2012-04-25 23:12:49 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All input received since we were last in the ground state. Sent to
|
|
|
|
* control clients on connection.
|
|
|
|
*/
|
|
|
|
struct evbuffer *since_ground;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Window mode. Windows can be in several modes and this is used to call the
|
|
|
|
* right function to handle input and output.
|
|
|
|
*/
|
2010-05-23 21:42:19 +02:00
|
|
|
struct session;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window;
|
2009-10-11 09:01:10 +02:00
|
|
|
struct mouse_event;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window_mode {
|
|
|
|
struct screen *(*init)(struct window_pane *);
|
|
|
|
void (*free)(struct window_pane *);
|
|
|
|
void (*resize)(struct window_pane *, u_int, u_int);
|
2010-05-23 21:42:19 +02:00
|
|
|
void (*key)(struct window_pane *, struct session *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void (*mouse)(struct window_pane *,
|
2010-05-23 21:42:19 +02:00
|
|
|
struct session *, struct mouse_event *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void (*timer)(struct window_pane *);
|
|
|
|
};
|
|
|
|
|
2012-06-25 16:08:55 +02:00
|
|
|
/* Structures for choose mode. */
|
|
|
|
struct window_choose_data {
|
2013-03-21 17:09:59 +01:00
|
|
|
struct client *start_client;
|
|
|
|
struct session *start_session;
|
|
|
|
|
2012-06-25 16:08:55 +02:00
|
|
|
u_int idx;
|
2012-10-02 10:16:28 +02:00
|
|
|
int type;
|
2013-03-21 17:09:59 +01:00
|
|
|
#define TREE_OTHER 0x0
|
2012-10-02 10:16:28 +02:00
|
|
|
#define TREE_WINDOW 0x1
|
|
|
|
#define TREE_SESSION 0x2
|
2013-03-21 17:09:59 +01:00
|
|
|
|
|
|
|
struct session *tree_session; /* session of items in tree */
|
|
|
|
|
|
|
|
struct winlink *wl;
|
2012-09-03 14:20:17 +02:00
|
|
|
int pane_id;
|
2013-03-21 17:09:59 +01:00
|
|
|
|
|
|
|
char *ft_template;
|
|
|
|
struct format_tree *ft;
|
|
|
|
|
|
|
|
char *command;
|
2012-06-25 16:08:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct window_choose_mode_item {
|
2012-08-11 08:45:33 +02:00
|
|
|
struct window_choose_data *wcd;
|
|
|
|
char *name;
|
|
|
|
int pos;
|
2012-10-02 10:16:28 +02:00
|
|
|
int state;
|
|
|
|
#define TREE_EXPANDED 0x1
|
2012-06-25 16:08:55 +02:00
|
|
|
};
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Child window structure. */
|
|
|
|
struct window_pane {
|
2011-03-27 22:27:26 +02:00
|
|
|
u_int id;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window *window;
|
2013-03-24 10:58:40 +01:00
|
|
|
|
2009-07-19 15:21:40 +02:00
|
|
|
struct layout_cell *layout_cell;
|
2013-03-24 10:58:40 +01:00
|
|
|
struct layout_cell *saved_layout_cell;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
|
|
|
int flags;
|
2009-07-14 09:23:36 +02:00
|
|
|
#define PANE_REDRAW 0x1
|
2012-03-20 12:01:00 +01:00
|
|
|
#define PANE_DROP 0x2
|
2013-03-24 10:28:59 +01:00
|
|
|
#define PANE_FOCUSED 0x4
|
|
|
|
#define PANE_RESIZE 0x8
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
char *cmd;
|
2009-09-01 15:09:49 +02:00
|
|
|
char *shell;
|
2009-06-02 00:58:49 +02:00
|
|
|
char *cwd;
|
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
char tty[TTY_NAME_MAX];
|
2009-11-04 21:50:11 +01:00
|
|
|
|
2012-03-20 12:01:00 +01:00
|
|
|
u_int changes;
|
|
|
|
struct event changes_timer;
|
|
|
|
u_int changes_redraw;
|
|
|
|
|
2009-11-04 21:50:11 +01:00
|
|
|
int fd;
|
2009-11-04 23:43:11 +01:00
|
|
|
struct bufferevent *event;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
struct input_ctx ictx;
|
|
|
|
|
2009-10-11 12:04:27 +02:00
|
|
|
int pipe_fd;
|
2009-11-04 23:02:38 +01:00
|
|
|
struct bufferevent *pipe_event;
|
2009-10-11 12:04:27 +02:00
|
|
|
size_t pipe_off;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct screen *screen;
|
|
|
|
struct screen base;
|
|
|
|
|
2009-07-13 12:43:52 +02:00
|
|
|
/* Saved in alternative screen mode. */
|
2009-12-03 23:50:09 +01:00
|
|
|
u_int saved_cx;
|
|
|
|
u_int saved_cy;
|
2009-07-13 12:43:52 +02:00
|
|
|
struct grid *saved_grid;
|
2009-08-07 02:12:13 +02:00
|
|
|
struct grid_cell saved_cell;
|
2009-07-13 12:43:52 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
const struct window_mode *mode;
|
|
|
|
void *modedata;
|
|
|
|
|
|
|
|
TAILQ_ENTRY(window_pane) entry;
|
2011-03-27 22:27:26 +02:00
|
|
|
RB_ENTRY(window_pane) tree_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
TAILQ_HEAD(window_panes, window_pane);
|
2011-03-27 22:27:26 +02:00
|
|
|
RB_HEAD(window_pane_tree, window_pane);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* Window structure. */
|
|
|
|
struct window {
|
2012-01-30 10:39:34 +01:00
|
|
|
u_int id;
|
2009-06-02 00:58:49 +02:00
|
|
|
char *name;
|
2009-11-05 00:54:57 +01:00
|
|
|
struct event name_timer;
|
2010-12-06 23:51:02 +01:00
|
|
|
struct timeval silence_timer;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
struct window_pane *active;
|
2010-10-23 15:04:34 +02:00
|
|
|
struct window_pane *last;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window_panes panes;
|
2009-07-19 15:21:40 +02:00
|
|
|
|
2009-07-28 08:48:44 +02:00
|
|
|
int lastlayout;
|
2009-07-19 15:21:40 +02:00
|
|
|
struct layout_cell *layout_root;
|
2013-03-24 10:58:40 +01:00
|
|
|
struct layout_cell *saved_layout_root;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define WINDOW_BELL 0x1
|
2010-11-22 22:13:13 +01:00
|
|
|
#define WINDOW_ACTIVITY 0x2
|
|
|
|
#define WINDOW_REDRAW 0x4
|
2010-12-06 23:51:02 +01:00
|
|
|
#define WINDOW_SILENCE 0x8
|
2013-03-24 10:58:40 +01:00
|
|
|
#define WINDOW_ZOOMED 0x10
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
struct options options;
|
|
|
|
|
|
|
|
u_int references;
|
|
|
|
};
|
|
|
|
ARRAY_DECL(windows, struct window *);
|
|
|
|
|
|
|
|
/* Entry on local window list. */
|
|
|
|
struct winlink {
|
|
|
|
int idx;
|
|
|
|
struct window *window;
|
|
|
|
|
2009-11-19 20:47:28 +01:00
|
|
|
size_t status_width;
|
|
|
|
struct grid_cell status_cell;
|
|
|
|
char *status_text;
|
|
|
|
|
2010-06-21 03:27:46 +02:00
|
|
|
int flags;
|
|
|
|
#define WINLINK_BELL 0x1
|
|
|
|
#define WINLINK_ACTIVITY 0x2
|
|
|
|
#define WINLINK_CONTENT 0x4
|
2010-12-06 23:51:02 +01:00
|
|
|
#define WINLINK_SILENCE 0x8
|
|
|
|
#define WINLINK_ALERTFLAGS \
|
|
|
|
(WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_CONTENT|WINLINK_SILENCE)
|
2010-06-21 03:27:46 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
RB_ENTRY(winlink) entry;
|
2009-10-10 12:02:48 +02:00
|
|
|
TAILQ_ENTRY(winlink) sentry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
RB_HEAD(winlinks, winlink);
|
2009-10-10 12:02:48 +02:00
|
|
|
TAILQ_HEAD(winlink_stack, winlink);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-07-19 15:21:40 +02:00
|
|
|
/* Layout direction. */
|
|
|
|
enum layout_type {
|
|
|
|
LAYOUT_LEFTRIGHT,
|
|
|
|
LAYOUT_TOPBOTTOM,
|
|
|
|
LAYOUT_WINDOWPANE
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Layout cells queue. */
|
|
|
|
TAILQ_HEAD(layout_cells, layout_cell);
|
|
|
|
|
|
|
|
/* Layout cell. */
|
|
|
|
struct layout_cell {
|
|
|
|
enum layout_type type;
|
|
|
|
|
|
|
|
struct layout_cell *parent;
|
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
|
|
|
struct window_pane *wp;
|
|
|
|
struct layout_cells cells;
|
|
|
|
|
|
|
|
TAILQ_ENTRY(layout_cell) entry;
|
|
|
|
};
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Paste buffer. */
|
|
|
|
struct paste_buffer {
|
2009-11-26 23:28:24 +01:00
|
|
|
char *data;
|
2009-09-07 20:50:45 +02:00
|
|
|
size_t size;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
ARRAY_DECL(paste_stack, struct paste_buffer *);
|
|
|
|
|
2009-08-08 23:52:43 +02:00
|
|
|
/* Environment variable. */
|
|
|
|
struct environ_entry {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
RB_ENTRY(environ_entry) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(environ, environ_entry);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Client session. */
|
2009-10-10 12:02:48 +02:00
|
|
|
struct session_group {
|
|
|
|
TAILQ_HEAD(, session) sessions;
|
|
|
|
|
|
|
|
TAILQ_ENTRY(session_group) entry;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(session_groups, session_group);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct session {
|
2013-03-25 11:11:45 +01:00
|
|
|
u_int id;
|
2010-12-21 23:37:59 +01:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
char *name;
|
2010-06-27 04:56:59 +02:00
|
|
|
char *cwd;
|
2009-11-03 21:29:47 +01:00
|
|
|
|
|
|
|
struct timeval creation_time;
|
|
|
|
struct timeval activity_time;
|
2013-01-15 23:55:29 +01:00
|
|
|
struct timeval last_activity_time;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
struct winlink *curw;
|
|
|
|
struct winlink_stack lastw;
|
|
|
|
struct winlinks windows;
|
|
|
|
|
|
|
|
struct options options;
|
|
|
|
|
|
|
|
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
|
|
|
int flags;
|
2009-08-08 23:52:43 +02:00
|
|
|
|
2009-09-16 14:35:04 +02:00
|
|
|
struct termios *tio;
|
2009-08-13 21:03:59 +02:00
|
|
|
|
2009-08-08 23:52:43 +02:00
|
|
|
struct environ environ;
|
2009-09-07 23:01:50 +02:00
|
|
|
|
|
|
|
int references;
|
2009-10-10 12:02:48 +02:00
|
|
|
|
|
|
|
TAILQ_ENTRY(session) gentry;
|
2010-12-21 23:37:59 +01:00
|
|
|
RB_ENTRY(session) entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
2010-12-21 23:37:59 +01:00
|
|
|
RB_HEAD(sessions, session);
|
|
|
|
ARRAY_DECL(sessionslist, struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* TTY information. */
|
|
|
|
struct tty_key {
|
2009-11-05 20:29:41 +01:00
|
|
|
char ch;
|
2009-12-03 23:50:09 +01:00
|
|
|
int key;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-11-05 20:29:41 +01:00
|
|
|
struct tty_key *left;
|
|
|
|
struct tty_key *right;
|
|
|
|
|
|
|
|
struct tty_key *next;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct tty_term {
|
|
|
|
char *name;
|
|
|
|
u_int references;
|
|
|
|
|
2010-09-11 18:19:22 +02:00
|
|
|
char acs[UCHAR_MAX + 1][2];
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct tty_code codes[NTTYCODE];
|
|
|
|
|
2009-10-25 22:11:21 +01:00
|
|
|
#define TERM_256COLOURS 0x1
|
2013-03-27 12:17:12 +01:00
|
|
|
#define TERM_EARLYWRAP 0x2
|
2009-06-02 00:58:49 +02:00
|
|
|
int flags;
|
|
|
|
|
2011-01-26 01:11:47 +01:00
|
|
|
LIST_ENTRY(tty_term) entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
2011-01-26 01:11:47 +01:00
|
|
|
LIST_HEAD(tty_terms, tty_term);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2012-10-26 16:35:42 +02:00
|
|
|
/* Mouse wheel states. */
|
|
|
|
#define MOUSE_WHEEL_UP 0
|
|
|
|
#define MOUSE_WHEEL_DOWN 1
|
|
|
|
|
|
|
|
/* Mouse events. */
|
|
|
|
#define MOUSE_EVENT_DOWN (1 << 0)
|
|
|
|
#define MOUSE_EVENT_DRAG (1 << 1)
|
|
|
|
#define MOUSE_EVENT_UP (1 << 2)
|
|
|
|
#define MOUSE_EVENT_CLICK (1 << 3)
|
|
|
|
#define MOUSE_EVENT_WHEEL (1 << 4)
|
|
|
|
|
|
|
|
/* Mouse flags. */
|
|
|
|
#define MOUSE_RESIZE_PANE (1 << 0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mouse input. When sent by xterm:
|
|
|
|
*
|
|
|
|
* - buttons are in the bottom two bits: 0 = b1; 1 = b2; 2 = b3; 3 = released
|
|
|
|
* - bits 3, 4 and 5 are for keys
|
|
|
|
* - bit 6 is set for dragging
|
|
|
|
* - bit 7 for buttons 4 and 5
|
2013-03-22 11:33:50 +01:00
|
|
|
*
|
|
|
|
* With the SGR 1006 extension the released button becomes known. Store these
|
|
|
|
* in separate fields and store the value converted to the old format in xb.
|
2012-10-26 16:35:42 +02:00
|
|
|
*/
|
|
|
|
struct mouse_event {
|
|
|
|
u_int xb;
|
|
|
|
|
|
|
|
u_int x;
|
|
|
|
u_int lx;
|
|
|
|
u_int sx;
|
|
|
|
|
|
|
|
u_int y;
|
|
|
|
u_int ly;
|
|
|
|
u_int sy;
|
|
|
|
|
2013-03-22 11:33:50 +01:00
|
|
|
u_int sgr; /* whether the input arrived in SGR format */
|
|
|
|
u_int sgr_xb; /* only for SGR: the unmangled button */
|
2013-03-22 11:37:39 +01:00
|
|
|
u_int sgr_rel; /* only for SGR: if it is a release event */
|
2013-03-22 11:33:50 +01:00
|
|
|
|
2012-10-26 16:35:42 +02:00
|
|
|
u_int button;
|
|
|
|
u_int clicks;
|
|
|
|
|
|
|
|
int wheel;
|
|
|
|
int event;
|
|
|
|
int flags;
|
|
|
|
};
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
struct tty {
|
2012-05-22 16:32:28 +02:00
|
|
|
struct client *client;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
char *path;
|
2012-11-22 15:41:11 +01:00
|
|
|
u_int class;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-12-03 23:50:09 +01:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
u_int cx;
|
|
|
|
u_int cy;
|
2011-05-20 21:17:39 +02:00
|
|
|
u_int cstyle;
|
2011-05-20 21:03:58 +02:00
|
|
|
char *ccolour;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
u_int rlower;
|
|
|
|
u_int rupper;
|
|
|
|
|
|
|
|
char *termname;
|
|
|
|
struct tty_term *term;
|
|
|
|
|
|
|
|
int fd;
|
2009-11-04 22:47:42 +01:00
|
|
|
struct bufferevent *event;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
int log_fd;
|
|
|
|
|
2009-12-03 23:50:09 +01:00
|
|
|
struct termios tio;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
struct grid_cell cell;
|
|
|
|
|
|
|
|
#define TTY_NOCURSOR 0x1
|
|
|
|
#define TTY_FREEZE 0x2
|
2013-03-21 19:47:56 +01:00
|
|
|
#define TTY_TIMER 0x4
|
2009-06-02 00:58:49 +02:00
|
|
|
#define TTY_UTF8 0x8
|
2009-08-11 21:32:25 +02:00
|
|
|
#define TTY_STARTED 0x10
|
2009-08-11 22:29:04 +02:00
|
|
|
#define TTY_OPENED 0x20
|
2009-12-03 23:50:09 +01:00
|
|
|
int flags;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
int term_flags;
|
|
|
|
|
2012-05-22 16:32:28 +02:00
|
|
|
struct mouse_event mouse;
|
|
|
|
|
2009-11-05 09:45:08 +01:00
|
|
|
struct event key_timer;
|
2009-11-05 20:29:41 +01:00
|
|
|
struct tty_key *key_tree;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
2009-07-22 20:02:23 +02:00
|
|
|
/* TTY command context and function pointer. */
|
|
|
|
struct tty_ctx {
|
|
|
|
struct window_pane *wp;
|
|
|
|
|
|
|
|
const struct grid_cell *cell;
|
|
|
|
|
2009-07-22 22:53:38 +02:00
|
|
|
u_int num;
|
2009-12-17 18:39:56 +01:00
|
|
|
void *ptr;
|
2009-07-22 22:53:38 +02:00
|
|
|
|
2009-12-17 18:39:56 +01:00
|
|
|
/*
|
2009-07-22 22:53:38 +02:00
|
|
|
* Cursor and region position before the screen was updated - this is
|
|
|
|
* where the command should be applied; the values in the screen have
|
|
|
|
* already been updated.
|
|
|
|
*/
|
|
|
|
u_int ocx;
|
|
|
|
u_int ocy;
|
|
|
|
|
|
|
|
u_int orupper;
|
|
|
|
u_int orlower;
|
2009-10-17 10:24:46 +02:00
|
|
|
|
2012-01-29 10:37:02 +01:00
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
2009-10-17 10:24:46 +02:00
|
|
|
/* Saved last cell on line. */
|
|
|
|
struct grid_cell last_cell;
|
|
|
|
u_int last_width;
|
2009-07-22 20:02:23 +02:00
|
|
|
};
|
|
|
|
|
2009-11-18 14:16:33 +01:00
|
|
|
/* Saved message entry. */
|
|
|
|
struct message_entry {
|
|
|
|
char *msg;
|
|
|
|
time_t msg_time;
|
|
|
|
};
|
|
|
|
|
2011-01-26 02:54:56 +01:00
|
|
|
/* Status output data from a job. */
|
|
|
|
struct status_out {
|
|
|
|
char *cmd;
|
|
|
|
char *out;
|
|
|
|
|
|
|
|
RB_ENTRY(status_out) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(status_out_tree, status_out);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* Client connection. */
|
|
|
|
struct client {
|
2009-08-11 19:18:35 +02:00
|
|
|
struct imsgbuf ibuf;
|
2009-11-04 21:50:11 +01:00
|
|
|
struct event event;
|
2010-07-11 19:06:45 +02:00
|
|
|
int retcode;
|
2009-11-03 21:29:47 +01:00
|
|
|
|
|
|
|
struct timeval creation_time;
|
2009-11-03 23:40:40 +01:00
|
|
|
struct timeval activity_time;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-08-08 23:52:43 +02:00
|
|
|
struct environ environ;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
char *title;
|
|
|
|
char *cwd;
|
|
|
|
|
2009-12-03 23:50:09 +01:00
|
|
|
struct tty tty;
|
2010-07-24 22:11:59 +02:00
|
|
|
|
2012-05-21 20:27:42 +02:00
|
|
|
void (*stdin_callback)(struct client *, int, void *);
|
|
|
|
void *stdin_callback_data;
|
|
|
|
struct evbuffer *stdin_data;
|
|
|
|
int stdin_closed;
|
|
|
|
struct evbuffer *stdout_data;
|
|
|
|
struct evbuffer *stderr_data;
|
2010-06-29 00:10:42 +02:00
|
|
|
|
2009-11-05 01:05:00 +01:00
|
|
|
struct event repeat_timer;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-01-26 02:54:56 +01:00
|
|
|
struct status_out_tree status_old;
|
|
|
|
struct status_out_tree status_new;
|
2009-10-10 17:03:01 +02:00
|
|
|
struct timeval status_timer;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct screen status;
|
|
|
|
|
|
|
|
#define CLIENT_TERMINAL 0x1
|
|
|
|
#define CLIENT_PREFIX 0x2
|
2010-07-24 22:11:59 +02:00
|
|
|
#define CLIENT_EXIT 0x4
|
2009-06-02 00:58:49 +02:00
|
|
|
#define CLIENT_REDRAW 0x8
|
|
|
|
#define CLIENT_STATUS 0x10
|
2012-05-22 16:11:30 +02:00
|
|
|
#define CLIENT_REPEAT 0x20 /* allow command to repeat within repeat time */
|
2009-06-02 00:58:49 +02:00
|
|
|
#define CLIENT_SUSPENDED 0x40
|
2009-08-07 17:39:10 +02:00
|
|
|
#define CLIENT_BAD 0x80
|
2009-08-31 22:46:19 +02:00
|
|
|
#define CLIENT_IDENTIFY 0x100
|
2009-09-07 23:01:50 +02:00
|
|
|
#define CLIENT_DEAD 0x200
|
2010-01-03 13:51:05 +01:00
|
|
|
#define CLIENT_BORDERS 0x400
|
2010-02-06 23:55:31 +01:00
|
|
|
#define CLIENT_READONLY 0x800
|
2012-01-22 00:51:34 +01:00
|
|
|
#define CLIENT_REDRAWWINDOW 0x1000
|
2012-06-18 15:16:42 +02:00
|
|
|
#define CLIENT_CONTROL 0x2000
|
2013-03-24 10:28:59 +01:00
|
|
|
#define CLIENT_FOCUSED 0x4000
|
2009-06-02 00:58:49 +02:00
|
|
|
int flags;
|
|
|
|
|
2009-11-05 00:29:42 +01:00
|
|
|
struct event identify_timer;
|
2009-08-31 22:46:19 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
char *message_string;
|
2009-11-05 00:29:42 +01:00
|
|
|
struct event message_timer;
|
2009-11-18 14:16:33 +01:00
|
|
|
ARRAY_DECL(, struct message_entry) message_log;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
char *prompt_string;
|
|
|
|
char *prompt_buffer;
|
|
|
|
size_t prompt_index;
|
2009-07-17 08:13:27 +02:00
|
|
|
int (*prompt_callbackfn)(void *, const char *);
|
|
|
|
void (*prompt_freefn)(void *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void *prompt_data;
|
2010-12-11 17:05:57 +01:00
|
|
|
u_int prompt_hindex;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-09-23 16:42:48 +02:00
|
|
|
#define PROMPT_SINGLE 0x1
|
2009-06-02 00:58:49 +02:00
|
|
|
int prompt_flags;
|
|
|
|
|
|
|
|
struct mode_key_data prompt_mdata;
|
|
|
|
|
|
|
|
struct session *session;
|
2010-12-20 01:17:22 +01:00
|
|
|
struct session *last_session;
|
2009-09-07 23:01:50 +02:00
|
|
|
|
2012-03-03 09:55:56 +01:00
|
|
|
int wlmouse;
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
struct cmd_q *cmdq;
|
2009-09-07 23:01:50 +02:00
|
|
|
int references;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
ARRAY_DECL(clients, struct client *);
|
|
|
|
|
2011-01-04 01:42:46 +01:00
|
|
|
/* Parsed arguments. */
|
|
|
|
struct args {
|
|
|
|
bitstr_t *flags;
|
|
|
|
char *values[SCHAR_MAX]; /* XXX This is awfully big. */
|
|
|
|
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
};
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
/* Command and list of commands. */
|
2009-06-02 00:58:49 +02:00
|
|
|
struct cmd {
|
2011-01-04 01:42:46 +01:00
|
|
|
const struct cmd_entry *entry;
|
|
|
|
struct args *args;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
char *file;
|
|
|
|
u_int line;
|
|
|
|
|
2011-01-04 01:42:46 +01:00
|
|
|
TAILQ_ENTRY(cmd) qentry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
2010-06-26 20:20:53 +02:00
|
|
|
struct cmd_list {
|
2011-01-04 01:42:46 +01:00
|
|
|
int references;
|
|
|
|
TAILQ_HEAD(, cmd) list;
|
2010-06-26 20:20:53 +02:00
|
|
|
};
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
/* Command return values. */
|
2012-07-11 09:10:15 +02:00
|
|
|
enum cmd_retval {
|
|
|
|
CMD_RETURN_ERROR = -1,
|
|
|
|
CMD_RETURN_NORMAL = 0,
|
2013-03-24 10:54:10 +01:00
|
|
|
CMD_RETURN_WAIT,
|
|
|
|
CMD_RETURN_STOP
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Command queue entry. */
|
|
|
|
struct cmd_q_item {
|
|
|
|
struct cmd_list *cmdlist;
|
|
|
|
TAILQ_ENTRY(cmd_q_item) qentry;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(cmd_q_items, cmd_q_item);
|
|
|
|
|
|
|
|
/* Command queue. */
|
|
|
|
struct cmd_q {
|
|
|
|
int references;
|
|
|
|
int dead;
|
|
|
|
|
|
|
|
struct client *client;
|
|
|
|
int client_exit;
|
|
|
|
|
|
|
|
struct cmd_q_items queue;
|
|
|
|
struct cmd_q_item *item;
|
|
|
|
struct cmd *cmd;
|
|
|
|
|
2013-03-25 12:44:00 +01:00
|
|
|
time_t time;
|
|
|
|
u_int number;
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
void (*emptyfn)(struct cmd_q *);
|
|
|
|
void *data;
|
|
|
|
|
|
|
|
struct msg_command_data *msgdata;
|
2013-03-25 11:09:05 +01:00
|
|
|
|
|
|
|
TAILQ_ENTRY(cmd_q) waitentry;
|
2012-07-11 09:10:15 +02:00
|
|
|
};
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
/* Command definition. */
|
2009-06-02 00:58:49 +02:00
|
|
|
struct cmd_entry {
|
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
2011-01-04 01:42:46 +01:00
|
|
|
|
|
|
|
const char *args_template;
|
|
|
|
int args_lower;
|
|
|
|
int args_upper;
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
const char *usage;
|
|
|
|
|
|
|
|
#define CMD_STARTSERVER 0x1
|
|
|
|
#define CMD_CANTNEST 0x2
|
2009-08-11 14:53:37 +02:00
|
|
|
#define CMD_SENDENVIRON 0x4
|
2011-01-04 01:42:46 +01:00
|
|
|
#define CMD_READONLY 0x8
|
2009-06-02 00:58:49 +02:00
|
|
|
int flags;
|
|
|
|
|
2011-01-04 01:42:46 +01:00
|
|
|
void (*key_binding)(struct cmd *, int);
|
|
|
|
int (*check)(struct args *);
|
2013-03-24 10:54:10 +01:00
|
|
|
enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Key binding. */
|
|
|
|
struct key_binding {
|
|
|
|
int key;
|
|
|
|
struct cmd_list *cmdlist;
|
|
|
|
int can_repeat;
|
|
|
|
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_ENTRY(key_binding) entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_HEAD(key_bindings, key_binding);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-01-01 17:51:21 +01:00
|
|
|
/*
|
|
|
|
* Option table entries. The option table is the user-visible part of the
|
|
|
|
* option, as opposed to the internal options (struct option) which are just
|
|
|
|
* number or string.
|
|
|
|
*/
|
|
|
|
enum options_table_type {
|
|
|
|
OPTIONS_TABLE_STRING,
|
|
|
|
OPTIONS_TABLE_NUMBER,
|
2012-01-21 09:40:09 +01:00
|
|
|
OPTIONS_TABLE_KEY,
|
2011-01-01 17:51:21 +01:00
|
|
|
OPTIONS_TABLE_COLOUR,
|
|
|
|
OPTIONS_TABLE_ATTRIBUTES,
|
|
|
|
OPTIONS_TABLE_FLAG,
|
|
|
|
OPTIONS_TABLE_CHOICE
|
|
|
|
};
|
|
|
|
|
|
|
|
struct options_table_entry {
|
|
|
|
const char *name;
|
|
|
|
enum options_table_type type;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-01-01 17:51:21 +01:00
|
|
|
u_int minimum;
|
|
|
|
u_int maximum;
|
|
|
|
const char **choices;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-01-01 17:51:21 +01:00
|
|
|
const char *default_str;
|
|
|
|
long long default_num;
|
2009-06-02 00:58:49 +02:00
|
|
|
};
|
|
|
|
|
2011-08-26 12:53:16 +02:00
|
|
|
/* Tree of format entries. */
|
|
|
|
struct format_entry {
|
|
|
|
char *key;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
RB_ENTRY(format_entry) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(format_tree, format_entry);
|
|
|
|
|
2011-01-04 01:42:46 +01:00
|
|
|
/* Common command usages. */
|
|
|
|
#define CMD_TARGET_PANE_USAGE "[-t target-pane]"
|
|
|
|
#define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
|
|
|
|
#define CMD_TARGET_SESSION_USAGE "[-t target-session]"
|
|
|
|
#define CMD_TARGET_CLIENT_USAGE "[-t target-client]"
|
|
|
|
#define CMD_SRCDST_PANE_USAGE "[-s src-pane] [-t dst-pane]"
|
|
|
|
#define CMD_SRCDST_WINDOW_USAGE "[-s src-window] [-t dst-window]"
|
|
|
|
#define CMD_SRCDST_SESSION_USAGE "[-s src-session] [-t dst-session]"
|
|
|
|
#define CMD_SRCDST_CLIENT_USAGE "[-s src-client] [-t dst-client]"
|
|
|
|
#define CMD_BUFFER_USAGE "[-b buffer-index]"
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* tmux.c */
|
2009-12-10 10:16:52 +01:00
|
|
|
extern struct options global_options;
|
2009-07-07 21:49:19 +02:00
|
|
|
extern struct options global_s_options;
|
|
|
|
extern struct options global_w_options;
|
2009-08-08 23:52:43 +02:00
|
|
|
extern struct environ global_environ;
|
2010-05-04 19:28:16 +02:00
|
|
|
extern struct event_base *ev_base;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern char *cfg_file;
|
2010-10-18 22:00:02 +02:00
|
|
|
extern char *shell_cmd;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern int debug_level;
|
|
|
|
extern time_t start_time;
|
2010-10-18 22:00:02 +02:00
|
|
|
extern char socket_path[MAXPATHLEN];
|
2009-09-02 19:34:57 +02:00
|
|
|
extern int login_shell;
|
2010-10-18 22:00:02 +02:00
|
|
|
extern char *environ_path;
|
|
|
|
extern pid_t environ_pid;
|
2013-03-25 11:11:45 +01:00
|
|
|
extern int environ_session_id;
|
2009-06-02 00:58:49 +02:00
|
|
|
void logfile(const char *);
|
2009-09-01 15:09:49 +02:00
|
|
|
const char *getshell(void);
|
|
|
|
int checkshell(const char *);
|
|
|
|
int areshell(const char *);
|
2011-10-23 10:34:01 +02:00
|
|
|
const char* get_full_path(const char *, const char *);
|
2011-01-08 02:52:36 +01:00
|
|
|
void setblocking(int, int);
|
2010-10-18 22:00:02 +02:00
|
|
|
__dead void shell_exec(const char *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* cfg.c */
|
2013-03-24 10:54:10 +01:00
|
|
|
extern struct cmd_q *cfg_cmd_q;
|
|
|
|
extern int cfg_finished;
|
|
|
|
extern int cfg_references;
|
2010-11-11 21:51:30 +01:00
|
|
|
extern struct causelist cfg_causes;
|
2013-03-24 10:54:10 +01:00
|
|
|
int load_cfg(const char *, struct cmd_q *, char **);
|
|
|
|
void cfg_default_done(struct cmd_q *);
|
|
|
|
void cfg_show_causes(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-08-26 12:53:16 +02:00
|
|
|
/* format.c */
|
|
|
|
int format_cmp(struct format_entry *, struct format_entry *);
|
|
|
|
RB_PROTOTYPE(format_tree, format_entry, entry, format_cmp);
|
|
|
|
struct format_tree *format_create(void);
|
|
|
|
void format_free(struct format_tree *);
|
2012-03-02 12:16:44 +01:00
|
|
|
void printflike3 format_add(
|
2011-08-26 12:53:16 +02:00
|
|
|
struct format_tree *, const char *, const char *, ...);
|
|
|
|
const char *format_find(struct format_tree *, const char *);
|
|
|
|
char *format_expand(struct format_tree *, const char *);
|
|
|
|
void format_session(struct format_tree *, struct session *);
|
2011-10-23 03:12:46 +02:00
|
|
|
void format_client(struct format_tree *, struct client *);
|
2011-08-26 12:53:16 +02:00
|
|
|
void format_winlink(
|
|
|
|
struct format_tree *, struct session *, struct winlink *);
|
|
|
|
void format_window_pane(struct format_tree *, struct window_pane *);
|
2012-05-22 13:35:37 +02:00
|
|
|
void format_paste_buffer(struct format_tree *, struct paste_buffer *);
|
2011-08-26 12:53:16 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* mode-key.c */
|
2009-07-28 09:03:32 +02:00
|
|
|
extern const struct mode_key_table mode_key_tables[];
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_edit;
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_choice;
|
|
|
|
extern struct mode_key_tree mode_key_tree_vi_copy;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_edit;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_choice;
|
|
|
|
extern struct mode_key_tree mode_key_tree_emacs_copy;
|
|
|
|
int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *);
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp);
|
2011-01-01 04:39:21 +01:00
|
|
|
const char *mode_key_tostring(const struct mode_key_cmdstr *,
|
|
|
|
enum mode_key_cmd);
|
|
|
|
enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *,
|
|
|
|
const char *);
|
2009-07-28 19:05:10 +02:00
|
|
|
const struct mode_key_table *mode_key_findtable(const char *);
|
2009-07-28 09:03:32 +02:00
|
|
|
void mode_key_init_trees(void);
|
|
|
|
void mode_key_init(struct mode_key_data *, struct mode_key_tree *);
|
2013-03-22 17:00:26 +01:00
|
|
|
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int, const char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2012-03-17 23:35:09 +01:00
|
|
|
/* notify.c */
|
2012-07-13 08:27:41 +02:00
|
|
|
void notify_enable(void);
|
|
|
|
void notify_disable(void);
|
2012-09-25 09:41:22 +02:00
|
|
|
void notify_input(struct window_pane *, struct evbuffer *);
|
2012-03-17 23:35:09 +01:00
|
|
|
void notify_window_layout_changed(struct window *);
|
|
|
|
void notify_window_unlinked(struct session *, struct window *);
|
|
|
|
void notify_window_linked(struct session *, struct window *);
|
|
|
|
void notify_window_renamed(struct window *);
|
|
|
|
void notify_attached_session_changed(struct client *);
|
|
|
|
void notify_session_renamed(struct session *);
|
|
|
|
void notify_session_created(struct session *);
|
|
|
|
void notify_session_closed(struct session *);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* options.c */
|
|
|
|
int options_cmp(struct options_entry *, struct options_entry *);
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp);
|
2009-06-02 00:58:49 +02:00
|
|
|
void options_init(struct options *, struct options *);
|
|
|
|
void options_free(struct options *);
|
|
|
|
struct options_entry *options_find1(struct options *, const char *);
|
|
|
|
struct options_entry *options_find(struct options *, const char *);
|
2009-07-21 21:54:22 +02:00
|
|
|
void options_remove(struct options *, const char *);
|
2009-09-21 16:56:03 +02:00
|
|
|
struct options_entry *printflike3 options_set_string(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct options *, const char *, const char *, ...);
|
2009-06-02 00:58:49 +02:00
|
|
|
char *options_get_string(struct options *, const char *);
|
2009-09-21 16:56:03 +02:00
|
|
|
struct options_entry *options_set_number(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct options *, const char *, long long);
|
2009-06-02 00:58:49 +02:00
|
|
|
long long options_get_number(struct options *, const char *);
|
|
|
|
|
2011-01-01 17:51:21 +01:00
|
|
|
/* options-table.c */
|
|
|
|
extern const struct options_table_entry server_options_table[];
|
|
|
|
extern const struct options_table_entry session_options_table[];
|
|
|
|
extern const struct options_table_entry window_options_table[];
|
2013-03-21 17:19:25 +01:00
|
|
|
void options_table_populate_tree(const struct options_table_entry *,
|
|
|
|
struct options *);
|
|
|
|
const char *options_table_print_entry(const struct options_table_entry *,
|
|
|
|
struct options_entry *, int);
|
|
|
|
int options_table_find(const char *, const struct options_table_entry **,
|
2012-02-25 13:57:42 +01:00
|
|
|
const struct options_table_entry **);
|
2011-01-01 17:51:21 +01:00
|
|
|
|
2009-10-10 17:03:01 +02:00
|
|
|
/* job.c */
|
2009-10-10 20:42:14 +02:00
|
|
|
extern struct joblist all_jobs;
|
2013-03-25 12:44:00 +01:00
|
|
|
struct job *job_run(const char *, struct session *,
|
|
|
|
void (*)(struct job *), void (*)(void *), void *);
|
2009-10-10 17:03:01 +02:00
|
|
|
void job_free(struct job *);
|
2009-11-04 22:04:43 +01:00
|
|
|
void job_died(struct job *, int);
|
2009-10-10 17:03:01 +02:00
|
|
|
|
2009-08-08 23:52:43 +02:00
|
|
|
/* environ.c */
|
|
|
|
int environ_cmp(struct environ_entry *, struct environ_entry *);
|
|
|
|
RB_PROTOTYPE(environ, environ_entry, entry, environ_cmp);
|
|
|
|
void environ_init(struct environ *);
|
|
|
|
void environ_free(struct environ *);
|
|
|
|
void environ_copy(struct environ *, struct environ *);
|
|
|
|
struct environ_entry *environ_find(struct environ *, const char *);
|
|
|
|
void environ_set(struct environ *, const char *, const char *);
|
|
|
|
void environ_put(struct environ *, const char *);
|
|
|
|
void environ_unset(struct environ *, const char *);
|
2009-12-03 23:50:09 +01:00
|
|
|
void environ_update(const char *, struct environ *, struct environ *);
|
2010-04-04 21:02:09 +02:00
|
|
|
void environ_push(struct environ *);
|
2009-08-08 23:52:43 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* tty.c */
|
2012-03-17 22:27:51 +01:00
|
|
|
void tty_init_termios(int, struct termios *, struct bufferevent *);
|
2009-09-23 08:18:47 +02:00
|
|
|
void tty_raw(struct tty *, const char *);
|
2009-08-31 22:46:19 +02:00
|
|
|
void tty_attributes(struct tty *, const struct grid_cell *);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_reset(struct tty *);
|
2009-10-12 11:09:35 +02:00
|
|
|
void tty_region_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
|
2009-10-12 11:16:59 +02:00
|
|
|
void tty_region(struct tty *, u_int, u_int);
|
2009-10-12 11:29:58 +02:00
|
|
|
void tty_cursor_pane(struct tty *, const struct tty_ctx *, u_int, u_int);
|
|
|
|
void tty_cursor(struct tty *, u_int, u_int);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_putcode(struct tty *, enum tty_code_code);
|
|
|
|
void tty_putcode1(struct tty *, enum tty_code_code, int);
|
|
|
|
void tty_putcode2(struct tty *, enum tty_code_code, int, int);
|
2011-05-20 21:03:58 +02:00
|
|
|
void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
|
2013-01-18 03:16:21 +01:00
|
|
|
void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
|
|
|
|
const void *);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_puts(struct tty *, const char *);
|
|
|
|
void tty_putc(struct tty *, u_char);
|
2013-01-18 03:16:21 +01:00
|
|
|
void tty_putn(struct tty *, const void *, size_t, u_int);
|
2012-05-22 16:32:28 +02:00
|
|
|
void tty_init(struct tty *, struct client *, int, char *);
|
2010-06-05 18:47:11 +02:00
|
|
|
int tty_resize(struct tty *);
|
2012-03-17 23:56:04 +01:00
|
|
|
int tty_set_size(struct tty *, u_int, u_int);
|
2012-11-22 15:41:11 +01:00
|
|
|
void tty_set_class(struct tty *, u_int);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_start_tty(struct tty *);
|
|
|
|
void tty_stop_tty(struct tty *);
|
|
|
|
void tty_set_title(struct tty *, const char *);
|
2011-05-20 21:03:58 +02:00
|
|
|
void tty_update_mode(struct tty *, int, struct screen *);
|
|
|
|
void tty_force_cursor_colour(struct tty *, const char *);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int);
|
2009-08-03 16:10:54 +02:00
|
|
|
int tty_open(struct tty *, const char *, char **);
|
2009-08-11 21:32:25 +02:00
|
|
|
void tty_close(struct tty *);
|
|
|
|
void tty_free(struct tty *);
|
2012-01-29 10:37:02 +01:00
|
|
|
void tty_write(
|
|
|
|
void (*)(struct tty *, const struct tty_ctx *), struct tty_ctx *);
|
2009-08-12 11:41:59 +02:00
|
|
|
void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_cell(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearendofline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *);
|
2013-01-16 00:18:55 +01:00
|
|
|
void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
|
2009-08-12 11:41:59 +02:00
|
|
|
void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
|
2011-04-19 23:31:33 +02:00
|
|
|
void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
|
2009-08-12 11:41:59 +02:00
|
|
|
void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_utf8character(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
2011-05-18 22:24:29 +02:00
|
|
|
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
|
2011-03-08 00:46:27 +01:00
|
|
|
void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
|
2011-08-24 11:58:44 +02:00
|
|
|
void tty_bell(struct tty *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* tty-term.c */
|
|
|
|
extern struct tty_terms tty_terms;
|
2011-01-01 04:32:28 +01:00
|
|
|
extern const struct tty_term_code_entry tty_term_codes[NTTYCODE];
|
2009-08-03 16:10:54 +02:00
|
|
|
struct tty_term *tty_term_find(char *, int, const char *, char **);
|
2009-12-03 23:50:09 +01:00
|
|
|
void tty_term_free(struct tty_term *);
|
2009-06-02 00:58:49 +02:00
|
|
|
int tty_term_has(struct tty_term *, enum tty_code_code);
|
|
|
|
const char *tty_term_string(struct tty_term *, enum tty_code_code);
|
|
|
|
const char *tty_term_string1(struct tty_term *, enum tty_code_code, int);
|
|
|
|
const char *tty_term_string2(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct tty_term *, enum tty_code_code, int, int);
|
2011-05-20 21:03:58 +02:00
|
|
|
const char *tty_term_ptr1(
|
|
|
|
struct tty_term *, enum tty_code_code, const void *);
|
2012-11-27 21:22:12 +01:00
|
|
|
const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
|
|
|
|
const void *, const void *);
|
2009-06-02 00:58:49 +02:00
|
|
|
int tty_term_number(struct tty_term *, enum tty_code_code);
|
|
|
|
int tty_term_flag(struct tty_term *, enum tty_code_code);
|
|
|
|
|
2010-09-11 18:19:22 +02:00
|
|
|
/* tty-acs.c */
|
|
|
|
const char *tty_acs_get(struct tty *, u_char);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* tty-keys.c */
|
2013-03-21 17:50:22 +01:00
|
|
|
void tty_keys_build(struct tty *);
|
2009-07-22 20:02:23 +02:00
|
|
|
void tty_keys_free(struct tty *);
|
2009-11-05 09:45:08 +01:00
|
|
|
int tty_keys_next(struct tty *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* paste.c */
|
2011-03-28 21:44:31 +02:00
|
|
|
struct paste_buffer *paste_walk_stack(struct paste_stack *, u_int *);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct paste_buffer *paste_get_top(struct paste_stack *);
|
|
|
|
struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
|
2009-12-03 23:50:09 +01:00
|
|
|
int paste_free_top(struct paste_stack *);
|
2009-06-02 00:58:49 +02:00
|
|
|
int paste_free_index(struct paste_stack *, u_int);
|
2009-11-26 23:28:24 +01:00
|
|
|
void paste_add(struct paste_stack *, char *, size_t, u_int);
|
|
|
|
int paste_replace(struct paste_stack *, u_int, char *, size_t);
|
2010-06-21 23:44:09 +02:00
|
|
|
char *paste_print(struct paste_buffer *, size_t);
|
2012-11-27 21:22:12 +01:00
|
|
|
void paste_send_pane(struct paste_buffer *, struct window_pane *,
|
|
|
|
const char *, int);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* clock.c */
|
2009-08-31 22:46:19 +02:00
|
|
|
extern const char clock_table[14][5][5];
|
2009-11-27 00:13:47 +01:00
|
|
|
void clock_draw(struct screen_write_ctx *, int, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2011-01-04 01:42:46 +01:00
|
|
|
/* arguments.c */
|
|
|
|
struct args *args_create(int, ...);
|
|
|
|
struct args *args_parse(const char *, int, char **);
|
|
|
|
void args_free(struct args *);
|
|
|
|
size_t args_print(struct args *, char *, size_t);
|
|
|
|
int args_has(struct args *, u_char);
|
|
|
|
void args_set(struct args *, u_char, const char *);
|
|
|
|
const char *args_get(struct args *, u_char);
|
|
|
|
long long args_strtonum(
|
|
|
|
struct args *, u_char, long long, long long, char **);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* cmd.c */
|
2009-07-26 14:58:44 +02:00
|
|
|
int cmd_pack_argv(int, char **, char *, size_t);
|
|
|
|
int cmd_unpack_argv(char *, size_t, int, char ***);
|
2011-01-04 01:42:46 +01:00
|
|
|
char **cmd_copy_argv(int, char *const *);
|
2009-07-26 14:58:44 +02:00
|
|
|
void cmd_free_argv(int, char **);
|
2013-03-24 10:54:10 +01:00
|
|
|
struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
size_t cmd_print(struct cmd *, char *, size_t);
|
2013-03-24 10:54:10 +01:00
|
|
|
struct session *cmd_current_session(struct cmd_q *, int);
|
|
|
|
struct client *cmd_current_client(struct cmd_q *);
|
|
|
|
struct client *cmd_find_client(struct cmd_q *, const char *, int);
|
|
|
|
struct session *cmd_find_session(struct cmd_q *, const char *, int);
|
|
|
|
struct winlink *cmd_find_window(struct cmd_q *, const char *,
|
|
|
|
struct session **);
|
|
|
|
int cmd_find_index(struct cmd_q *, const char *,
|
|
|
|
struct session **);
|
|
|
|
struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **,
|
|
|
|
struct window_pane **);
|
2013-03-21 17:19:25 +01:00
|
|
|
char *cmd_template_replace(const char *, const char *, int);
|
2013-03-24 10:54:10 +01:00
|
|
|
const char *cmd_get_default_path(struct cmd_q *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry *cmd_table[];
|
|
|
|
extern const struct cmd_entry cmd_attach_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_bind_key_entry;
|
|
|
|
extern const struct cmd_entry cmd_break_pane_entry;
|
2009-12-01 19:42:38 +01:00
|
|
|
extern const struct cmd_entry cmd_capture_pane_entry;
|
2010-06-21 23:44:09 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_buffer_entry;
|
2009-08-25 14:18:51 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_client_entry;
|
2012-09-03 11:57:57 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_list_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_session_entry;
|
2012-07-08 18:04:38 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_tree_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_choose_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_clear_history_entry;
|
|
|
|
extern const struct cmd_entry cmd_clock_mode_entry;
|
|
|
|
extern const struct cmd_entry cmd_command_prompt_entry;
|
|
|
|
extern const struct cmd_entry cmd_confirm_before_entry;
|
|
|
|
extern const struct cmd_entry cmd_copy_mode_entry;
|
|
|
|
extern const struct cmd_entry cmd_delete_buffer_entry;
|
|
|
|
extern const struct cmd_entry cmd_detach_client_entry;
|
2009-07-17 20:45:08 +02:00
|
|
|
extern const struct cmd_entry cmd_display_message_entry;
|
2009-08-31 22:46:19 +02:00
|
|
|
extern const struct cmd_entry cmd_display_panes_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_down_pane_entry;
|
|
|
|
extern const struct cmd_entry cmd_find_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_has_session_entry;
|
2009-07-09 17:47:49 +02:00
|
|
|
extern const struct cmd_entry cmd_if_shell_entry;
|
2010-01-07 21:52:18 +01:00
|
|
|
extern const struct cmd_entry cmd_join_pane_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_kill_pane_entry;
|
|
|
|
extern const struct cmd_entry cmd_kill_server_entry;
|
|
|
|
extern const struct cmd_entry cmd_kill_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_kill_window_entry;
|
2010-10-23 15:04:34 +02:00
|
|
|
extern const struct cmd_entry cmd_last_pane_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_last_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_link_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_buffers_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_clients_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_commands_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_keys_entry;
|
2009-10-10 19:19:38 +02:00
|
|
|
extern const struct cmd_entry cmd_list_panes_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_list_sessions_entry;
|
|
|
|
extern const struct cmd_entry cmd_list_windows_entry;
|
|
|
|
extern const struct cmd_entry cmd_load_buffer_entry;
|
2009-09-24 16:17:09 +02:00
|
|
|
extern const struct cmd_entry cmd_lock_client_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_lock_server_entry;
|
2009-09-24 16:17:09 +02:00
|
|
|
extern const struct cmd_entry cmd_lock_session_entry;
|
2012-03-03 09:31:18 +01:00
|
|
|
extern const struct cmd_entry cmd_move_pane_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_move_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_new_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_new_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_next_layout_entry;
|
|
|
|
extern const struct cmd_entry cmd_next_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_paste_buffer_entry;
|
2009-10-11 12:04:27 +02:00
|
|
|
extern const struct cmd_entry cmd_pipe_pane_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_previous_layout_entry;
|
|
|
|
extern const struct cmd_entry cmd_previous_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_refresh_client_entry;
|
|
|
|
extern const struct cmd_entry cmd_rename_session_entry;
|
|
|
|
extern const struct cmd_entry cmd_rename_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_resize_pane_entry;
|
2011-06-05 13:19:03 +02:00
|
|
|
extern const struct cmd_entry cmd_respawn_pane_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_respawn_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_rotate_window_entry;
|
2009-09-20 21:15:01 +02:00
|
|
|
extern const struct cmd_entry cmd_run_shell_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_save_buffer_entry;
|
|
|
|
extern const struct cmd_entry cmd_select_layout_entry;
|
|
|
|
extern const struct cmd_entry cmd_select_pane_entry;
|
|
|
|
extern const struct cmd_entry cmd_select_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_send_keys_entry;
|
|
|
|
extern const struct cmd_entry cmd_send_prefix_entry;
|
|
|
|
extern const struct cmd_entry cmd_server_info_entry;
|
|
|
|
extern const struct cmd_entry cmd_set_buffer_entry;
|
2009-08-08 23:52:43 +02:00
|
|
|
extern const struct cmd_entry cmd_set_environment_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_set_option_entry;
|
|
|
|
extern const struct cmd_entry cmd_set_window_option_entry;
|
|
|
|
extern const struct cmd_entry cmd_show_buffer_entry;
|
2009-08-08 23:52:43 +02:00
|
|
|
extern const struct cmd_entry cmd_show_environment_entry;
|
2009-11-18 14:16:33 +01:00
|
|
|
extern const struct cmd_entry cmd_show_messages_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
extern const struct cmd_entry cmd_show_options_entry;
|
|
|
|
extern const struct cmd_entry cmd_show_window_options_entry;
|
|
|
|
extern const struct cmd_entry cmd_source_file_entry;
|
|
|
|
extern const struct cmd_entry cmd_split_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_start_server_entry;
|
|
|
|
extern const struct cmd_entry cmd_suspend_client_entry;
|
|
|
|
extern const struct cmd_entry cmd_swap_pane_entry;
|
|
|
|
extern const struct cmd_entry cmd_swap_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_switch_client_entry;
|
|
|
|
extern const struct cmd_entry cmd_unbind_key_entry;
|
|
|
|
extern const struct cmd_entry cmd_unlink_window_entry;
|
|
|
|
extern const struct cmd_entry cmd_up_pane_entry;
|
2013-03-25 11:09:05 +01:00
|
|
|
extern const struct cmd_entry cmd_wait_for_entry;
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2013-03-24 10:58:40 +01:00
|
|
|
/* cmd-attach-session.c */
|
|
|
|
enum cmd_retval cmd_attach_session(struct cmd_q *, const char*, int, int);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* cmd-list.c */
|
2013-03-24 10:54:10 +01:00
|
|
|
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
void cmd_list_free(struct cmd_list *);
|
|
|
|
size_t cmd_list_print(struct cmd_list *, char *, size_t);
|
|
|
|
|
2013-03-24 10:54:10 +01:00
|
|
|
/* cmd-queue.c */
|
|
|
|
struct cmd_q *cmdq_new(struct client *);
|
|
|
|
int cmdq_free(struct cmd_q *);
|
|
|
|
void printflike2 cmdq_print(struct cmd_q *, const char *, ...);
|
|
|
|
void printflike2 cmdq_info(struct cmd_q *, const char *, ...);
|
|
|
|
void printflike2 cmdq_error(struct cmd_q *, const char *, ...);
|
2013-03-25 12:44:00 +01:00
|
|
|
int cmdq_guard(struct cmd_q *, const char *);
|
2013-03-24 10:54:10 +01:00
|
|
|
void cmdq_run(struct cmd_q *, struct cmd_list *);
|
|
|
|
void cmdq_append(struct cmd_q *, struct cmd_list *);
|
|
|
|
int cmdq_continue(struct cmd_q *);
|
|
|
|
void cmdq_flush(struct cmd_q *);
|
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* cmd-string.c */
|
2013-03-24 10:54:10 +01:00
|
|
|
int cmd_string_parse(const char *, struct cmd_list **, const char *,
|
|
|
|
u_int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* client.c */
|
2010-10-18 22:00:02 +02:00
|
|
|
int client_main(int, char **, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* key-bindings.c */
|
|
|
|
extern struct key_bindings key_bindings;
|
|
|
|
int key_bindings_cmp(struct key_binding *, struct key_binding *);
|
2012-01-21 12:12:13 +01:00
|
|
|
RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct key_binding *key_bindings_lookup(int);
|
|
|
|
void key_bindings_add(int, int, struct cmd_list *);
|
|
|
|
void key_bindings_remove(int);
|
2009-07-13 01:46:49 +02:00
|
|
|
void key_bindings_clean(void);
|
2009-06-02 00:58:49 +02:00
|
|
|
void key_bindings_init(void);
|
|
|
|
void key_bindings_dispatch(struct key_binding *, struct client *);
|
|
|
|
|
|
|
|
/* key-string.c */
|
|
|
|
int key_string_lookup_string(const char *);
|
|
|
|
const char *key_string_lookup_key(int);
|
|
|
|
|
|
|
|
/* server.c */
|
|
|
|
extern struct clients clients;
|
2009-09-07 23:01:50 +02:00
|
|
|
extern struct clients dead_clients;
|
2010-12-31 00:16:18 +01:00
|
|
|
extern struct paste_stack global_buffers;
|
2012-03-09 10:57:40 +01:00
|
|
|
int server_start(int, char *);
|
2009-11-11 09:00:42 +01:00
|
|
|
void server_update_socket(void);
|
2012-04-11 08:16:14 +02:00
|
|
|
void server_add_accept(int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-10-22 21:41:51 +02:00
|
|
|
/* server-client.c */
|
2012-05-22 16:32:28 +02:00
|
|
|
void server_client_handle_key(struct client *, int);
|
2009-10-22 21:41:51 +02:00
|
|
|
void server_client_create(int);
|
2012-05-06 09:38:17 +02:00
|
|
|
int server_client_open(struct client *, struct session *, char **);
|
2009-10-22 21:41:51 +02:00
|
|
|
void server_client_lost(struct client *);
|
2009-11-04 21:50:11 +01:00
|
|
|
void server_client_callback(int, short, void *);
|
2009-11-05 00:42:51 +01:00
|
|
|
void server_client_status_timer(void);
|
2009-10-22 21:41:51 +02:00
|
|
|
void server_client_loop(void);
|
|
|
|
|
|
|
|
/* server-window.c */
|
|
|
|
void server_window_loop(void);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* server-fn.c */
|
2009-08-08 23:52:43 +02:00
|
|
|
void server_fill_environ(struct session *, struct environ *);
|
2012-05-22 12:56:48 +02:00
|
|
|
void server_write_ready(struct client *);
|
2012-05-21 20:27:42 +02:00
|
|
|
int server_write_client(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct client *, enum msgtype, const void *, size_t);
|
2009-06-02 00:58:49 +02:00
|
|
|
void server_write_session(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct session *, enum msgtype, const void *, size_t);
|
2009-06-02 00:58:49 +02:00
|
|
|
void server_redraw_client(struct client *);
|
|
|
|
void server_status_client(struct client *);
|
|
|
|
void server_redraw_session(struct session *);
|
2009-10-10 12:02:48 +02:00
|
|
|
void server_redraw_session_group(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void server_status_session(struct session *);
|
2009-10-10 12:02:48 +02:00
|
|
|
void server_status_session_group(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void server_redraw_window(struct window *);
|
2010-01-03 13:51:05 +01:00
|
|
|
void server_redraw_window_borders(struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void server_status_window(struct window *);
|
|
|
|
void server_lock(void);
|
2009-09-24 16:17:09 +02:00
|
|
|
void server_lock_session(struct session *);
|
|
|
|
void server_lock_client(struct client *);
|
2009-06-02 00:58:49 +02:00
|
|
|
int server_unlock(const char *);
|
2009-07-17 22:37:03 +02:00
|
|
|
void server_kill_window(struct window *);
|
2009-10-10 12:02:48 +02:00
|
|
|
int server_link_window(struct session *,
|
2009-09-20 19:27:18 +02:00
|
|
|
struct winlink *, struct session *, int, int, int, char **);
|
|
|
|
void server_unlink_window(struct session *, struct winlink *);
|
2009-11-13 18:33:07 +01:00
|
|
|
void server_destroy_pane(struct window_pane *);
|
2009-10-10 12:02:48 +02:00
|
|
|
void server_destroy_session_group(struct session *);
|
2009-09-12 15:01:19 +02:00
|
|
|
void server_destroy_session(struct session *);
|
2012-11-27 21:22:12 +01:00
|
|
|
void server_check_unattached(void);
|
2009-08-31 22:46:19 +02:00
|
|
|
void server_set_identify(struct client *);
|
|
|
|
void server_clear_identify(struct client *);
|
2009-11-05 00:12:43 +01:00
|
|
|
void server_update_event(struct client *);
|
2012-05-21 20:27:42 +02:00
|
|
|
void server_push_stdout(struct client *);
|
|
|
|
void server_push_stderr(struct client *);
|
|
|
|
int server_set_stdin_callback(struct client *, void (*)(struct client *,
|
|
|
|
int, void *), void *, char **);
|
2013-03-24 10:58:40 +01:00
|
|
|
void server_unzoom_window(struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* status.c */
|
2011-01-26 02:54:56 +01:00
|
|
|
int status_out_cmp(struct status_out *, struct status_out *);
|
|
|
|
RB_PROTOTYPE(status_out_tree, status_out, entry, status_out_cmp);
|
2012-01-29 10:37:02 +01:00
|
|
|
int status_at_line(struct client *);
|
2011-01-26 02:54:56 +01:00
|
|
|
void status_free_jobs(struct status_out_tree *);
|
|
|
|
void status_update_jobs(struct client *);
|
2011-04-18 21:49:05 +02:00
|
|
|
void status_set_window_at(struct client *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
int status_redraw(struct client *);
|
2011-03-29 21:30:16 +02:00
|
|
|
char *status_replace(struct client *, struct session *,
|
|
|
|
struct winlink *, struct window_pane *, const char *, time_t, int);
|
2009-07-15 19:39:00 +02:00
|
|
|
void printflike2 status_message_set(struct client *, const char *, ...);
|
2009-06-02 00:58:49 +02:00
|
|
|
void status_message_clear(struct client *);
|
|
|
|
int status_message_redraw(struct client *);
|
2011-07-02 23:05:44 +02:00
|
|
|
void status_prompt_set(struct client *, const char *, const char *,
|
2009-12-03 23:50:09 +01:00
|
|
|
int (*)(void *, const char *), void (*)(void *), void *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void status_prompt_clear(struct client *);
|
|
|
|
int status_prompt_redraw(struct client *);
|
|
|
|
void status_prompt_key(struct client *, int);
|
2011-07-02 23:05:44 +02:00
|
|
|
void status_prompt_update(struct client *, const char *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* resize.c */
|
|
|
|
void recalculate_sizes(void);
|
|
|
|
|
|
|
|
/* input.c */
|
|
|
|
void input_init(struct window_pane *);
|
|
|
|
void input_free(struct window_pane *);
|
|
|
|
void input_parse(struct window_pane *);
|
|
|
|
|
|
|
|
/* input-key.c */
|
|
|
|
void input_key(struct window_pane *, int);
|
2012-10-26 16:35:42 +02:00
|
|
|
void input_mouse(struct window_pane *, struct session *,
|
|
|
|
struct mouse_event *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2009-10-26 18:46:33 +01:00
|
|
|
/* xterm-keys.c */
|
2009-12-03 23:50:09 +01:00
|
|
|
char *xterm_keys_lookup(int);
|
2009-11-30 17:44:03 +01:00
|
|
|
int xterm_keys_find(const char *, size_t, size_t *, int *);
|
2009-10-26 18:46:33 +01:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* colour.c */
|
2009-09-10 19:16:24 +02:00
|
|
|
void colour_set_fg(struct grid_cell *, int);
|
|
|
|
void colour_set_bg(struct grid_cell *, int);
|
|
|
|
const char *colour_tostring(int);
|
2009-06-02 00:58:49 +02:00
|
|
|
int colour_fromstring(const char *);
|
|
|
|
u_char colour_256to16(u_char);
|
|
|
|
|
|
|
|
/* attributes.c */
|
|
|
|
const char *attributes_tostring(u_char);
|
|
|
|
int attributes_fromstring(const char *);
|
|
|
|
|
|
|
|
/* grid.c */
|
|
|
|
extern const struct grid_cell grid_default_cell;
|
2012-05-23 21:19:40 +02:00
|
|
|
extern const struct grid_cell grid_marker_cell;
|
2009-06-02 00:58:49 +02:00
|
|
|
struct grid *grid_create(u_int, u_int, u_int);
|
|
|
|
void grid_destroy(struct grid *);
|
|
|
|
int grid_compare(struct grid *, struct grid *);
|
2009-10-13 17:38:37 +02:00
|
|
|
void grid_collect_history(struct grid *);
|
|
|
|
void grid_scroll_history(struct grid *);
|
|
|
|
void grid_scroll_history_region(struct grid *, u_int, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void grid_expand_line(struct grid *, u_int, u_int);
|
|
|
|
const struct grid_cell *grid_peek_cell(struct grid *, u_int, u_int);
|
2013-03-22 17:00:26 +01:00
|
|
|
const struct grid_line *grid_peek_line(struct grid *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct grid_cell *grid_get_cell(struct grid *, u_int, u_int);
|
|
|
|
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
|
|
|
|
void grid_clear(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_clear_lines(struct grid *, u_int, u_int);
|
|
|
|
void grid_move_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
|
2013-03-22 16:51:54 +01:00
|
|
|
char *grid_string_cells(struct grid *, u_int, u_int, u_int,
|
2013-03-25 11:09:05 +01:00
|
|
|
struct grid_cell **, int, int, int);
|
2009-07-13 12:43:52 +02:00
|
|
|
void grid_duplicate_lines(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct grid *, u_int, struct grid *, u_int, u_int);
|
2013-03-21 17:19:25 +01:00
|
|
|
u_int grid_reflow(struct grid *, struct grid *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2013-01-18 03:16:21 +01:00
|
|
|
/* grid-cell.c */
|
|
|
|
u_int grid_cell_width(const struct grid_cell *);
|
|
|
|
void grid_cell_get(const struct grid_cell *, struct utf8_data *);
|
|
|
|
void grid_cell_set(struct grid_cell *, const struct utf8_data *);
|
|
|
|
void grid_cell_one(struct grid_cell *, u_char);
|
2009-11-18 18:02:17 +01:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* grid-view.c */
|
|
|
|
const struct grid_cell *grid_view_peek_cell(struct grid *, u_int, u_int);
|
|
|
|
struct grid_cell *grid_view_get_cell(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_set_cell(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct grid *, u_int, u_int, const struct grid_cell *);
|
2011-01-26 00:40:26 +01:00
|
|
|
void grid_view_clear_history(struct grid *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_up(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_down(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_insert_lines(struct grid *, u_int, u_int);
|
2009-07-09 02:29:32 +02:00
|
|
|
void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void grid_view_delete_lines(struct grid *, u_int, u_int);
|
2009-07-09 02:29:32 +02:00
|
|
|
void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void grid_view_insert_cells(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_cells(struct grid *, u_int, u_int, u_int);
|
2009-06-25 00:04:18 +02:00
|
|
|
char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* screen-write.c */
|
|
|
|
void screen_write_start(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct screen_write_ctx *, struct window_pane *, struct screen *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_stop(struct screen_write_ctx *);
|
2012-01-21 09:10:21 +01:00
|
|
|
void screen_write_reset(struct screen_write_ctx *);
|
2009-09-07 12:49:32 +02:00
|
|
|
size_t printflike2 screen_write_cstrlen(int, const char *, ...);
|
|
|
|
void printflike5 screen_write_cnputs(struct screen_write_ctx *,
|
2009-12-03 23:50:09 +01:00
|
|
|
ssize_t, struct grid_cell *, int, const char *, ...);
|
2009-06-03 18:54:26 +02:00
|
|
|
size_t printflike2 screen_write_strlen(int, const char *, ...);
|
2009-06-03 18:05:46 +02:00
|
|
|
void printflike3 screen_write_puts(struct screen_write_ctx *,
|
2009-12-03 23:50:09 +01:00
|
|
|
struct grid_cell *, const char *, ...);
|
2009-06-03 18:54:26 +02:00
|
|
|
void printflike5 screen_write_nputs(struct screen_write_ctx *,
|
2009-12-03 23:50:09 +01:00
|
|
|
ssize_t, struct grid_cell *, int, const char *, ...);
|
2009-06-03 18:05:46 +02:00
|
|
|
void screen_write_vnputs(struct screen_write_ctx *,
|
2009-06-03 18:54:26 +02:00
|
|
|
ssize_t, struct grid_cell *, int, const char *, va_list);
|
2009-09-07 12:49:32 +02:00
|
|
|
void screen_write_parsestyle(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct grid_cell *, struct grid_cell *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_putc(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct screen_write_ctx *, struct grid_cell *, u_char);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_copy(struct screen_write_ctx *,
|
|
|
|
struct screen *, u_int, u_int, u_int, u_int);
|
2009-10-12 18:59:55 +02:00
|
|
|
void screen_write_backspace(struct screen_write_ctx *);
|
2013-03-21 19:47:56 +01:00
|
|
|
void screen_write_mode_set(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_mode_clear(struct screen_write_ctx *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_cursorup(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursordown(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursorright(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_cursorleft(struct screen_write_ctx *, u_int);
|
2009-06-04 01:30:40 +02:00
|
|
|
void screen_write_alignmenttest(struct screen_write_ctx *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_insertcharacter(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_deletecharacter(struct screen_write_ctx *, u_int);
|
2013-01-16 00:18:55 +01:00
|
|
|
void screen_write_clearcharacter(struct screen_write_ctx *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_insertline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_deleteline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearline(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearendofline(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearstartofline(struct screen_write_ctx *);
|
|
|
|
void screen_write_cursormove(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_reverseindex(struct screen_write_ctx *);
|
|
|
|
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
|
2009-08-08 17:57:49 +02:00
|
|
|
void screen_write_linefeed(struct screen_write_ctx *, int);
|
2009-10-12 19:19:47 +02:00
|
|
|
void screen_write_linefeedscreen(struct screen_write_ctx *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_write_carriagereturn(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearendofscreen(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearstartofscreen(struct screen_write_ctx *);
|
|
|
|
void screen_write_clearscreen(struct screen_write_ctx *);
|
2011-10-23 12:16:14 +02:00
|
|
|
void screen_write_clearhistory(struct screen_write_ctx *);
|
2013-01-18 03:16:21 +01:00
|
|
|
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
2011-05-18 22:24:29 +02:00
|
|
|
void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
|
2011-03-08 00:46:27 +01:00
|
|
|
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* screen-redraw.c */
|
2010-01-03 13:51:05 +01:00
|
|
|
void screen_redraw_screen(struct client *, int, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_redraw_pane(struct client *, struct window_pane *);
|
|
|
|
|
|
|
|
/* screen.c */
|
|
|
|
void screen_init(struct screen *, u_int, u_int, u_int);
|
|
|
|
void screen_reinit(struct screen *);
|
|
|
|
void screen_free(struct screen *);
|
2009-06-04 20:48:24 +02:00
|
|
|
void screen_reset_tabs(struct screen *);
|
2011-05-20 21:17:39 +02:00
|
|
|
void screen_set_cursor_style(struct screen *, u_int);
|
2011-05-20 21:03:58 +02:00
|
|
|
void screen_set_cursor_colour(struct screen *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_set_title(struct screen *, const char *);
|
2013-02-05 12:08:59 +01:00
|
|
|
void screen_resize(struct screen *, u_int, u_int, int);
|
2010-02-06 18:35:01 +01:00
|
|
|
void screen_set_selection(struct screen *,
|
|
|
|
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void screen_clear_selection(struct screen *);
|
|
|
|
int screen_check_selection(struct screen *, u_int, u_int);
|
2013-02-05 12:08:59 +01:00
|
|
|
void screen_reflow(struct screen *, u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* window.c */
|
|
|
|
extern struct windows windows;
|
2011-03-27 22:27:26 +02:00
|
|
|
extern struct window_pane_tree all_window_panes;
|
2009-06-02 00:58:49 +02:00
|
|
|
int winlink_cmp(struct winlink *, struct winlink *);
|
|
|
|
RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
|
2011-03-27 22:27:26 +02:00
|
|
|
int window_pane_cmp(struct window_pane *, struct window_pane *);
|
|
|
|
RB_PROTOTYPE(window_pane_tree, window_pane, tree_entry, window_pane_cmp);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct winlink *winlink_find_by_index(struct winlinks *, int);
|
2009-12-03 23:50:09 +01:00
|
|
|
struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
|
2012-01-30 10:39:34 +01:00
|
|
|
struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
|
2009-08-13 22:11:58 +02:00
|
|
|
int winlink_next_index(struct winlinks *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
u_int winlink_count(struct winlinks *);
|
2011-01-25 23:31:50 +01:00
|
|
|
struct winlink *winlink_add(struct winlinks *, int);
|
|
|
|
void winlink_set_window(struct winlink *, struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void winlink_remove(struct winlinks *, struct winlink *);
|
2009-11-26 22:37:13 +01:00
|
|
|
struct winlink *winlink_next(struct winlink *);
|
|
|
|
struct winlink *winlink_previous(struct winlink *);
|
2010-07-14 20:37:49 +02:00
|
|
|
struct winlink *winlink_next_by_number(struct winlink *, struct session *,
|
|
|
|
int);
|
|
|
|
struct winlink *winlink_previous_by_number(struct winlink *, struct session *,
|
|
|
|
int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void winlink_stack_push(struct winlink_stack *, struct winlink *);
|
|
|
|
void winlink_stack_remove(struct winlink_stack *, struct winlink *);
|
2009-12-03 23:50:09 +01:00
|
|
|
int window_index(struct window *, u_int *);
|
2012-01-30 10:39:34 +01:00
|
|
|
struct window *window_find_by_id(u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window *window_create1(u_int, u_int);
|
2009-08-08 23:52:43 +02:00
|
|
|
struct window *window_create(const char *, const char *, const char *,
|
2009-09-01 15:09:49 +02:00
|
|
|
const char *, struct environ *, struct termios *,
|
2009-12-03 23:50:09 +01:00
|
|
|
u_int, u_int, u_int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
void window_destroy(struct window *);
|
2011-06-05 12:53:05 +02:00
|
|
|
struct window_pane *window_get_active_at(struct window *, u_int, u_int);
|
2009-10-10 16:51:16 +02:00
|
|
|
void window_set_active_at(struct window *, u_int, u_int);
|
2011-06-05 12:53:05 +02:00
|
|
|
struct window_pane *window_find_string(struct window *, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void window_set_active_pane(struct window *, struct window_pane *);
|
2009-07-22 23:34:36 +02:00
|
|
|
struct window_pane *window_add_pane(struct window *, u_int);
|
2009-07-21 21:54:22 +02:00
|
|
|
void window_resize(struct window *, u_int, u_int);
|
2013-03-24 10:58:40 +01:00
|
|
|
int window_zoom(struct window_pane *);
|
|
|
|
int window_unzoom(struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void window_remove_pane(struct window *, struct window_pane *);
|
|
|
|
struct window_pane *window_pane_at_index(struct window *, u_int);
|
2010-07-14 20:37:49 +02:00
|
|
|
struct window_pane *window_pane_next_by_number(struct window *,
|
|
|
|
struct window_pane *, u_int);
|
|
|
|
struct window_pane *window_pane_previous_by_number(struct window *,
|
|
|
|
struct window_pane *, u_int);
|
2011-11-16 00:19:51 +01:00
|
|
|
int window_pane_index(struct window_pane *, u_int *);
|
2009-06-02 00:58:49 +02:00
|
|
|
u_int window_count_panes(struct window *);
|
|
|
|
void window_destroy_panes(struct window *);
|
2011-03-27 22:27:26 +02:00
|
|
|
struct window_pane *window_pane_find_by_id(u_int);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int);
|
|
|
|
void window_pane_destroy(struct window_pane *);
|
2012-03-20 12:01:00 +01:00
|
|
|
void window_pane_timer_start(struct window_pane *);
|
2009-08-13 21:03:59 +02:00
|
|
|
int window_pane_spawn(struct window_pane *, const char *,
|
2009-09-01 15:09:49 +02:00
|
|
|
const char *, const char *, struct environ *,
|
|
|
|
struct termios *, char **);
|
2009-07-21 21:54:22 +02:00
|
|
|
void window_pane_resize(struct window_pane *, u_int, u_int);
|
2012-11-27 21:08:42 +01:00
|
|
|
void window_pane_alternate_on(struct window_pane *,
|
|
|
|
struct grid_cell *, int);
|
|
|
|
void window_pane_alternate_off(struct window_pane *,
|
|
|
|
struct grid_cell *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
int window_pane_set_mode(
|
|
|
|
struct window_pane *, const struct window_mode *);
|
|
|
|
void window_pane_reset_mode(struct window_pane *);
|
2010-05-23 21:42:19 +02:00
|
|
|
void window_pane_key(struct window_pane *, struct session *, int);
|
2009-06-02 00:58:49 +02:00
|
|
|
void window_pane_mouse(struct window_pane *,
|
2010-05-23 21:42:19 +02:00
|
|
|
struct session *, struct mouse_event *);
|
2009-07-14 09:23:36 +02:00
|
|
|
int window_pane_visible(struct window_pane *);
|
2009-06-25 00:49:56 +02:00
|
|
|
char *window_pane_search(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct window_pane *, const char *, u_int *);
|
2010-12-30 22:35:17 +01:00
|
|
|
char *window_printable_flags(struct session *, struct winlink *);
|
2010-03-22 20:07:52 +01:00
|
|
|
struct window_pane *window_pane_find_up(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_down(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_left(struct window_pane *);
|
|
|
|
struct window_pane *window_pane_find_right(struct window_pane *);
|
2012-02-02 01:10:11 +01:00
|
|
|
void window_set_name(struct window *, const char *);
|
2012-08-21 12:00:33 +02:00
|
|
|
void window_remove_ref(struct window *);
|
2012-07-08 09:27:32 +02:00
|
|
|
void winlink_clear_flags(struct winlink *);
|
2012-08-11 08:45:33 +02:00
|
|
|
void window_mode_attrs(struct grid_cell *, struct options *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* layout.c */
|
2010-06-29 05:30:13 +02:00
|
|
|
u_int layout_count_cells(struct layout_cell *);
|
2009-07-19 15:21:40 +02:00
|
|
|
struct layout_cell *layout_create_cell(struct layout_cell *);
|
|
|
|
void layout_free_cell(struct layout_cell *);
|
|
|
|
void layout_print_cell(struct layout_cell *, const char *, u_int);
|
2013-01-17 01:11:22 +01:00
|
|
|
void layout_destroy_cell(struct layout_cell *, struct layout_cell **);
|
2009-07-19 15:21:40 +02:00
|
|
|
void layout_set_size(
|
|
|
|
struct layout_cell *, u_int, u_int, u_int, u_int);
|
|
|
|
void layout_make_leaf(
|
|
|
|
struct layout_cell *, struct window_pane *);
|
|
|
|
void layout_make_node(struct layout_cell *, enum layout_type);
|
|
|
|
void layout_fix_offsets(struct layout_cell *);
|
|
|
|
void layout_fix_panes(struct window *, u_int, u_int);
|
|
|
|
u_int layout_resize_check(struct layout_cell *, enum layout_type);
|
|
|
|
void layout_resize_adjust(
|
|
|
|
struct layout_cell *, enum layout_type, int);
|
2013-03-24 10:58:40 +01:00
|
|
|
void layout_init(struct window *, struct window_pane *);
|
2009-07-19 15:21:40 +02:00
|
|
|
void layout_free(struct window *);
|
|
|
|
void layout_resize(struct window *, u_int, u_int);
|
2013-03-22 11:37:39 +01:00
|
|
|
void layout_resize_pane(struct window_pane *, enum layout_type,
|
|
|
|
int);
|
|
|
|
void layout_resize_pane_to(struct window_pane *, enum layout_type,
|
|
|
|
u_int);
|
|
|
|
void layout_resize_pane_mouse(struct client *);
|
2010-01-07 21:52:18 +01:00
|
|
|
void layout_assign_pane(struct layout_cell *, struct window_pane *);
|
|
|
|
struct layout_cell *layout_split_pane(
|
2012-03-03 09:31:18 +01:00
|
|
|
struct window_pane *, enum layout_type, int, int);
|
2009-07-19 15:21:40 +02:00
|
|
|
void layout_close_pane(struct window_pane *);
|
|
|
|
|
2010-06-29 05:30:13 +02:00
|
|
|
/* layout-custom.c */
|
|
|
|
char *layout_dump(struct window *);
|
|
|
|
int layout_parse(struct window *, const char *);
|
|
|
|
|
2009-07-19 15:21:40 +02:00
|
|
|
/* layout-set.c */
|
|
|
|
const char *layout_set_name(u_int);
|
|
|
|
int layout_set_lookup(const char *);
|
|
|
|
u_int layout_set_select(struct window *, u_int);
|
|
|
|
u_int layout_set_next(struct window *);
|
|
|
|
u_int layout_set_previous(struct window *);
|
|
|
|
void layout_set_active_changed(struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* window-clock.c */
|
|
|
|
extern const struct window_mode window_clock_mode;
|
|
|
|
|
|
|
|
/* window-copy.c */
|
|
|
|
extern const struct window_mode window_copy_mode;
|
2010-04-06 23:35:44 +02:00
|
|
|
void window_copy_init_from_pane(struct window_pane *);
|
|
|
|
void window_copy_init_for_output(struct window_pane *);
|
2012-03-02 12:16:44 +01:00
|
|
|
void printflike2 window_copy_add(struct window_pane *, const char *, ...);
|
2010-04-06 23:35:44 +02:00
|
|
|
void window_copy_vadd(struct window_pane *, const char *, va_list);
|
2009-12-03 23:50:09 +01:00
|
|
|
void window_copy_pageup(struct window_pane *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* window-choose.c */
|
|
|
|
extern const struct window_mode window_choose_mode;
|
2012-06-25 16:08:55 +02:00
|
|
|
void window_choose_add(struct window_pane *,
|
|
|
|
struct window_choose_data *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void window_choose_ready(struct window_pane *,
|
2013-03-21 17:09:59 +01:00
|
|
|
u_int, void (*)(struct window_choose_data *));
|
|
|
|
struct window_choose_data *window_choose_data_create (int,
|
|
|
|
struct client *, struct session *);
|
|
|
|
void window_choose_data_free(struct window_choose_data *);
|
|
|
|
void window_choose_data_run(struct window_choose_data *);
|
2012-06-25 16:27:25 +02:00
|
|
|
struct window_choose_data *window_choose_add_window(struct window_pane *,
|
2013-03-21 17:09:59 +01:00
|
|
|
struct client *, struct session *, struct winlink *,
|
2013-03-21 17:19:25 +01:00
|
|
|
const char *, const char *, u_int);
|
2012-06-25 16:27:25 +02:00
|
|
|
struct window_choose_data *window_choose_add_session(struct window_pane *,
|
2013-03-21 17:09:59 +01:00
|
|
|
struct client *, struct session *, const char *,
|
2013-03-21 17:19:25 +01:00
|
|
|
const char *, u_int);
|
2012-09-03 11:57:57 +02:00
|
|
|
struct window_choose_data *window_choose_add_item(struct window_pane *,
|
2013-03-21 17:09:59 +01:00
|
|
|
struct client *, struct winlink *, const char *,
|
2013-03-21 17:19:25 +01:00
|
|
|
const char *, u_int);
|
2012-12-24 13:33:05 +01:00
|
|
|
void window_choose_expand_all(struct window_pane *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* names.c */
|
2009-11-05 00:54:57 +01:00
|
|
|
void queue_window_name(struct window *);
|
2009-12-03 23:50:09 +01:00
|
|
|
char *default_window_name(struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
2010-05-04 19:28:16 +02:00
|
|
|
/* signal.c */
|
2012-07-13 08:27:41 +02:00
|
|
|
void set_signals(void(*)(int, short, void *));
|
|
|
|
void clear_signals(int);
|
2010-05-04 19:28:16 +02:00
|
|
|
|
2012-06-18 15:16:42 +02:00
|
|
|
/* control.c */
|
2012-07-13 08:27:41 +02:00
|
|
|
void control_callback(struct client *, int, void*);
|
2012-09-03 11:32:38 +02:00
|
|
|
void printflike2 control_write(struct client *, const char *, ...);
|
2012-09-24 15:39:10 +02:00
|
|
|
void control_write_buffer(struct client *, struct evbuffer *);
|
2012-09-03 11:32:38 +02:00
|
|
|
|
|
|
|
/* control-notify.c */
|
2012-09-25 09:41:22 +02:00
|
|
|
void control_notify_input(struct client *, struct window_pane *,
|
|
|
|
struct evbuffer *);
|
2012-09-03 11:32:38 +02:00
|
|
|
void control_notify_window_layout_changed(struct window *);
|
|
|
|
void control_notify_window_unlinked(struct session *, struct window *);
|
|
|
|
void control_notify_window_linked(struct session *, struct window *);
|
|
|
|
void control_notify_window_renamed(struct window *);
|
|
|
|
void control_notify_attached_session_changed(struct client *);
|
|
|
|
void control_notify_session_renamed(struct session *);
|
|
|
|
void control_notify_session_created(struct session *);
|
|
|
|
void control_notify_session_close(struct session *);
|
2012-06-18 15:16:42 +02:00
|
|
|
|
2009-06-02 00:58:49 +02:00
|
|
|
/* session.c */
|
|
|
|
extern struct sessions sessions;
|
2009-09-07 23:01:50 +02:00
|
|
|
extern struct sessions dead_sessions;
|
2009-10-10 12:02:48 +02:00
|
|
|
extern struct session_groups session_groups;
|
2010-12-21 23:37:59 +01:00
|
|
|
int session_cmp(struct session *, struct session *);
|
|
|
|
RB_PROTOTYPE(sessions, session, entry, session_cmp);
|
2010-12-20 01:03:55 +01:00
|
|
|
int session_alive(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct session *session_find(const char *);
|
2013-03-25 11:11:45 +01:00
|
|
|
struct session *session_find_by_id(u_int);
|
2009-08-13 21:03:59 +02:00
|
|
|
struct session *session_create(const char *, const char *, const char *,
|
2009-08-13 22:11:58 +02:00
|
|
|
struct environ *, struct termios *, int, u_int, u_int,
|
|
|
|
char **);
|
2009-12-03 23:50:09 +01:00
|
|
|
void session_destroy(struct session *);
|
2011-04-06 23:51:31 +02:00
|
|
|
int session_check_name(const char *);
|
2011-01-01 02:12:09 +01:00
|
|
|
void session_update_activity(struct session *);
|
2010-09-09 00:02:28 +02:00
|
|
|
struct session *session_next_session(struct session *);
|
|
|
|
struct session *session_previous_session(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct winlink *session_new(struct session *,
|
2009-12-03 23:50:09 +01:00
|
|
|
const char *, const char *, const char *, int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
struct winlink *session_attach(
|
2009-12-03 23:50:09 +01:00
|
|
|
struct session *, struct window *, int, char **);
|
2009-06-02 00:58:49 +02:00
|
|
|
int session_detach(struct session *, struct winlink *);
|
2010-06-21 03:27:46 +02:00
|
|
|
struct winlink* session_has(struct session *, struct window *);
|
2009-06-02 00:58:49 +02:00
|
|
|
int session_next(struct session *, int);
|
|
|
|
int session_previous(struct session *, int);
|
|
|
|
int session_select(struct session *, int);
|
|
|
|
int session_last(struct session *);
|
2013-03-22 17:00:26 +01:00
|
|
|
int session_set_current(struct session *, struct winlink *);
|
2009-10-10 12:02:48 +02:00
|
|
|
struct session_group *session_group_find(struct session *);
|
|
|
|
u_int session_group_index(struct session_group *);
|
|
|
|
void session_group_add(struct session *, struct session *);
|
|
|
|
void session_group_remove(struct session *);
|
|
|
|
void session_group_synchronize_to(struct session *);
|
|
|
|
void session_group_synchronize_from(struct session *);
|
|
|
|
void session_group_synchronize1(struct session *, struct session *);
|
2012-04-29 19:20:01 +02:00
|
|
|
void session_renumber_windows(struct session *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* utf8.c */
|
|
|
|
void utf8_build(void);
|
2009-10-20 21:18:28 +02:00
|
|
|
int utf8_open(struct utf8_data *, u_char);
|
|
|
|
int utf8_append(struct utf8_data *, u_char);
|
2011-01-04 00:35:21 +01:00
|
|
|
u_int utf8_combine(const struct utf8_data *);
|
|
|
|
u_int utf8_split2(u_int, u_char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* procname.c */
|
|
|
|
char *get_proc_name(int, char *);
|
2012-09-24 15:05:10 +02:00
|
|
|
char *get_proc_cwd(int);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* log.c */
|
2012-05-25 10:28:10 +02:00
|
|
|
void log_open(int, const char *);
|
2009-06-02 00:58:49 +02:00
|
|
|
void log_close(void);
|
|
|
|
void printflike1 log_warn(const char *, ...);
|
|
|
|
void printflike1 log_warnx(const char *, ...);
|
|
|
|
void printflike1 log_info(const char *, ...);
|
|
|
|
void printflike1 log_debug(const char *, ...);
|
|
|
|
void printflike1 log_debug2(const char *, ...);
|
2009-08-18 16:48:42 +02:00
|
|
|
__dead void printflike1 log_fatal(const char *, ...);
|
|
|
|
__dead void printflike1 log_fatalx(const char *, ...);
|
2009-06-02 00:58:49 +02:00
|
|
|
|
|
|
|
/* xmalloc.c */
|
|
|
|
char *xstrdup(const char *);
|
|
|
|
void *xcalloc(size_t, size_t);
|
|
|
|
void *xmalloc(size_t);
|
|
|
|
void *xrealloc(void *, size_t, size_t);
|
|
|
|
int printflike2 xasprintf(char **, const char *, ...);
|
|
|
|
int xvasprintf(char **, const char *, va_list);
|
|
|
|
int printflike3 xsnprintf(char *, size_t, const char *, ...);
|
|
|
|
int xvsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
|
|
|
|
#endif /* TMUX_H */
|