2009-06-01 22:58:49 +00:00
|
|
|
/* $OpenBSD$ */
|
|
|
|
|
|
|
|
/*
|
2016-01-19 15:59:12 +00:00
|
|
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
2009-06-01 22:58:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2013-10-10 12:13:56 +00:00
|
|
|
#define PROTOCOL_VERSION 8
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/tree.h>
|
|
|
|
|
2009-06-04 18:48:24 +00:00
|
|
|
#include <bitstring.h>
|
2009-11-04 20:50:11 +00:00
|
|
|
#include <event.h>
|
2009-06-01 22:58:49 +00:00
|
|
|
#include <limits.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <termios.h>
|
2016-03-01 12:02:08 +00:00
|
|
|
#include <wchar.h>
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-19 22:46:46 +00:00
|
|
|
#include "xmalloc.h"
|
|
|
|
|
2009-08-08 21:52:43 +00:00
|
|
|
extern char **environ;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-10-11 07:23:34 +00:00
|
|
|
struct args;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct client;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_item;
|
|
|
|
struct cmdq_list;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ;
|
|
|
|
struct input_ctx;
|
2016-10-11 13:45:47 +00:00
|
|
|
struct mode_key_cmdstr;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct mouse_event;
|
|
|
|
struct options;
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry;
|
2015-10-28 09:51:55 +00:00
|
|
|
struct session;
|
|
|
|
struct tmuxpeer;
|
|
|
|
struct tmuxproc;
|
|
|
|
|
2013-04-24 10:01:32 +00:00
|
|
|
/* Default global configuration file. */
|
|
|
|
#define TMUX_CONF "/etc/tmux.conf"
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-12-14 10:43:41 +00:00
|
|
|
/*
|
2009-07-19 13:21:40 +00: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-01 22:58:49 +00:00
|
|
|
|
2015-08-29 00:29:15 +00:00
|
|
|
/* Automatic name refresh interval, in microseconds. Must be < 1 second. */
|
|
|
|
#define NAME_INTERVAL 500000
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2017-02-08 08:25:12 +00:00
|
|
|
/* Maximum size of data to hold from a pane. */
|
|
|
|
#define READ_SIZE 4096
|
2015-05-12 22:40:38 +00:00
|
|
|
|
2017-01-09 19:27:00 +00:00
|
|
|
/* Attribute to make GCC check printf-like arguments. */
|
2014-10-20 23:57:13 +00:00
|
|
|
#define printflike(a, b) __attribute__ ((format (printf, a, b)))
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* Number of items in array. */
|
2009-06-25 22:08:15 +00:00
|
|
|
#ifndef nitems
|
2009-06-01 22:58:49 +00:00
|
|
|
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
2009-06-25 22:08:15 +00:00
|
|
|
#endif
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* Bell option values. */
|
|
|
|
#define BELL_NONE 0
|
|
|
|
#define BELL_ANY 1
|
|
|
|
#define BELL_CURRENT 2
|
2015-05-12 15:27:46 +00:00
|
|
|
#define BELL_OTHER 3
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-11-10 17:41:35 +00:00
|
|
|
/* Special key codes. */
|
2015-11-12 11:05:34 +00:00
|
|
|
#define KEYC_NONE 0xffff00000000ULL
|
2015-12-12 18:19:00 +00:00
|
|
|
#define KEYC_UNKNOWN 0xfffe00000000ULL
|
2016-11-04 14:47:38 +00:00
|
|
|
#define KEYC_BASE 0x000010000000ULL
|
2009-11-10 17:41:35 +00:00
|
|
|
|
|
|
|
/* Key modifier bits. */
|
2015-11-12 11:05:34 +00:00
|
|
|
#define KEYC_ESCAPE 0x200000000000ULL
|
|
|
|
#define KEYC_CTRL 0x400000000000ULL
|
|
|
|
#define KEYC_SHIFT 0x800000000000ULL
|
2009-07-21 17:57:29 +00:00
|
|
|
|
2011-03-27 20:31:25 +00:00
|
|
|
/* Mask to obtain key w/o modifiers. */
|
2015-04-20 15:34:56 +00:00
|
|
|
#define KEYC_MASK_MOD (KEYC_ESCAPE|KEYC_CTRL|KEYC_SHIFT)
|
2010-06-06 19:00:13 +00:00
|
|
|
#define KEYC_MASK_KEY (~KEYC_MASK_MOD)
|
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Is this a mouse key? */
|
|
|
|
#define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \
|
|
|
|
((key) & KEYC_MASK_KEY) < KEYC_BSPACE)
|
|
|
|
|
2016-10-11 09:30:36 +00:00
|
|
|
/* Multiple click timeout. */
|
|
|
|
#define KEYC_CLICK_TIMEOUT 300
|
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse key codes. */
|
|
|
|
#define KEYC_MOUSE_KEY(name) \
|
|
|
|
KEYC_ ## name ## _PANE, \
|
|
|
|
KEYC_ ## name ## _STATUS, \
|
|
|
|
KEYC_ ## name ## _BORDER
|
|
|
|
#define KEYC_MOUSE_STRING(name, s) \
|
|
|
|
{ #s "Pane", KEYC_ ## name ## _PANE }, \
|
|
|
|
{ #s "Status", KEYC_ ## name ## _STATUS }, \
|
|
|
|
{ #s "Border", KEYC_ ## name ## _BORDER }
|
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
/*
|
|
|
|
* A single key. This can be ASCII or Unicode or one of the keys starting at
|
|
|
|
* KEYC_BASE.
|
|
|
|
*/
|
2015-11-15 22:50:38 +00:00
|
|
|
typedef unsigned long long key_code;
|
2015-11-12 11:05:34 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Special key codes. */
|
2015-11-12 11:05:34 +00:00
|
|
|
enum {
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Focus events. */
|
|
|
|
KEYC_FOCUS_IN = KEYC_BASE,
|
|
|
|
KEYC_FOCUS_OUT,
|
|
|
|
|
|
|
|
/* Mouse keys. */
|
|
|
|
KEYC_MOUSE, /* unclassified mouse event */
|
2016-11-24 18:45:45 +00:00
|
|
|
KEYC_DRAGGING, /* dragging in progress */
|
2017-02-01 09:55:07 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEMOVE),
|
2015-04-19 21:34:21 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDOWN3),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEUP3),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAG3),
|
2016-03-18 07:28:27 +00:00
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND1),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND2),
|
|
|
|
KEYC_MOUSE_KEY(MOUSEDRAGEND3),
|
2015-04-19 21:34:21 +00:00
|
|
|
KEYC_MOUSE_KEY(WHEELUP),
|
|
|
|
KEYC_MOUSE_KEY(WHEELDOWN),
|
2016-10-11 09:30:36 +00:00
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK1),
|
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK2),
|
|
|
|
KEYC_MOUSE_KEY(DOUBLECLICK3),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK1),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK2),
|
|
|
|
KEYC_MOUSE_KEY(TRIPLECLICK3),
|
2009-07-21 17:57:29 +00:00
|
|
|
|
2009-07-26 21:42:08 +00:00
|
|
|
/* Backspace key. */
|
|
|
|
KEYC_BSPACE,
|
|
|
|
|
2009-07-21 17:57:29 +00: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_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 13:13:33 +00: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,
|
2009-07-21 17:57:29 +00:00
|
|
|
};
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* Termcap codes. */
|
|
|
|
enum tty_code_code {
|
|
|
|
TTYC_AX = 0,
|
|
|
|
TTYC_ACSC, /* acs_chars, ac */
|
2015-04-19 21:05:27 +00:00
|
|
|
TTYC_BCE, /* back_color_erase, ut */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_BEL, /* bell, bl */
|
|
|
|
TTYC_BLINK, /* enter_blink_mode, mb */
|
|
|
|
TTYC_BOLD, /* enter_bold_mode, md */
|
|
|
|
TTYC_CIVIS, /* cursor_invisible, vi */
|
|
|
|
TTYC_CLEAR, /* clear_screen, cl */
|
|
|
|
TTYC_CNORM, /* cursor_normal, ve */
|
|
|
|
TTYC_COLORS, /* max_colors, Co */
|
2011-05-20 19:03:58 +00:00
|
|
|
TTYC_CR, /* restore cursor colour, Cr */
|
2013-06-02 07:52:15 +00:00
|
|
|
TTYC_CS, /* set cursor colour, Cs */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_CSR, /* change_scroll_region, cs */
|
2009-10-12 13:01:18 +00:00
|
|
|
TTYC_CUB, /* parm_left_cursor, LE */
|
|
|
|
TTYC_CUB1, /* cursor_left, le */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_CUD, /* parm_down_cursor, DO */
|
|
|
|
TTYC_CUD1, /* cursor_down, do */
|
2009-10-12 13:01:18 +00:00
|
|
|
TTYC_CUF, /* parm_right_cursor, RI */
|
|
|
|
TTYC_CUF1, /* cursor_right, nd */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_CUP, /* cursor_address, cm */
|
2009-10-12 13:01:18 +00:00
|
|
|
TTYC_CUU, /* parm_up_cursor, UP */
|
|
|
|
TTYC_CUU1, /* cursor_up, up */
|
2015-01-20 08:18:04 +00:00
|
|
|
TTYC_CVVIS, /* cursor_visible, vs */
|
2009-06-01 22:58:49 +00: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 10:16:14 +00:00
|
|
|
TTYC_E3,
|
2013-01-15 23:18:55 +00:00
|
|
|
TTYC_ECH, /* erase_chars, ec */
|
2017-02-08 08:25:12 +00:00
|
|
|
TTYC_ED, /* clr_eos, cd */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_EL, /* clr_eol, ce */
|
|
|
|
TTYC_EL1, /* clr_bol, cb */
|
|
|
|
TTYC_ENACS, /* ena_acs, eA */
|
2011-05-08 19:53:06 +00:00
|
|
|
TTYC_FSL, /* from_status_line, fsl */
|
2009-10-12 13:01:18 +00:00
|
|
|
TTYC_HOME, /* cursor_home, ho */
|
|
|
|
TTYC_HPA, /* column_address, ch */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_ICH, /* parm_ich, IC */
|
|
|
|
TTYC_ICH1, /* insert_character, ic */
|
|
|
|
TTYC_IL, /* parm_insert_line, IL */
|
|
|
|
TTYC_IL1, /* insert_line, il */
|
2017-02-08 17:31:09 +00:00
|
|
|
TTYC_INDN, /* parm_index, indn */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_INVIS, /* enter_secure_mode, mk */
|
|
|
|
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 16:00:51 +00:00
|
|
|
TTYC_KDC2,
|
|
|
|
TTYC_KDC3,
|
|
|
|
TTYC_KDC4,
|
|
|
|
TTYC_KDC5,
|
|
|
|
TTYC_KDC6,
|
|
|
|
TTYC_KDC7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KDCH1, /* key_dc, kD */
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KDN2,
|
|
|
|
TTYC_KDN3,
|
|
|
|
TTYC_KDN4,
|
|
|
|
TTYC_KDN5,
|
|
|
|
TTYC_KDN6,
|
|
|
|
TTYC_KDN7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KEND, /* key_end, ke */
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KEND2,
|
|
|
|
TTYC_KEND3,
|
|
|
|
TTYC_KEND4,
|
|
|
|
TTYC_KEND5,
|
|
|
|
TTYC_KEND6,
|
|
|
|
TTYC_KEND7,
|
2014-07-21 10:25:48 +00:00
|
|
|
TTYC_KF1,
|
|
|
|
TTYC_KF10,
|
|
|
|
TTYC_KF11,
|
|
|
|
TTYC_KF12,
|
|
|
|
TTYC_KF13,
|
|
|
|
TTYC_KF14,
|
|
|
|
TTYC_KF15,
|
|
|
|
TTYC_KF16,
|
|
|
|
TTYC_KF17,
|
|
|
|
TTYC_KF18,
|
|
|
|
TTYC_KF19,
|
|
|
|
TTYC_KF2,
|
|
|
|
TTYC_KF20,
|
|
|
|
TTYC_KF21,
|
|
|
|
TTYC_KF22,
|
|
|
|
TTYC_KF23,
|
|
|
|
TTYC_KF24,
|
|
|
|
TTYC_KF25,
|
|
|
|
TTYC_KF26,
|
|
|
|
TTYC_KF27,
|
|
|
|
TTYC_KF28,
|
|
|
|
TTYC_KF29,
|
|
|
|
TTYC_KF3,
|
|
|
|
TTYC_KF30,
|
|
|
|
TTYC_KF31,
|
|
|
|
TTYC_KF32,
|
|
|
|
TTYC_KF33,
|
|
|
|
TTYC_KF34,
|
|
|
|
TTYC_KF35,
|
|
|
|
TTYC_KF36,
|
|
|
|
TTYC_KF37,
|
|
|
|
TTYC_KF38,
|
|
|
|
TTYC_KF39,
|
|
|
|
TTYC_KF4,
|
|
|
|
TTYC_KF40,
|
|
|
|
TTYC_KF41,
|
|
|
|
TTYC_KF42,
|
|
|
|
TTYC_KF43,
|
|
|
|
TTYC_KF44,
|
|
|
|
TTYC_KF45,
|
|
|
|
TTYC_KF46,
|
|
|
|
TTYC_KF47,
|
|
|
|
TTYC_KF48,
|
|
|
|
TTYC_KF49,
|
|
|
|
TTYC_KF5,
|
|
|
|
TTYC_KF50,
|
|
|
|
TTYC_KF51,
|
|
|
|
TTYC_KF52,
|
|
|
|
TTYC_KF53,
|
|
|
|
TTYC_KF54,
|
|
|
|
TTYC_KF55,
|
|
|
|
TTYC_KF56,
|
|
|
|
TTYC_KF57,
|
|
|
|
TTYC_KF58,
|
|
|
|
TTYC_KF59,
|
|
|
|
TTYC_KF6,
|
|
|
|
TTYC_KF60,
|
|
|
|
TTYC_KF61,
|
|
|
|
TTYC_KF62,
|
|
|
|
TTYC_KF63,
|
|
|
|
TTYC_KF7,
|
|
|
|
TTYC_KF8,
|
|
|
|
TTYC_KF9,
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KHOM2,
|
|
|
|
TTYC_KHOM3,
|
|
|
|
TTYC_KHOM4,
|
|
|
|
TTYC_KHOM5,
|
|
|
|
TTYC_KHOM6,
|
|
|
|
TTYC_KHOM7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KHOME, /* key_home, kh */
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KIC2,
|
|
|
|
TTYC_KIC3,
|
|
|
|
TTYC_KIC4,
|
|
|
|
TTYC_KIC5,
|
|
|
|
TTYC_KIC6,
|
|
|
|
TTYC_KIC7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KICH1, /* key_ic, kI */
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KLFT2,
|
|
|
|
TTYC_KLFT3,
|
|
|
|
TTYC_KLFT4,
|
|
|
|
TTYC_KLFT5,
|
|
|
|
TTYC_KLFT6,
|
|
|
|
TTYC_KLFT7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KMOUS, /* key_mouse, Km */
|
|
|
|
TTYC_KNP, /* key_npage, kN */
|
2009-10-26 16:00:51 +00:00
|
|
|
TTYC_KNXT2,
|
|
|
|
TTYC_KNXT3,
|
|
|
|
TTYC_KNXT4,
|
|
|
|
TTYC_KNXT5,
|
|
|
|
TTYC_KNXT6,
|
|
|
|
TTYC_KNXT7,
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_KPP, /* key_ppage, kP */
|
2009-10-26 16:00:51 +00: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 20:24:29 +00:00
|
|
|
TTYC_MS, /* modify xterm(1) selection */
|
2009-06-01 22:58:49 +00: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 */
|
2013-06-02 07:52:15 +00:00
|
|
|
TTYC_SE, /* reset cursor style, Se */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_SETAB, /* set_a_background, AB */
|
|
|
|
TTYC_SETAF, /* set_a_foreground, AF */
|
|
|
|
TTYC_SGR0, /* exit_attribute_mode, me */
|
2011-05-08 19:53:06 +00:00
|
|
|
TTYC_SITM, /* enter_italics_mode, it */
|
2009-06-01 22:58:49 +00: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 */
|
2013-06-02 07:52:15 +00:00
|
|
|
TTYC_SS, /* set cursor style, Ss */
|
2016-01-29 11:13:56 +00:00
|
|
|
TTYC_TC, /* 24-bit "true" colour, Tc */
|
2011-05-08 19:53:06 +00:00
|
|
|
TTYC_TSL, /* to_status_line, tsl */
|
2009-10-12 13:01:18 +00:00
|
|
|
TTYC_VPA, /* row_address, cv */
|
2009-06-01 22:58:49 +00:00
|
|
|
TTYC_XENL, /* eat_newline_glitch, xn */
|
2011-05-08 19:53:06 +00:00
|
|
|
TTYC_XT, /* xterm(1)-compatible title, XT */
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Message codes. */
|
2009-07-29 14:17:26 +00:00
|
|
|
enum msgtype {
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_VERSION = 12,
|
|
|
|
|
|
|
|
MSG_IDENTIFY_FLAGS = 100,
|
|
|
|
MSG_IDENTIFY_TERM,
|
|
|
|
MSG_IDENTIFY_TTYNAME,
|
2015-10-18 20:42:42 +00:00
|
|
|
MSG_IDENTIFY_OLDCWD, /* unused */
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_IDENTIFY_STDIN,
|
|
|
|
MSG_IDENTIFY_ENVIRON,
|
|
|
|
MSG_IDENTIFY_DONE,
|
2015-06-14 10:07:44 +00:00
|
|
|
MSG_IDENTIFY_CLIENTPID,
|
2015-10-18 20:42:42 +00:00
|
|
|
MSG_IDENTIFY_CWD,
|
2013-10-10 12:13:56 +00:00
|
|
|
|
|
|
|
MSG_COMMAND = 200,
|
2009-06-01 22:58:49 +00:00
|
|
|
MSG_DETACH,
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_DETACHKILL,
|
2009-06-01 22:58:49 +00:00
|
|
|
MSG_EXIT,
|
|
|
|
MSG_EXITED,
|
|
|
|
MSG_EXITING,
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_LOCK,
|
2009-06-01 22:58:49 +00:00
|
|
|
MSG_READY,
|
|
|
|
MSG_RESIZE,
|
2010-06-28 22:10:42 +00:00
|
|
|
MSG_SHELL,
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_SHUTDOWN,
|
2010-06-28 22:10:42 +00:00
|
|
|
MSG_STDERR,
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_STDIN,
|
2010-06-28 22:10:42 +00:00
|
|
|
MSG_STDOUT,
|
2013-10-10 12:13:56 +00:00
|
|
|
MSG_SUSPEND,
|
|
|
|
MSG_UNLOCK,
|
|
|
|
MSG_WAKEUP,
|
2017-01-13 10:12:12 +00:00
|
|
|
MSG_EXEC,
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
2009-07-26 12:58:44 +00:00
|
|
|
/*
|
2009-08-11 17:18:35 +00:00
|
|
|
* Message data.
|
2009-07-26 12:58:44 +00:00
|
|
|
*
|
|
|
|
* Don't forget to bump PROTOCOL_VERSION if any of these change!
|
|
|
|
*/
|
2009-06-01 22:58:49 +00:00
|
|
|
struct msg_command_data {
|
2013-10-10 12:13:56 +00:00
|
|
|
int argc;
|
|
|
|
}; /* followed by packed argv */
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2012-05-21 18:27:42 +00: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];
|
|
|
|
};
|
|
|
|
|
2017-01-25 14:24:54 +00:00
|
|
|
/* Mode keys. */
|
2009-06-01 22:58:49 +00:00
|
|
|
#define MODEKEY_EMACS 0
|
|
|
|
#define MODEKEY_VI 1
|
|
|
|
|
|
|
|
/* Modes. */
|
|
|
|
#define MODE_CURSOR 0x1
|
|
|
|
#define MODE_INSERT 0x2
|
|
|
|
#define MODE_KCURSOR 0x4
|
2009-11-25 12:24:31 +00:00
|
|
|
#define MODE_KKEYPAD 0x8 /* set = application, clear = number */
|
2010-12-29 21:49:06 +00:00
|
|
|
#define MODE_WRAP 0x10 /* whether lines wrap */
|
|
|
|
#define MODE_MOUSE_STANDARD 0x20
|
2011-01-15 00:16:00 +00:00
|
|
|
#define MODE_MOUSE_BUTTON 0x40
|
2015-01-20 08:18:04 +00:00
|
|
|
#define MODE_BLINKING 0x80
|
2015-11-23 23:47:57 +00:00
|
|
|
#define MODE_MOUSE_UTF8 0x100
|
2013-03-22 10:33:50 +00:00
|
|
|
#define MODE_MOUSE_SGR 0x200
|
|
|
|
#define MODE_BRACKETPASTE 0x400
|
2013-03-24 09:28:59 +00:00
|
|
|
#define MODE_FOCUSON 0x800
|
2017-02-01 09:55:07 +00:00
|
|
|
#define MODE_MOUSE_ALL 0x1000
|
2010-12-29 21:49:06 +00:00
|
|
|
|
2017-02-08 23:53:03 +00:00
|
|
|
#define ALL_MODES 0xffffff
|
2017-02-01 09:55:07 +00:00
|
|
|
#define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-15 22:50:38 +00:00
|
|
|
/*
|
|
|
|
* A single UTF-8 character. UTF8_SIZE must be big enough to hold at least one
|
|
|
|
* combining character as well.
|
|
|
|
*/
|
|
|
|
#define UTF8_SIZE 9
|
2009-10-20 19:18:28 +00:00
|
|
|
struct utf8_data {
|
|
|
|
u_char data[UTF8_SIZE];
|
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
u_char have;
|
|
|
|
u_char size;
|
2009-10-20 19:18:28 +00:00
|
|
|
|
2015-11-14 10:56:31 +00:00
|
|
|
u_char width; /* 0xff if invalid */
|
2015-11-13 08:09:28 +00:00
|
|
|
} __packed;
|
2015-11-14 11:45:43 +00:00
|
|
|
enum utf8_state {
|
|
|
|
UTF8_MORE,
|
|
|
|
UTF8_DONE,
|
|
|
|
UTF8_ERROR
|
|
|
|
};
|
2009-10-20 19:18:28 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
/* Colour flags. */
|
|
|
|
#define COLOUR_FLAG_256 0x01000000
|
|
|
|
#define COLOUR_FLAG_RGB 0x02000000
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* 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
|
2015-11-13 08:09:28 +00:00
|
|
|
#define GRID_FLAG_EXTENDED 0x8
|
2016-07-15 00:49:08 +00:00
|
|
|
#define GRID_FLAG_SELECTED 0x10
|
2017-01-07 15:28:13 +00:00
|
|
|
#define GRID_FLAG_NOPALETTE 0x20
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-08-08 15:57:49 +00:00
|
|
|
/* Grid line flags. */
|
|
|
|
#define GRID_LINE_WRAPPED 0x1
|
2016-07-15 00:49:08 +00:00
|
|
|
#define GRID_LINE_EXTENDED 0x2
|
2016-01-29 11:13:56 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* Grid cell data. */
|
|
|
|
struct grid_cell {
|
2015-11-13 08:09:28 +00:00
|
|
|
u_char flags;
|
|
|
|
u_char attr;
|
2016-07-15 00:49:08 +00:00
|
|
|
int fg;
|
|
|
|
int bg;
|
2015-11-13 08:09:28 +00:00
|
|
|
struct utf8_data data;
|
|
|
|
};
|
|
|
|
struct grid_cell_entry {
|
|
|
|
u_char flags;
|
|
|
|
union {
|
|
|
|
u_int offset;
|
|
|
|
struct {
|
|
|
|
u_char attr;
|
|
|
|
u_char fg;
|
|
|
|
u_char bg;
|
|
|
|
u_char data;
|
|
|
|
} data;
|
|
|
|
};
|
2009-06-01 22:58:49 +00:00
|
|
|
} __packed;
|
|
|
|
|
2009-08-08 13:29:27 +00:00
|
|
|
/* Grid line. */
|
|
|
|
struct grid_line {
|
2016-10-13 20:27:27 +00:00
|
|
|
u_int cellused;
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int cellsize;
|
|
|
|
struct grid_cell_entry *celldata;
|
|
|
|
|
|
|
|
u_int extdsize;
|
|
|
|
struct grid_cell *extddata;
|
2009-08-08 13:29:27 +00:00
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
int flags;
|
2009-08-08 13:29:27 +00:00
|
|
|
} __packed;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* Entire grid of cells. */
|
|
|
|
struct grid {
|
2015-11-13 08:09:28 +00:00
|
|
|
int flags;
|
|
|
|
#define GRID_HISTORY 0x1 /* scroll lines into history */
|
2009-07-13 10:43:52 +00:00
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-09-02 20:57:20 +00:00
|
|
|
u_int hscrolled;
|
2015-11-13 08:09:28 +00:00
|
|
|
u_int hsize;
|
|
|
|
u_int hlimit;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-13 08:09:28 +00:00
|
|
|
struct grid_line *linedata;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
2015-12-08 01:10:31 +00:00
|
|
|
/* Hook data structures. */
|
|
|
|
struct hook {
|
2015-12-08 08:14:04 +00:00
|
|
|
const char *name;
|
|
|
|
|
|
|
|
struct cmd_list *cmdlist;
|
|
|
|
|
|
|
|
RB_ENTRY(hook) entry;
|
2015-12-08 01:10:31 +00:00
|
|
|
};
|
|
|
|
|
2009-10-10 15:03:01 +00:00
|
|
|
/* Scheduled job. */
|
|
|
|
struct job {
|
2015-06-17 16:44:49 +00:00
|
|
|
enum {
|
|
|
|
JOB_RUNNING,
|
|
|
|
JOB_DEAD,
|
|
|
|
JOB_CLOSED
|
|
|
|
} state;
|
|
|
|
|
2009-10-10 15:03:01 +00:00
|
|
|
char *cmd;
|
|
|
|
pid_t pid;
|
2009-10-11 07:20:16 +00:00
|
|
|
int status;
|
2009-10-10 15:03:01 +00:00
|
|
|
|
|
|
|
int fd;
|
2009-11-04 21:04:43 +00:00
|
|
|
struct bufferevent *event;
|
2009-10-10 15:03:01 +00:00
|
|
|
|
|
|
|
void (*callbackfn)(struct job *);
|
|
|
|
void (*freefn)(void *);
|
|
|
|
void *data;
|
|
|
|
|
2011-01-26 00:11:47 +00:00
|
|
|
LIST_ENTRY(job) lentry;
|
2009-10-10 15:03:01 +00:00
|
|
|
};
|
2011-01-26 00:11:47 +00:00
|
|
|
LIST_HEAD(joblist, job);
|
2009-10-10 15:03:01 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* Screen selection. */
|
|
|
|
struct screen_sel {
|
|
|
|
int flag;
|
2016-11-24 13:38:44 +00:00
|
|
|
int hidden;
|
|
|
|
|
2010-02-06 17:35:01 +00:00
|
|
|
int rectflag;
|
2014-11-06 09:17:25 +00:00
|
|
|
enum {
|
|
|
|
LINE_SEL_NONE,
|
|
|
|
LINE_SEL_LEFT_RIGHT,
|
|
|
|
LINE_SEL_RIGHT_LEFT,
|
|
|
|
} lineflag;
|
|
|
|
|
2014-08-11 22:18:16 +00:00
|
|
|
int modekeys;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int ex;
|
|
|
|
u_int ey;
|
|
|
|
|
|
|
|
struct grid_cell cell;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Virtual screen. */
|
|
|
|
struct screen {
|
2016-07-15 00:49:08 +00:00
|
|
|
char *title;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
struct grid *grid; /* grid data */
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int cx; /* cursor x */
|
|
|
|
u_int cy; /* cursor y */
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int cstyle; /* cursor style */
|
|
|
|
char *ccolour; /* cursor colour string */
|
2011-05-20 19:03:58 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
u_int rupper; /* scroll region top */
|
2016-10-13 20:27:27 +00:00
|
|
|
u_int rlower; /* scroll region bottom */
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
int mode;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
bitstr_t *tabs;
|
2009-06-04 18:48:24 +00:00
|
|
|
|
2016-07-15 00:49:08 +00:00
|
|
|
struct screen_sel sel;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Screen write context. */
|
2017-02-08 16:45:18 +00:00
|
|
|
struct screen_write_collect_item;
|
|
|
|
struct screen_write_collect_line;
|
2009-06-01 22:58:49 +00:00
|
|
|
struct screen_write_ctx {
|
2016-07-15 00:49:08 +00:00
|
|
|
struct window_pane *wp;
|
|
|
|
struct screen *s;
|
2017-02-08 16:45:18 +00:00
|
|
|
|
|
|
|
struct screen_write_collect_item *item;
|
|
|
|
struct screen_write_collect_line *list;
|
2017-02-08 17:31:09 +00:00
|
|
|
u_int scrolled;
|
2016-07-15 00:49:08 +00:00
|
|
|
|
|
|
|
u_int cells;
|
|
|
|
u_int written;
|
|
|
|
u_int skipped;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Window mode. Windows can be in several modes and this is used to call the
|
|
|
|
* right function to handle input and output.
|
|
|
|
*/
|
|
|
|
struct window_mode {
|
|
|
|
struct screen *(*init)(struct window_pane *);
|
|
|
|
void (*free)(struct window_pane *);
|
|
|
|
void (*resize)(struct window_pane *, u_int, u_int);
|
2015-04-19 21:34:21 +00:00
|
|
|
void (*key)(struct window_pane *, struct client *, struct session *,
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code, struct mouse_event *);
|
2016-10-11 07:23:34 +00:00
|
|
|
|
|
|
|
const char *(*key_table)(struct window_pane *);
|
|
|
|
void (*command)(struct window_pane *, struct client *,
|
|
|
|
struct session *, struct args *, struct mouse_event *);
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2016-06-15 09:13:46 +00:00
|
|
|
#define WINDOW_MODE_TIMEOUT 180
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2012-06-25 14:08:55 +00:00
|
|
|
/* Structures for choose mode. */
|
|
|
|
struct window_choose_data {
|
2013-03-21 16:09:59 +00:00
|
|
|
struct client *start_client;
|
|
|
|
struct session *start_session;
|
|
|
|
|
2012-06-25 14:08:55 +00:00
|
|
|
u_int idx;
|
2012-10-02 08:16:28 +00:00
|
|
|
int type;
|
2013-03-21 16:09:59 +00:00
|
|
|
#define TREE_OTHER 0x0
|
2012-10-02 08:16:28 +00:00
|
|
|
#define TREE_WINDOW 0x1
|
|
|
|
#define TREE_SESSION 0x2
|
2013-03-21 16:09:59 +00:00
|
|
|
|
|
|
|
struct session *tree_session; /* session of items in tree */
|
|
|
|
|
|
|
|
struct winlink *wl;
|
2012-09-03 12:20:17 +00:00
|
|
|
int pane_id;
|
2013-03-21 16:09:59 +00:00
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
char *ft_template;
|
2013-03-21 16:09:59 +00:00
|
|
|
struct format_tree *ft;
|
|
|
|
|
|
|
|
char *command;
|
2012-06-25 14:08:55 +00:00
|
|
|
};
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* Child window structure. */
|
|
|
|
struct window_pane {
|
2011-03-27 20:27:26 +00:00
|
|
|
u_int id;
|
2014-05-08 06:03:30 +00:00
|
|
|
u_int active_point;
|
2011-03-27 20:27:26 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
struct window *window;
|
2013-03-24 09:58:40 +00:00
|
|
|
|
2009-07-19 13:21:40 +00:00
|
|
|
struct layout_cell *layout_cell;
|
2013-03-24 09:58:40 +00:00
|
|
|
struct layout_cell *saved_layout_cell;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
|
|
|
int flags;
|
2009-07-14 07:23:36 +00:00
|
|
|
#define PANE_REDRAW 0x1
|
2012-03-20 11:01:00 +00:00
|
|
|
#define PANE_DROP 0x2
|
2013-03-24 09:28:59 +00:00
|
|
|
#define PANE_FOCUSED 0x4
|
|
|
|
#define PANE_RESIZE 0x8
|
2013-06-23 13:10:46 +00:00
|
|
|
#define PANE_FOCUSPUSH 0x10
|
2014-08-11 22:14:30 +00:00
|
|
|
#define PANE_INPUTOFF 0x20
|
2015-08-28 07:49:24 +00:00
|
|
|
#define PANE_CHANGED 0x40
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2014-05-13 08:08:32 +00:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
2009-09-01 13:09:49 +00:00
|
|
|
char *shell;
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *cwd;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
char tty[TTY_NAME_MAX];
|
2014-12-09 19:23:35 +00:00
|
|
|
int status;
|
2009-11-04 20:50:11 +00:00
|
|
|
|
|
|
|
int fd;
|
2009-11-04 22:43:11 +00:00
|
|
|
struct bufferevent *event;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-09-28 08:30:44 +00:00
|
|
|
struct event resize_timer;
|
|
|
|
|
2015-05-08 16:18:04 +00:00
|
|
|
struct input_ctx *ictx;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-04-19 21:05:27 +00:00
|
|
|
struct grid_cell colgc;
|
|
|
|
|
2017-01-07 15:28:13 +00:00
|
|
|
int *palette;
|
|
|
|
|
2009-10-11 10:04:27 +00:00
|
|
|
int pipe_fd;
|
2009-11-04 22:02:38 +00:00
|
|
|
struct bufferevent *pipe_event;
|
2009-10-11 10:04:27 +00:00
|
|
|
size_t pipe_off;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
struct screen *screen;
|
|
|
|
struct screen base;
|
|
|
|
|
2016-04-29 15:00:48 +00:00
|
|
|
struct screen status_screen;
|
|
|
|
size_t status_size;
|
|
|
|
|
2009-07-13 10:43:52 +00:00
|
|
|
/* Saved in alternative screen mode. */
|
2009-12-03 22:50:09 +00:00
|
|
|
u_int saved_cx;
|
|
|
|
u_int saved_cy;
|
2009-07-13 10:43:52 +00:00
|
|
|
struct grid *saved_grid;
|
2009-08-07 00:12:13 +00:00
|
|
|
struct grid_cell saved_cell;
|
2009-07-13 10:43:52 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
const struct window_mode *mode;
|
|
|
|
void *modedata;
|
2016-06-15 09:13:46 +00:00
|
|
|
struct event modetimer;
|
|
|
|
time_t modelast;
|
2016-10-11 07:23:34 +00:00
|
|
|
u_int modeprefix;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(window_pane) entry;
|
2011-03-27 20:27:26 +00:00
|
|
|
RB_ENTRY(window_pane) tree_entry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
TAILQ_HEAD(window_panes, window_pane);
|
2011-03-27 20:27:26 +00:00
|
|
|
RB_HEAD(window_pane_tree, window_pane);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* Window structure. */
|
|
|
|
struct window {
|
2012-01-30 09:39:34 +00:00
|
|
|
u_int id;
|
2015-08-29 00:29:15 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
char *name;
|
2015-08-29 00:29:15 +00:00
|
|
|
struct event name_event;
|
|
|
|
struct timeval name_time;
|
|
|
|
|
2015-08-29 08:30:54 +00:00
|
|
|
struct event alerts_timer;
|
|
|
|
|
2015-06-15 10:58:01 +00:00
|
|
|
struct timeval activity_time;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
struct window_pane *active;
|
2010-10-23 13:04:34 +00:00
|
|
|
struct window_pane *last;
|
2009-06-01 22:58:49 +00:00
|
|
|
struct window_panes panes;
|
2009-07-19 13:21:40 +00:00
|
|
|
|
2009-07-28 06:48:44 +00:00
|
|
|
int lastlayout;
|
2009-07-19 13:21:40 +00:00
|
|
|
struct layout_cell *layout_root;
|
2013-03-24 09:58:40 +00:00
|
|
|
struct layout_cell *saved_layout_root;
|
2015-04-28 10:43:13 +00:00
|
|
|
char *old_layout;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define WINDOW_BELL 0x1
|
2010-11-22 21:13:13 +00:00
|
|
|
#define WINDOW_ACTIVITY 0x2
|
|
|
|
#define WINDOW_REDRAW 0x4
|
2010-12-06 22:51:02 +00:00
|
|
|
#define WINDOW_SILENCE 0x8
|
2014-11-14 02:19:47 +00:00
|
|
|
#define WINDOW_ZOOMED 0x1000
|
|
|
|
#define WINDOW_FORCEWIDTH 0x2000
|
|
|
|
#define WINDOW_FORCEHEIGHT 0x4000
|
2016-05-30 09:50:20 +00:00
|
|
|
#define WINDOW_STYLECHANGED 0x8000
|
2013-10-10 12:09:34 +00:00
|
|
|
#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-10-19 09:22:07 +00:00
|
|
|
int alerts_queued;
|
|
|
|
TAILQ_ENTRY(window) alerts_entry;
|
|
|
|
|
2015-10-27 15:58:42 +00:00
|
|
|
struct options *options;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-05-30 09:50:20 +00:00
|
|
|
struct grid_cell style;
|
|
|
|
struct grid_cell active_style;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
u_int references;
|
2016-10-19 09:22:07 +00:00
|
|
|
TAILQ_HEAD(, winlink) winlinks;
|
2015-04-22 15:30:11 +00:00
|
|
|
|
|
|
|
RB_ENTRY(window) entry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2015-04-22 15:30:11 +00:00
|
|
|
RB_HEAD(windows, window);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* Entry on local window list. */
|
|
|
|
struct winlink {
|
|
|
|
int idx;
|
2016-10-19 09:22:07 +00:00
|
|
|
struct session *session;
|
2009-06-01 22:58:49 +00:00
|
|
|
struct window *window;
|
|
|
|
|
2009-11-19 19:47:28 +00:00
|
|
|
size_t status_width;
|
|
|
|
struct grid_cell status_cell;
|
|
|
|
char *status_text;
|
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
int flags;
|
2010-06-21 01:27:46 +00:00
|
|
|
#define WINLINK_BELL 0x1
|
|
|
|
#define WINLINK_ACTIVITY 0x2
|
2014-04-17 07:36:45 +00:00
|
|
|
#define WINLINK_SILENCE 0x4
|
|
|
|
#define WINLINK_ALERTFLAGS (WINLINK_BELL|WINLINK_ACTIVITY|WINLINK_SILENCE)
|
2010-06-21 01:27:46 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
RB_ENTRY(winlink) entry;
|
2016-10-19 09:22:07 +00:00
|
|
|
TAILQ_ENTRY(winlink) wentry;
|
2009-10-10 10:02:48 +00:00
|
|
|
TAILQ_ENTRY(winlink) sentry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
RB_HEAD(winlinks, winlink);
|
2009-10-10 10:02:48 +00:00
|
|
|
TAILQ_HEAD(winlink_stack, winlink);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-07-19 13:21:40 +00: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-08-08 21:52:43 +00:00
|
|
|
/* Environment variable. */
|
|
|
|
struct environ_entry {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
|
|
|
|
RB_ENTRY(environ_entry) entry;
|
|
|
|
};
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* Client session. */
|
2009-10-10 10:02:48 +00:00
|
|
|
struct session_group {
|
2017-02-09 15:04:53 +00:00
|
|
|
const char *name;
|
|
|
|
TAILQ_HEAD(, session) sessions;
|
2009-10-10 10:02:48 +00:00
|
|
|
|
2017-02-09 15:04:53 +00:00
|
|
|
RB_ENTRY(session_group) entry;
|
2009-10-10 10:02:48 +00:00
|
|
|
};
|
2017-02-09 15:04:53 +00:00
|
|
|
RB_HEAD(session_groups, session_group);
|
2009-10-10 10:02:48 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
struct session {
|
2013-03-25 10:11:45 +00:00
|
|
|
u_int id;
|
2010-12-21 22:37:59 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
char *name;
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *cwd;
|
2009-11-03 20:29:47 +00:00
|
|
|
|
|
|
|
struct timeval creation_time;
|
2015-09-10 08:58:14 +00:00
|
|
|
struct timeval last_attached_time;
|
2009-11-03 20:29:47 +00:00
|
|
|
struct timeval activity_time;
|
2013-01-15 22:55:29 +00:00
|
|
|
struct timeval last_activity_time;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-08-28 13:12:20 +00:00
|
|
|
struct event lock_timer;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
|
|
|
|
|
|
|
struct winlink *curw;
|
|
|
|
struct winlink_stack lastw;
|
|
|
|
struct winlinks windows;
|
|
|
|
|
2017-02-03 21:01:02 +00:00
|
|
|
int statusat;
|
|
|
|
|
2015-12-08 01:10:31 +00:00
|
|
|
struct hooks *hooks;
|
2015-10-27 15:58:42 +00:00
|
|
|
struct options *options;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
|
2015-11-19 22:46:46 +00:00
|
|
|
#define SESSION_PASTING 0x2
|
2016-10-19 09:22:07 +00:00
|
|
|
#define SESSION_ALERTED 0x4
|
2009-06-01 22:58:49 +00:00
|
|
|
int flags;
|
2009-08-08 21:52:43 +00:00
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
u_int attached;
|
2014-03-31 21:37:55 +00:00
|
|
|
|
2009-09-16 12:35:04 +00:00
|
|
|
struct termios *tio;
|
2009-08-13 19:03:59 +00:00
|
|
|
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ *environ;
|
2009-09-07 21:01:50 +00:00
|
|
|
|
|
|
|
int references;
|
2009-10-10 10:02:48 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(session) gentry;
|
2010-12-21 22:37:59 +00:00
|
|
|
RB_ENTRY(session) entry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2010-12-21 22:37:59 +00:00
|
|
|
RB_HEAD(sessions, session);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2014-03-31 21:40:21 +00:00
|
|
|
/* Mouse button masks. */
|
|
|
|
#define MOUSE_MASK_BUTTONS 3
|
|
|
|
#define MOUSE_MASK_SHIFT 4
|
|
|
|
#define MOUSE_MASK_META 8
|
|
|
|
#define MOUSE_MASK_CTRL 16
|
|
|
|
#define MOUSE_MASK_DRAG 32
|
|
|
|
#define MOUSE_MASK_WHEEL 64
|
|
|
|
|
2012-10-26 14:35:42 +00:00
|
|
|
/* Mouse wheel states. */
|
|
|
|
#define MOUSE_WHEEL_UP 0
|
2015-04-19 21:34:21 +00:00
|
|
|
#define MOUSE_WHEEL_DOWN 64
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse helpers. */
|
|
|
|
#define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
|
|
|
|
#define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
|
|
|
|
#define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
|
|
|
|
#define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
|
2014-05-08 07:54:47 +00:00
|
|
|
|
2015-04-19 21:34:21 +00:00
|
|
|
/* Mouse input. */
|
2012-10-26 14:35:42 +00:00
|
|
|
struct mouse_event {
|
2015-11-12 11:05:34 +00:00
|
|
|
int valid;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
|
|
|
int statusat;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int x;
|
|
|
|
u_int y;
|
|
|
|
u_int b;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int lx;
|
|
|
|
u_int ly;
|
|
|
|
u_int lb;
|
2013-03-22 10:33:50 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
int s;
|
|
|
|
int w;
|
|
|
|
int wp;
|
2012-10-26 14:35:42 +00:00
|
|
|
|
2015-11-12 11:05:34 +00:00
|
|
|
u_int sgr_type;
|
|
|
|
u_int sgr_b;
|
2012-10-26 14:35:42 +00:00
|
|
|
};
|
|
|
|
|
2015-05-08 16:48:12 +00:00
|
|
|
/* TTY information. */
|
|
|
|
struct tty_key {
|
|
|
|
char ch;
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
2015-05-08 16:48:12 +00:00
|
|
|
|
|
|
|
struct tty_key *left;
|
|
|
|
struct tty_key *right;
|
|
|
|
|
|
|
|
struct tty_key *next;
|
|
|
|
};
|
|
|
|
|
2015-07-28 15:18:10 +00:00
|
|
|
struct tty_code;
|
2015-05-08 16:48:12 +00:00
|
|
|
struct tty_term {
|
|
|
|
char *name;
|
|
|
|
u_int references;
|
|
|
|
|
|
|
|
char acs[UCHAR_MAX + 1][2];
|
|
|
|
|
2015-07-28 15:18:10 +00:00
|
|
|
struct tty_code *codes;
|
2015-05-08 16:48:12 +00:00
|
|
|
|
|
|
|
#define TERM_256COLOURS 0x1
|
|
|
|
#define TERM_EARLYWRAP 0x2
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
LIST_ENTRY(tty_term) entry;
|
|
|
|
};
|
|
|
|
LIST_HEAD(tty_terms, tty_term);
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
struct tty {
|
2012-05-22 14:32:28 +00:00
|
|
|
struct client *client;
|
2009-06-01 22:58:49 +00:00
|
|
|
char *path;
|
|
|
|
|
2009-12-03 22:50:09 +00:00
|
|
|
u_int sx;
|
|
|
|
u_int sy;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
u_int cx;
|
|
|
|
u_int cy;
|
2011-05-20 19:17:39 +00:00
|
|
|
u_int cstyle;
|
2011-05-20 19:03:58 +00:00
|
|
|
char *ccolour;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
u_int rlower;
|
|
|
|
u_int rupper;
|
|
|
|
|
2016-11-15 14:02:32 +00:00
|
|
|
u_int rleft;
|
|
|
|
u_int rright;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
int fd;
|
2017-02-10 12:59:18 +00:00
|
|
|
struct event event_in;
|
|
|
|
struct evbuffer *in;
|
|
|
|
struct event event_out;
|
|
|
|
struct evbuffer *out;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-12-03 22:50:09 +00:00
|
|
|
struct termios tio;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
struct grid_cell cell;
|
|
|
|
|
2017-02-08 16:45:18 +00:00
|
|
|
int last_wp;
|
2017-02-06 19:45:23 +00:00
|
|
|
struct grid_cell last_cell;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
#define TTY_NOCURSOR 0x1
|
|
|
|
#define TTY_FREEZE 0x2
|
2013-03-21 18:47:56 +00:00
|
|
|
#define TTY_TIMER 0x4
|
2009-06-01 22:58:49 +00:00
|
|
|
#define TTY_UTF8 0x8
|
2009-08-11 19:32:25 +00:00
|
|
|
#define TTY_STARTED 0x10
|
2009-08-11 20:29:04 +00:00
|
|
|
#define TTY_OPENED 0x20
|
2013-06-23 13:10:46 +00:00
|
|
|
#define TTY_FOCUS 0x40
|
2009-12-03 22:50:09 +00:00
|
|
|
int flags;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2017-01-11 16:09:57 +00:00
|
|
|
struct tty_term *term;
|
|
|
|
char *term_name;
|
2009-06-01 22:58:49 +00:00
|
|
|
int term_flags;
|
2016-11-15 14:02:32 +00:00
|
|
|
enum {
|
|
|
|
TTY_VT100,
|
|
|
|
TTY_VT101,
|
|
|
|
TTY_VT102,
|
|
|
|
TTY_VT220,
|
|
|
|
TTY_VT320,
|
|
|
|
TTY_VT420,
|
|
|
|
TTY_UNKNOWN
|
|
|
|
} term_type;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2012-05-22 14:32:28 +00:00
|
|
|
struct mouse_event mouse;
|
2015-04-19 21:34:21 +00:00
|
|
|
int mouse_drag_flag;
|
|
|
|
void (*mouse_drag_update)(struct client *,
|
|
|
|
struct mouse_event *);
|
|
|
|
void (*mouse_drag_release)(struct client *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct mouse_event *);
|
2012-05-22 14:32:28 +00:00
|
|
|
|
2009-11-05 08:45:08 +00:00
|
|
|
struct event key_timer;
|
2009-11-05 19:29:41 +00:00
|
|
|
struct tty_key *key_tree;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2017-01-11 16:05:46 +00:00
|
|
|
#define TTY_TYPES \
|
|
|
|
{ "VT100", "VT101", "VT102", "VT220", "VT320", "VT420", "UNKNOWN" }
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-19 22:46:46 +00:00
|
|
|
/* TTY command context. */
|
2009-07-22 18:02:23 +00:00
|
|
|
struct tty_ctx {
|
2017-02-08 23:53:03 +00:00
|
|
|
struct window_pane *wp;
|
2009-07-22 18:02:23 +00:00
|
|
|
|
2017-02-08 23:53:03 +00:00
|
|
|
const struct grid_cell *cell;
|
2009-07-22 18:02:23 +00:00
|
|
|
|
2009-07-22 20:53:38 +00:00
|
|
|
u_int num;
|
2009-12-17 17:39:56 +00:00
|
|
|
void *ptr;
|
2009-07-22 20:53:38 +00:00
|
|
|
|
2009-12-17 17:39:56 +00:00
|
|
|
/*
|
2009-07-22 20:53:38 +00: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 08:24:46 +00:00
|
|
|
|
2012-01-29 09:37:02 +00:00
|
|
|
u_int xoff;
|
|
|
|
u_int yoff;
|
|
|
|
|
2016-10-13 20:27:27 +00:00
|
|
|
/* The background colour used for clearing (erasing). */
|
|
|
|
u_int bg;
|
2009-07-22 18:02:23 +00:00
|
|
|
};
|
|
|
|
|
2009-11-18 13:16:33 +00:00
|
|
|
/* Saved message entry. */
|
|
|
|
struct message_entry {
|
2015-05-08 16:33:29 +00:00
|
|
|
char *msg;
|
|
|
|
u_int msg_num;
|
|
|
|
time_t msg_time;
|
2015-04-25 18:33:59 +00:00
|
|
|
TAILQ_ENTRY(message_entry) entry;
|
2009-11-18 13:16:33 +00:00
|
|
|
};
|
|
|
|
|
2013-05-31 12:19:34 +00:00
|
|
|
/* Parsed arguments structures. */
|
2015-08-29 23:19:52 +00:00
|
|
|
struct args_entry;
|
2013-05-31 12:19:34 +00:00
|
|
|
RB_HEAD(args_tree, args_entry);
|
|
|
|
struct args {
|
|
|
|
struct args_tree tree;
|
2015-05-08 16:48:12 +00:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
2011-01-04 00:42:46 +00:00
|
|
|
};
|
|
|
|
|
2015-12-13 17:55:14 +00:00
|
|
|
/* Command find structures. */
|
|
|
|
enum cmd_find_type {
|
|
|
|
CMD_FIND_PANE,
|
|
|
|
CMD_FIND_WINDOW,
|
|
|
|
CMD_FIND_SESSION,
|
|
|
|
};
|
|
|
|
struct cmd_find_state {
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_item *item;
|
2015-12-13 17:55:14 +00:00
|
|
|
int flags;
|
|
|
|
struct cmd_find_state *current;
|
2015-12-13 14:32:38 +00:00
|
|
|
|
2016-10-13 20:27:27 +00:00
|
|
|
struct session *s;
|
|
|
|
struct winlink *wl;
|
2015-12-13 17:55:14 +00:00
|
|
|
struct window *w;
|
2016-10-13 20:27:27 +00:00
|
|
|
struct window_pane *wp;
|
2015-12-13 17:55:14 +00:00
|
|
|
int idx;
|
2015-12-13 14:32:38 +00:00
|
|
|
};
|
2015-12-13 17:55:14 +00:00
|
|
|
|
|
|
|
/* Command find flags. */
|
|
|
|
#define CMD_FIND_PREFER_UNATTACHED 0x1
|
|
|
|
#define CMD_FIND_QUIET 0x2
|
|
|
|
#define CMD_FIND_WINDOW_INDEX 0x4
|
|
|
|
#define CMD_FIND_DEFAULT_MARKED 0x8
|
|
|
|
#define CMD_FIND_EXACT_SESSION 0x10
|
|
|
|
#define CMD_FIND_EXACT_WINDOW 0x20
|
|
|
|
|
|
|
|
/* Context for command being executed. */
|
2015-12-13 14:32:38 +00:00
|
|
|
struct cmd_state {
|
|
|
|
struct client *c;
|
2015-12-13 17:55:14 +00:00
|
|
|
struct cmd_find_state tflag;
|
|
|
|
struct cmd_find_state sflag;
|
2015-12-13 14:32:38 +00:00
|
|
|
};
|
|
|
|
|
2013-03-24 09:54:10 +00:00
|
|
|
/* Command and list of commands. */
|
2009-06-01 22:58:49 +00:00
|
|
|
struct cmd {
|
2011-01-04 00:42:46 +00:00
|
|
|
const struct cmd_entry *entry;
|
|
|
|
struct args *args;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2013-03-24 09:54:10 +00:00
|
|
|
char *file;
|
|
|
|
u_int line;
|
|
|
|
|
2013-06-23 13:10:46 +00:00
|
|
|
#define CMD_CONTROL 0x1
|
|
|
|
int flags;
|
|
|
|
|
2011-01-04 00:42:46 +00:00
|
|
|
TAILQ_ENTRY(cmd) qentry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2015-05-08 16:33:29 +00:00
|
|
|
|
2010-06-26 18:20:53 +00:00
|
|
|
struct cmd_list {
|
2015-05-08 16:48:12 +00:00
|
|
|
int references;
|
|
|
|
TAILQ_HEAD(, cmd) list;
|
2010-06-26 18:20:53 +00:00
|
|
|
};
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2013-03-24 09:54:10 +00:00
|
|
|
/* Command return values. */
|
2012-07-11 07:10:15 +00:00
|
|
|
enum cmd_retval {
|
|
|
|
CMD_RETURN_ERROR = -1,
|
|
|
|
CMD_RETURN_NORMAL = 0,
|
2013-03-24 09:54:10 +00:00
|
|
|
CMD_RETURN_WAIT,
|
|
|
|
CMD_RETURN_STOP
|
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Command queue item type. */
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmdq_type {
|
|
|
|
CMDQ_COMMAND,
|
|
|
|
CMDQ_CALLBACK,
|
2013-03-24 09:54:10 +00:00
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Command queue item. */
|
2016-10-16 19:04:05 +00:00
|
|
|
typedef enum cmd_retval (*cmdq_cb) (struct cmdq_item *, void *);
|
|
|
|
struct cmdq_item {
|
2016-10-18 08:46:43 +00:00
|
|
|
const char *name;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_list *queue;
|
|
|
|
struct cmdq_item *next;
|
2013-03-24 09:54:10 +00:00
|
|
|
|
|
|
|
struct client *client;
|
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmdq_type type;
|
2016-10-16 17:55:14 +00:00
|
|
|
u_int group;
|
|
|
|
|
|
|
|
u_int number;
|
|
|
|
time_t time;
|
|
|
|
|
2016-10-16 19:36:37 +00:00
|
|
|
struct format_tree *formats;
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
int flags;
|
2016-10-16 19:04:05 +00:00
|
|
|
#define CMDQ_FIRED 0x1
|
|
|
|
#define CMDQ_WAITING 0x2
|
|
|
|
#define CMDQ_NOHOOKS 0x4
|
2016-10-16 17:55:14 +00:00
|
|
|
|
|
|
|
struct cmd_list *cmdlist;
|
2013-03-24 09:54:10 +00:00
|
|
|
struct cmd *cmd;
|
2017-02-06 15:00:41 +00:00
|
|
|
int repeat;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
cmdq_cb cb;
|
2016-10-16 17:55:14 +00:00
|
|
|
void *data;
|
2013-03-24 09:54:10 +00:00
|
|
|
|
2015-12-16 22:05:35 +00:00
|
|
|
struct cmd_find_state current;
|
2015-12-13 14:32:38 +00:00
|
|
|
struct cmd_state state;
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
struct mouse_event mouse;
|
2013-03-24 09:54:10 +00:00
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
TAILQ_ENTRY(cmdq_item) entry;
|
2012-07-11 07:10:15 +00:00
|
|
|
};
|
2016-10-16 19:04:05 +00:00
|
|
|
TAILQ_HEAD(cmdq_list, cmdq_item);
|
2012-07-11 07:10:15 +00:00
|
|
|
|
2015-12-14 00:31:54 +00:00
|
|
|
/* Command -c, -t or -s flags. */
|
|
|
|
enum cmd_entry_flag {
|
|
|
|
CMD_NONE,
|
|
|
|
|
|
|
|
CMD_CLIENT,
|
|
|
|
CMD_CLIENT_CANFAIL,
|
|
|
|
|
|
|
|
CMD_SESSION,
|
|
|
|
CMD_SESSION_CANFAIL,
|
|
|
|
CMD_SESSION_PREFERUNATTACHED,
|
2016-12-28 10:34:34 +00:00
|
|
|
CMD_SESSION_WITHPANE, /* implies PREFERUNATTACHED */
|
2015-12-14 00:31:54 +00:00
|
|
|
|
|
|
|
CMD_WINDOW,
|
|
|
|
CMD_WINDOW_CANFAIL,
|
|
|
|
CMD_WINDOW_MARKED,
|
|
|
|
CMD_WINDOW_INDEX,
|
|
|
|
|
|
|
|
CMD_PANE,
|
|
|
|
CMD_PANE_CANFAIL,
|
|
|
|
CMD_PANE_MARKED,
|
|
|
|
|
|
|
|
CMD_MOVEW_R,
|
|
|
|
};
|
|
|
|
|
2013-03-24 09:54:10 +00:00
|
|
|
/* Command definition. */
|
2009-06-01 22:58:49 +00:00
|
|
|
struct cmd_entry {
|
2015-12-13 21:53:57 +00:00
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
2011-01-04 00:42:46 +00:00
|
|
|
|
2015-12-13 21:53:57 +00:00
|
|
|
struct {
|
|
|
|
const char *template;
|
|
|
|
int lower;
|
|
|
|
int upper;
|
|
|
|
} args;
|
|
|
|
const char *usage;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-12-14 00:31:54 +00:00
|
|
|
enum cmd_entry_flag tflag;
|
|
|
|
enum cmd_entry_flag sflag;
|
|
|
|
enum cmd_entry_flag cflag;
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
#define CMD_STARTSERVER 0x1
|
2015-06-04 23:27:51 +00:00
|
|
|
#define CMD_READONLY 0x2
|
2016-10-13 22:48:51 +00:00
|
|
|
#define CMD_AFTERHOOK 0x4
|
2015-12-14 00:31:54 +00:00
|
|
|
int flags;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmd_retval (*exec)(struct cmd *, struct cmdq_item *);
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
2016-10-16 17:55:14 +00:00
|
|
|
/* Client connection. */
|
|
|
|
struct client {
|
|
|
|
struct tmuxpeer *peer;
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_list queue;
|
2016-10-16 17:55:14 +00:00
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
int fd;
|
|
|
|
struct event event;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
struct timeval creation_time;
|
|
|
|
struct timeval activity_time;
|
|
|
|
|
|
|
|
struct environ *environ;
|
|
|
|
|
|
|
|
char *title;
|
|
|
|
const char *cwd;
|
|
|
|
|
|
|
|
char *term;
|
|
|
|
char *ttyname;
|
|
|
|
struct tty tty;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
struct event repeat_timer;
|
|
|
|
|
|
|
|
struct event click_timer;
|
|
|
|
u_int click_button;
|
|
|
|
|
|
|
|
struct event status_timer;
|
|
|
|
struct screen status;
|
|
|
|
|
|
|
|
#define CLIENT_TERMINAL 0x1
|
|
|
|
#define CLIENT_LOGIN 0x2
|
|
|
|
#define CLIENT_EXIT 0x4
|
|
|
|
#define CLIENT_REDRAW 0x8
|
|
|
|
#define CLIENT_STATUS 0x10
|
|
|
|
#define CLIENT_REPEAT 0x20
|
|
|
|
#define CLIENT_SUSPENDED 0x40
|
|
|
|
#define CLIENT_ATTACHED 0x80
|
|
|
|
#define CLIENT_IDENTIFY 0x100
|
|
|
|
#define CLIENT_DEAD 0x200
|
|
|
|
#define CLIENT_BORDERS 0x400
|
|
|
|
#define CLIENT_READONLY 0x800
|
|
|
|
#define CLIENT_REDRAWWINDOW 0x1000
|
|
|
|
#define CLIENT_CONTROL 0x2000
|
|
|
|
#define CLIENT_CONTROLCONTROL 0x4000
|
|
|
|
#define CLIENT_FOCUSED 0x8000
|
|
|
|
#define CLIENT_UTF8 0x10000
|
|
|
|
#define CLIENT_256COLOURS 0x20000
|
|
|
|
#define CLIENT_IDENTIFIED 0x40000
|
|
|
|
#define CLIENT_STATUSFORCE 0x80000
|
|
|
|
#define CLIENT_DOUBLECLICK 0x100000
|
|
|
|
#define CLIENT_TRIPLECLICK 0x200000
|
|
|
|
int flags;
|
|
|
|
struct key_table *keytable;
|
|
|
|
|
|
|
|
struct event identify_timer;
|
|
|
|
void (*identify_callback)(struct client *, struct window_pane *);
|
|
|
|
void *identify_callback_data;
|
|
|
|
|
|
|
|
char *message_string;
|
|
|
|
struct event message_timer;
|
|
|
|
u_int message_next;
|
|
|
|
TAILQ_HEAD(, message_entry) message_log;
|
|
|
|
|
|
|
|
char *prompt_string;
|
|
|
|
struct utf8_data *prompt_buffer;
|
|
|
|
size_t prompt_index;
|
2017-01-06 11:57:03 +00:00
|
|
|
int (*prompt_callbackfn)(void *, const char *, int);
|
2016-10-16 17:55:14 +00:00
|
|
|
void (*prompt_freefn)(void *);
|
|
|
|
void *prompt_data;
|
|
|
|
u_int prompt_hindex;
|
|
|
|
enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
|
|
|
|
|
|
|
|
#define PROMPT_SINGLE 0x1
|
|
|
|
#define PROMPT_NUMERIC 0x2
|
2017-01-06 11:57:03 +00:00
|
|
|
#define PROMPT_INCREMENTAL 0x4
|
2016-10-16 17:55:14 +00:00
|
|
|
int prompt_flags;
|
|
|
|
|
|
|
|
struct session *session;
|
|
|
|
struct session *last_session;
|
|
|
|
|
|
|
|
int wlmouse;
|
|
|
|
|
|
|
|
int references;
|
|
|
|
|
|
|
|
TAILQ_ENTRY(client) entry;
|
|
|
|
};
|
|
|
|
TAILQ_HEAD(clients, client);
|
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
/* Key binding and key table. */
|
2009-06-01 22:58:49 +00:00
|
|
|
struct key_binding {
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key;
|
2015-04-20 15:34:56 +00:00
|
|
|
struct cmd_list *cmdlist;
|
|
|
|
int can_repeat;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
RB_ENTRY(key_binding) entry;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
2012-01-21 11:12:13 +00:00
|
|
|
RB_HEAD(key_bindings, key_binding);
|
2015-05-08 16:33:29 +00:00
|
|
|
|
2015-04-20 15:34:56 +00:00
|
|
|
struct key_table {
|
|
|
|
const char *name;
|
|
|
|
struct key_bindings key_bindings;
|
|
|
|
|
|
|
|
u_int references;
|
|
|
|
|
|
|
|
RB_ENTRY(key_table) entry;
|
|
|
|
};
|
|
|
|
RB_HEAD(key_tables, key_table);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2017-01-16 14:49:14 +00:00
|
|
|
/* Option table entries. */
|
2011-01-01 16:51:21 +00:00
|
|
|
enum options_table_type {
|
|
|
|
OPTIONS_TABLE_STRING,
|
|
|
|
OPTIONS_TABLE_NUMBER,
|
2012-01-21 08:40:09 +00:00
|
|
|
OPTIONS_TABLE_KEY,
|
2011-01-01 16:51:21 +00:00
|
|
|
OPTIONS_TABLE_COLOUR,
|
|
|
|
OPTIONS_TABLE_ATTRIBUTES,
|
|
|
|
OPTIONS_TABLE_FLAG,
|
2014-01-28 23:07:09 +00:00
|
|
|
OPTIONS_TABLE_CHOICE,
|
2017-01-15 20:48:41 +00:00
|
|
|
OPTIONS_TABLE_STYLE,
|
|
|
|
OPTIONS_TABLE_ARRAY,
|
2011-01-01 16:51:21 +00:00
|
|
|
};
|
2015-11-20 12:01:19 +00:00
|
|
|
enum options_table_scope {
|
2015-11-24 09:34:55 +00:00
|
|
|
OPTIONS_TABLE_NONE,
|
2015-11-20 12:01:19 +00:00
|
|
|
OPTIONS_TABLE_SERVER,
|
|
|
|
OPTIONS_TABLE_SESSION,
|
|
|
|
OPTIONS_TABLE_WINDOW,
|
|
|
|
};
|
2011-01-01 16:51:21 +00:00
|
|
|
|
|
|
|
struct options_table_entry {
|
2015-11-20 12:01:19 +00:00
|
|
|
const char *name;
|
|
|
|
enum options_table_type type;
|
|
|
|
enum options_table_scope scope;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-20 12:01:19 +00:00
|
|
|
u_int minimum;
|
|
|
|
u_int maximum;
|
|
|
|
const char **choices;
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-11-20 12:01:19 +00:00
|
|
|
const char *default_str;
|
|
|
|
long long default_num;
|
2014-01-28 23:07:09 +00:00
|
|
|
|
2017-01-24 19:11:46 +00:00
|
|
|
const char *separator;
|
2015-11-20 12:01:19 +00:00
|
|
|
const char *style;
|
2009-06-01 22:58:49 +00:00
|
|
|
};
|
|
|
|
|
2011-01-04 00:42:46 +00: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]"
|
2014-05-13 07:34:35 +00:00
|
|
|
#define CMD_BUFFER_USAGE "[-b buffer-name]"
|
2011-01-04 00:42:46 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* tmux.c */
|
2015-12-08 01:10:31 +00:00
|
|
|
extern struct hooks *global_hooks;
|
|
|
|
extern struct options *global_options;
|
|
|
|
extern struct options *global_s_options;
|
|
|
|
extern struct options *global_w_options;
|
|
|
|
extern struct environ *global_environ;
|
2015-11-24 21:52:06 +00:00
|
|
|
extern struct timeval start_time;
|
2015-11-24 22:27:22 +00:00
|
|
|
extern const char *socket_path;
|
2017-01-23 10:09:43 +00:00
|
|
|
extern int ptm_fd;
|
2009-09-01 13:09:49 +00:00
|
|
|
int areshell(const char *);
|
2011-01-08 01:52:36 +00:00
|
|
|
void setblocking(int, int);
|
2015-07-20 15:50:04 +00:00
|
|
|
const char *find_home(void);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-10-27 13:23:24 +00:00
|
|
|
/* proc.c */
|
|
|
|
struct imsg;
|
|
|
|
int proc_send(struct tmuxpeer *, enum msgtype, int, const void *, size_t);
|
|
|
|
int proc_send_s(struct tmuxpeer *, enum msgtype, const char *);
|
|
|
|
struct tmuxproc *proc_start(const char *, struct event_base *, int,
|
|
|
|
void (*)(int));
|
|
|
|
void proc_loop(struct tmuxproc *, int (*)(void));
|
|
|
|
void proc_exit(struct tmuxproc *);
|
|
|
|
struct tmuxpeer *proc_add_peer(struct tmuxproc *, int,
|
|
|
|
void (*)(struct imsg *, void *), void *);
|
|
|
|
void proc_remove_peer(struct tmuxpeer *);
|
|
|
|
void proc_kill_peer(struct tmuxpeer *);
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* cfg.c */
|
2013-03-24 09:54:10 +00:00
|
|
|
extern int cfg_finished;
|
2013-10-20 17:28:43 +00:00
|
|
|
extern struct client *cfg_client;
|
2016-10-16 19:04:05 +00:00
|
|
|
void start_cfg(void);
|
|
|
|
int load_cfg(const char *, struct client *, struct cmdq_item *, int);
|
|
|
|
void set_cfg_file(const char *);
|
2016-01-15 11:31:47 +00:00
|
|
|
void printflike(1, 2) cfg_add_cause(const char *, ...);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cfg_print_causes(struct cmdq_item *);
|
|
|
|
void cfg_show_causes(struct session *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-08-29 09:25:00 +00:00
|
|
|
/* paste.c */
|
|
|
|
struct paste_buffer;
|
|
|
|
const char *paste_buffer_name(struct paste_buffer *);
|
2016-10-05 12:34:05 +00:00
|
|
|
u_int paste_buffer_order(struct paste_buffer *);
|
|
|
|
time_t paste_buffer_created(struct paste_buffer *);
|
2015-08-29 09:25:00 +00:00
|
|
|
const char *paste_buffer_data(struct paste_buffer *, size_t *);
|
|
|
|
struct paste_buffer *paste_walk(struct paste_buffer *);
|
|
|
|
struct paste_buffer *paste_get_top(const char **);
|
|
|
|
struct paste_buffer *paste_get_name(const char *);
|
2015-09-11 14:41:50 +00:00
|
|
|
void paste_free(struct paste_buffer *);
|
2015-08-29 09:25:00 +00:00
|
|
|
void paste_add(char *, size_t);
|
|
|
|
int paste_rename(const char *, const char *, char **);
|
|
|
|
int paste_set(char *, size_t, const char *, char **);
|
2015-11-12 11:09:11 +00:00
|
|
|
char *paste_make_sample(struct paste_buffer *);
|
2015-08-29 09:25:00 +00:00
|
|
|
|
2011-08-26 10:53:16 +00:00
|
|
|
/* format.c */
|
2015-09-14 10:25:52 +00:00
|
|
|
#define FORMAT_STATUS 0x1
|
|
|
|
#define FORMAT_FORCE 0x2
|
2017-01-09 21:03:25 +00:00
|
|
|
#define FORMAT_NOJOBS 0x4
|
2017-02-03 11:57:27 +00:00
|
|
|
#define FORMAT_NONE 0
|
|
|
|
#define FORMAT_PANE 0x80000000U
|
|
|
|
#define FORMAT_WINDOW 0x40000000U
|
2014-12-02 23:19:45 +00:00
|
|
|
struct format_tree;
|
2017-02-03 11:57:27 +00:00
|
|
|
struct format_tree *format_create(struct cmdq_item *, int, int);
|
2011-08-26 10:53:16 +00:00
|
|
|
void format_free(struct format_tree *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(3, 4) format_add(struct format_tree *, const char *,
|
|
|
|
const char *, ...);
|
2015-02-06 17:11:39 +00:00
|
|
|
char *format_expand_time(struct format_tree *, const char *, time_t);
|
2011-08-26 10:53:16 +00:00
|
|
|
char *format_expand(struct format_tree *, const char *);
|
2015-02-05 10:29:43 +00:00
|
|
|
void format_defaults(struct format_tree *, struct client *,
|
|
|
|
struct session *, struct winlink *, struct window_pane *);
|
|
|
|
void format_defaults_window(struct format_tree *, struct window *);
|
|
|
|
void format_defaults_pane(struct format_tree *,
|
2013-10-10 12:09:34 +00:00
|
|
|
struct window_pane *);
|
2015-02-05 10:29:43 +00:00
|
|
|
void format_defaults_paste_buffer(struct format_tree *,
|
2015-11-12 11:09:11 +00:00
|
|
|
struct paste_buffer *);
|
2011-08-26 10:53:16 +00:00
|
|
|
|
2015-12-08 01:10:31 +00:00
|
|
|
/* hooks.c */
|
|
|
|
struct hook;
|
2016-10-13 20:27:27 +00:00
|
|
|
struct hooks *hooks_get(struct session *);
|
2015-12-08 01:10:31 +00:00
|
|
|
struct hooks *hooks_create(struct hooks *);
|
|
|
|
void hooks_free(struct hooks *);
|
|
|
|
struct hook *hooks_first(struct hooks *);
|
|
|
|
struct hook *hooks_next(struct hook *);
|
|
|
|
void hooks_add(struct hooks *, const char *, struct cmd_list *);
|
|
|
|
void hooks_copy(struct hooks *, struct hooks *);
|
2015-12-11 15:46:57 +00:00
|
|
|
void hooks_remove(struct hooks *, const char *);
|
2015-12-08 01:10:31 +00:00
|
|
|
struct hook *hooks_find(struct hooks *, const char *);
|
2016-10-16 17:55:14 +00:00
|
|
|
void printflike(4, 5) hooks_run(struct hooks *, struct client *,
|
2015-12-16 22:05:35 +00:00
|
|
|
struct cmd_find_state *, const char *, ...);
|
2016-10-16 19:04:05 +00:00
|
|
|
void printflike(4, 5) hooks_insert(struct hooks *, struct cmdq_item *,
|
2015-12-16 22:05:35 +00:00
|
|
|
struct cmd_find_state *, const char *, ...);
|
2015-12-08 01:10:31 +00:00
|
|
|
|
2012-03-17 22:35:09 +00:00
|
|
|
/* notify.c */
|
2012-09-25 07:41:22 +00:00
|
|
|
void notify_input(struct window_pane *, struct evbuffer *);
|
2016-10-16 22:06:40 +00:00
|
|
|
void notify_client(const char *, struct client *);
|
|
|
|
void notify_session(const char *, struct session *);
|
2016-10-16 22:18:04 +00:00
|
|
|
void notify_winlink(const char *, struct session *, struct winlink *);
|
2016-10-16 22:06:40 +00:00
|
|
|
void notify_session_window(const char *, struct session *, struct window *);
|
|
|
|
void notify_window(const char *, struct window *);
|
|
|
|
void notify_pane(const char *, struct window_pane *);
|
2012-03-17 22:35:09 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* options.c */
|
2017-01-15 20:48:41 +00:00
|
|
|
struct options *options_create(struct options *);
|
|
|
|
void options_free(struct options *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_first(struct options *);
|
|
|
|
struct options_entry *options_next(struct options_entry *);
|
|
|
|
struct options_entry *options_empty(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const struct options_table_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_default(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const struct options_table_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
const char *options_name(struct options_entry *);
|
|
|
|
const struct options_table_entry *options_table_entry(struct options_entry *);
|
|
|
|
struct options_entry *options_get_only(struct options *, const char *);
|
|
|
|
struct options_entry *options_get(struct options *, const char *);
|
|
|
|
void options_remove(struct options_entry *);
|
2017-01-24 19:11:46 +00:00
|
|
|
void options_array_clear(struct options_entry *);
|
2017-01-16 14:49:14 +00:00
|
|
|
const char *options_array_get(struct options_entry *, u_int);
|
2017-01-24 19:11:46 +00:00
|
|
|
int options_array_set(struct options_entry *, u_int, const char *,
|
|
|
|
int);
|
2017-01-16 14:49:14 +00:00
|
|
|
int options_array_size(struct options_entry *, u_int *);
|
2017-01-24 19:11:46 +00:00
|
|
|
void options_array_assign(struct options_entry *, const char *);
|
2017-01-16 14:49:14 +00:00
|
|
|
int options_isstring(struct options_entry *);
|
2017-01-30 21:41:17 +00:00
|
|
|
const char *options_tostring(struct options_entry *, int, int);
|
2017-01-15 20:48:41 +00:00
|
|
|
char *options_parse(const char *, int *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_parse_get(struct options *, const char *, int *,
|
2017-01-24 19:11:46 +00:00
|
|
|
int);
|
2017-01-15 20:48:41 +00:00
|
|
|
char *options_match(const char *, int *, int *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_match_get(struct options *, const char *, int *,
|
2017-01-24 19:11:46 +00:00
|
|
|
int, int *);
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *options_get_string(struct options *, const char *);
|
|
|
|
long long options_get_number(struct options *, const char *);
|
2017-01-13 11:58:49 +00:00
|
|
|
const struct grid_cell *options_get_style(struct options *, const char *);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry * printflike(4, 5) options_set_string(struct options *,
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *, int, const char *, ...);
|
2017-01-16 14:49:14 +00:00
|
|
|
struct options_entry *options_set_number(struct options *, const char *,
|
|
|
|
long long);
|
|
|
|
struct options_entry *options_set_style(struct options *, const char *, int,
|
2017-01-15 20:48:41 +00:00
|
|
|
const char *);
|
|
|
|
enum options_table_scope options_scope_from_flags(struct args *, int,
|
|
|
|
struct cmd_find_state *, struct options **, char **);
|
2017-01-16 14:49:14 +00:00
|
|
|
void options_style_update_new(struct options *,
|
|
|
|
struct options_entry *);
|
|
|
|
void options_style_update_old(struct options *,
|
|
|
|
struct options_entry *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2011-01-01 16:51:21 +00:00
|
|
|
/* options-table.c */
|
2015-11-20 12:01:19 +00:00
|
|
|
extern const struct options_table_entry options_table[];
|
2011-01-01 16:51:21 +00:00
|
|
|
|
2009-10-10 15:03:01 +00:00
|
|
|
/* job.c */
|
2009-10-10 18:42:14 +00:00
|
|
|
extern struct joblist all_jobs;
|
2015-10-31 08:13:58 +00:00
|
|
|
struct job *job_run(const char *, struct session *, const char *,
|
2013-03-25 11:44:00 +00:00
|
|
|
void (*)(struct job *), void (*)(void *), void *);
|
2009-10-10 15:03:01 +00:00
|
|
|
void job_free(struct job *);
|
2009-11-04 21:04:43 +00:00
|
|
|
void job_died(struct job *, int);
|
2009-10-10 15:03:01 +00:00
|
|
|
|
2009-08-08 21:52:43 +00:00
|
|
|
/* environ.c */
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ *environ_create(void);
|
2009-08-08 21:52:43 +00:00
|
|
|
void environ_free(struct environ *);
|
2015-10-28 09:51:55 +00:00
|
|
|
struct environ_entry *environ_first(struct environ *);
|
|
|
|
struct environ_entry *environ_next(struct environ_entry *);
|
2009-08-08 21:52:43 +00:00
|
|
|
void environ_copy(struct environ *, struct environ *);
|
|
|
|
struct environ_entry *environ_find(struct environ *, const char *);
|
2015-11-24 23:46:15 +00:00
|
|
|
void printflike(3, 4) environ_set(struct environ *, const char *, const char *,
|
|
|
|
...);
|
|
|
|
void environ_clear(struct environ *, const char *);
|
2009-08-08 21:52:43 +00:00
|
|
|
void environ_put(struct environ *, const char *);
|
|
|
|
void environ_unset(struct environ *, const char *);
|
2017-01-24 20:15:32 +00:00
|
|
|
void environ_update(struct options *, struct environ *, struct environ *);
|
2010-04-04 19:02:09 +00:00
|
|
|
void environ_push(struct environ *);
|
2016-07-15 09:52:34 +00:00
|
|
|
void environ_log(struct environ *, const char *);
|
2009-08-08 21:52:43 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* tty.c */
|
2015-10-31 13:12:03 +00:00
|
|
|
void tty_create_log(void);
|
2009-09-23 06:18:47 +00:00
|
|
|
void tty_raw(struct tty *, const char *);
|
2015-04-19 21:05:27 +00:00
|
|
|
void tty_attributes(struct tty *, const struct grid_cell *,
|
|
|
|
const struct window_pane *);
|
2009-07-22 18:02:23 +00:00
|
|
|
void tty_reset(struct tty *);
|
2016-11-15 15:17:28 +00:00
|
|
|
void tty_region_off(struct tty *);
|
|
|
|
void tty_margin_off(struct tty *);
|
2009-10-12 09:29:58 +00:00
|
|
|
void tty_cursor(struct tty *, u_int, u_int);
|
2009-07-22 18:02:23 +00: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 19:03:58 +00:00
|
|
|
void tty_putcode_ptr1(struct tty *, enum tty_code_code, const void *);
|
2013-01-18 02:16:21 +00:00
|
|
|
void tty_putcode_ptr2(struct tty *, enum tty_code_code, const void *,
|
|
|
|
const void *);
|
2009-07-22 18:02:23 +00:00
|
|
|
void tty_puts(struct tty *, const char *);
|
|
|
|
void tty_putc(struct tty *, u_char);
|
2013-01-18 02:16:21 +00:00
|
|
|
void tty_putn(struct tty *, const void *, size_t, u_int);
|
2015-07-13 15:51:31 +00:00
|
|
|
int tty_init(struct tty *, struct client *, int, char *);
|
2010-06-05 16:47:11 +00:00
|
|
|
int tty_resize(struct tty *);
|
2012-03-17 22:56:04 +00:00
|
|
|
int tty_set_size(struct tty *, u_int, u_int);
|
2009-07-22 18:02:23 +00:00
|
|
|
void tty_start_tty(struct tty *);
|
|
|
|
void tty_stop_tty(struct tty *);
|
|
|
|
void tty_set_title(struct tty *, const char *);
|
2011-05-20 19:03:58 +00:00
|
|
|
void tty_update_mode(struct tty *, int, struct screen *);
|
2015-04-19 21:05:27 +00:00
|
|
|
void tty_draw_pane(struct tty *, const struct window_pane *, u_int, u_int,
|
|
|
|
u_int);
|
|
|
|
void tty_draw_line(struct tty *, const struct window_pane *, struct screen *,
|
|
|
|
u_int, u_int, u_int);
|
2014-02-23 00:53:06 +00:00
|
|
|
int tty_open(struct tty *, char **);
|
2009-08-11 19:32:25 +00:00
|
|
|
void tty_close(struct tty *);
|
|
|
|
void tty_free(struct tty *);
|
2016-11-15 14:02:32 +00:00
|
|
|
void tty_set_type(struct tty *, int);
|
2015-05-12 22:40:38 +00:00
|
|
|
void tty_write(void (*)(struct tty *, const struct tty_ctx *),
|
|
|
|
struct tty_ctx *);
|
2009-08-12 09:41:59 +00:00
|
|
|
void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
|
|
|
|
void tty_cmd_cell(struct tty *, const struct tty_ctx *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void tty_cmd_cells(struct tty *, const struct tty_ctx *);
|
2009-08-12 09:41:59 +00:00
|
|
|
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-15 23:18:55 +00:00
|
|
|
void tty_cmd_clearcharacter(struct tty *, const struct tty_ctx *);
|
2009-08-12 09:41:59 +00:00
|
|
|
void tty_cmd_deleteline(struct tty *, const struct tty_ctx *);
|
2011-04-19 21:31:33 +00:00
|
|
|
void tty_cmd_erasecharacter(struct tty *, const struct tty_ctx *);
|
2009-08-12 09:41:59 +00: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 *);
|
2017-02-08 17:31:09 +00:00
|
|
|
void tty_cmd_scrollup(struct tty *, const struct tty_ctx *);
|
2009-08-12 09:41:59 +00:00
|
|
|
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
2011-05-18 20:24:29 +00:00
|
|
|
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
|
2011-03-07 23:46:27 +00:00
|
|
|
void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* tty-term.c */
|
|
|
|
extern struct tty_terms tty_terms;
|
2015-07-28 15:18:10 +00:00
|
|
|
u_int tty_term_ncodes(void);
|
2014-02-23 00:53:06 +00:00
|
|
|
struct tty_term *tty_term_find(char *, int, char **);
|
2009-12-03 22:50:09 +00:00
|
|
|
void tty_term_free(struct tty_term *);
|
2009-06-01 22:58:49 +00: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);
|
2015-12-11 16:37:21 +00:00
|
|
|
const char *tty_term_string2(struct tty_term *, enum tty_code_code, int,
|
|
|
|
int);
|
|
|
|
const char *tty_term_ptr1(struct tty_term *, enum tty_code_code,
|
|
|
|
const void *);
|
2012-11-27 20:22:12 +00:00
|
|
|
const char *tty_term_ptr2(struct tty_term *, enum tty_code_code,
|
|
|
|
const void *, const void *);
|
2009-06-01 22:58:49 +00:00
|
|
|
int tty_term_number(struct tty_term *, enum tty_code_code);
|
|
|
|
int tty_term_flag(struct tty_term *, enum tty_code_code);
|
2015-07-28 15:18:10 +00:00
|
|
|
const char *tty_term_describe(struct tty_term *, enum tty_code_code);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2010-09-11 16:19:22 +00:00
|
|
|
/* tty-acs.c */
|
|
|
|
const char *tty_acs_get(struct tty *, u_char);
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* tty-keys.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
void tty_keys_build(struct tty *);
|
|
|
|
void tty_keys_free(struct tty *);
|
|
|
|
key_code tty_keys_next(struct tty *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2011-01-04 00:42:46 +00:00
|
|
|
/* arguments.c */
|
|
|
|
struct args *args_parse(const char *, int, char **);
|
|
|
|
void args_free(struct args *);
|
2015-11-27 15:06:43 +00:00
|
|
|
char *args_print(struct args *);
|
2011-01-04 00:42:46 +00:00
|
|
|
int args_has(struct args *, u_char);
|
|
|
|
const char *args_get(struct args *, u_char);
|
2015-04-27 16:25:57 +00:00
|
|
|
long long args_strtonum(struct args *, u_char, long long, long long,
|
|
|
|
char **);
|
|
|
|
|
|
|
|
/* cmd-find.c */
|
2016-10-16 19:04:05 +00:00
|
|
|
int cmd_find_current(struct cmd_find_state *, struct cmdq_item *,
|
2016-01-19 16:01:30 +00:00
|
|
|
int);
|
|
|
|
int cmd_find_target(struct cmd_find_state *,
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmd_find_state *, struct cmdq_item *, const char *,
|
2016-01-19 16:01:30 +00:00
|
|
|
enum cmd_find_type, int);
|
2016-10-16 19:04:05 +00:00
|
|
|
struct client *cmd_find_client(struct cmdq_item *, const char *, int);
|
|
|
|
void cmd_find_clear_state(struct cmd_find_state *,
|
|
|
|
struct cmdq_item *, int);
|
2016-10-13 10:01:49 +00:00
|
|
|
int cmd_find_empty_state(struct cmd_find_state *);
|
2015-12-15 00:00:01 +00:00
|
|
|
int cmd_find_valid_state(struct cmd_find_state *);
|
|
|
|
void cmd_find_copy_state(struct cmd_find_state *,
|
|
|
|
struct cmd_find_state *);
|
2015-12-14 23:30:58 +00:00
|
|
|
void cmd_find_log_state(const char *, struct cmd_find_state *);
|
2015-12-16 22:05:35 +00:00
|
|
|
int cmd_find_from_session(struct cmd_find_state *,
|
|
|
|
struct session *);
|
2016-01-16 00:36:53 +00:00
|
|
|
int cmd_find_from_winlink(struct cmd_find_state *,
|
|
|
|
struct session *, struct winlink *);
|
2016-10-15 00:09:30 +00:00
|
|
|
int cmd_find_from_session_window(struct cmd_find_state *,
|
|
|
|
struct session *, struct window *);
|
2015-12-16 22:05:35 +00:00
|
|
|
int cmd_find_from_window(struct cmd_find_state *, struct window *);
|
|
|
|
int cmd_find_from_pane(struct cmd_find_state *,
|
|
|
|
struct window_pane *);
|
2011-01-04 00:42:46 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* cmd.c */
|
2009-07-26 12:58:44 +00:00
|
|
|
int cmd_pack_argv(int, char **, char *, size_t);
|
|
|
|
int cmd_unpack_argv(char *, size_t, int, char ***);
|
2014-05-09 09:11:24 +00:00
|
|
|
char **cmd_copy_argv(int, char **);
|
2009-07-26 12:58:44 +00:00
|
|
|
void cmd_free_argv(int, char **);
|
2014-05-13 08:08:32 +00:00
|
|
|
char *cmd_stringify_argv(int, char **);
|
2013-03-24 09:54:10 +00:00
|
|
|
struct cmd *cmd_parse(int, char **, const char *, u_int, char **);
|
2016-10-16 19:04:05 +00:00
|
|
|
int cmd_prepare_state(struct cmd *, struct cmdq_item *);
|
2015-11-27 15:06:43 +00:00
|
|
|
char *cmd_print(struct cmd *);
|
2015-04-19 21:34:21 +00:00
|
|
|
int cmd_mouse_at(struct window_pane *, struct mouse_event *,
|
|
|
|
u_int *, u_int *, int);
|
|
|
|
struct winlink *cmd_mouse_window(struct mouse_event *, struct session **);
|
|
|
|
struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
|
|
|
|
struct winlink **);
|
2013-03-21 16:19:25 +00:00
|
|
|
char *cmd_template_replace(const char *, const char *, int);
|
2009-06-01 22:58:49 +00:00
|
|
|
extern const struct cmd_entry *cmd_table[];
|
|
|
|
|
2013-03-24 09:58:40 +00:00
|
|
|
/* cmd-attach-session.c */
|
2016-10-16 19:04:05 +00:00
|
|
|
enum cmd_retval cmd_attach_session(struct cmdq_item *, int, int, const char *,
|
|
|
|
int);
|
2013-03-24 09:58:40 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* cmd-list.c */
|
2013-03-24 09:54:10 +00:00
|
|
|
struct cmd_list *cmd_list_parse(int, char **, const char *, u_int, char **);
|
2009-06-01 22:58:49 +00:00
|
|
|
void cmd_list_free(struct cmd_list *);
|
2015-11-27 15:06:43 +00:00
|
|
|
char *cmd_list_print(struct cmd_list *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2013-03-24 09:54:10 +00:00
|
|
|
/* cmd-queue.c */
|
2016-10-16 19:04:05 +00:00
|
|
|
struct cmdq_item *cmdq_get_command(struct cmd_list *, struct cmd_find_state *,
|
2016-10-16 17:55:14 +00:00
|
|
|
struct mouse_event *, int);
|
2016-10-18 08:46:43 +00:00
|
|
|
#define cmdq_get_callback(cb, data) cmdq_get_callback1(#cb, cb, data)
|
|
|
|
struct cmdq_item *cmdq_get_callback1(const char *, cmdq_cb, void *);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cmdq_insert_after(struct cmdq_item *, struct cmdq_item *);
|
|
|
|
void cmdq_append(struct client *, struct cmdq_item *);
|
2016-10-16 19:36:37 +00:00
|
|
|
void printflike(3, 4) cmdq_format(struct cmdq_item *, const char *,
|
|
|
|
const char *, ...);
|
2016-10-16 17:55:14 +00:00
|
|
|
u_int cmdq_next(struct client *);
|
2016-10-16 19:04:05 +00:00
|
|
|
void cmdq_guard(struct cmdq_item *, const char *, int);
|
|
|
|
void printflike(2, 3) cmdq_print(struct cmdq_item *, const char *, ...);
|
|
|
|
void printflike(2, 3) cmdq_error(struct cmdq_item *, const char *, ...);
|
2013-03-24 09:54:10 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* cmd-string.c */
|
2017-01-24 19:53:37 +00:00
|
|
|
int cmd_string_split(const char *, int *, char ***);
|
2017-01-15 22:00:56 +00:00
|
|
|
struct cmd_list *cmd_string_parse(const char *, const char *, u_int, char **);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2014-09-01 21:58:41 +00:00
|
|
|
/* cmd-wait-for.c */
|
|
|
|
void cmd_wait_for_flush(void);
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* client.c */
|
2015-11-24 23:22:51 +00:00
|
|
|
int client_main(struct event_base *, int, char **, int, const char *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* key-bindings.c */
|
2012-01-21 11:12:13 +00:00
|
|
|
RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
|
2015-04-20 15:34:56 +00:00
|
|
|
RB_PROTOTYPE(key_tables, key_table, entry, key_table_cmp);
|
|
|
|
extern struct key_tables key_tables;
|
|
|
|
int key_table_cmp(struct key_table *, struct key_table *);
|
|
|
|
int key_bindings_cmp(struct key_binding *, struct key_binding *);
|
2015-11-24 23:46:15 +00:00
|
|
|
struct key_table *key_bindings_get_table(const char *, int);
|
2015-05-08 16:48:12 +00:00
|
|
|
void key_bindings_unref_table(struct key_table *);
|
2015-11-12 11:05:34 +00:00
|
|
|
void key_bindings_add(const char *, key_code, int, struct cmd_list *);
|
|
|
|
void key_bindings_remove(const char *, key_code);
|
2015-04-20 15:34:56 +00:00
|
|
|
void key_bindings_remove_table(const char *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void key_bindings_init(void);
|
2015-04-19 21:34:21 +00:00
|
|
|
void key_bindings_dispatch(struct key_binding *, struct client *,
|
2016-11-23 17:01:24 +00:00
|
|
|
struct mouse_event *, struct cmd_find_state *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* key-string.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
key_code key_string_lookup_string(const char *);
|
|
|
|
const char *key_string_lookup_key(key_code);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2015-08-29 08:30:54 +00:00
|
|
|
/* alerts.c */
|
|
|
|
void alerts_reset_all(void);
|
|
|
|
void alerts_queue(struct window *, int);
|
2015-12-07 09:47:41 +00:00
|
|
|
void alerts_check_session(struct session *);
|
2015-08-29 08:30:54 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* server.c */
|
2015-10-27 13:23:24 +00:00
|
|
|
extern struct tmuxproc *server_proc;
|
2009-06-01 22:58:49 +00:00
|
|
|
extern struct clients clients;
|
2015-12-15 00:00:01 +00:00
|
|
|
extern struct cmd_find_state marked_pane;
|
2015-06-04 11:43:51 +00:00
|
|
|
void server_set_marked(struct session *, struct winlink *,
|
|
|
|
struct window_pane *);
|
|
|
|
void server_clear_marked(void);
|
|
|
|
int server_is_marked(struct session *, struct winlink *,
|
|
|
|
struct window_pane *);
|
|
|
|
int server_check_marked(void);
|
2015-08-30 22:19:07 +00:00
|
|
|
int server_start(struct event_base *, int, char *);
|
2009-11-11 08:00:42 +00:00
|
|
|
void server_update_socket(void);
|
2012-04-11 06:16:14 +00:00
|
|
|
void server_add_accept(int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-10-22 19:41:51 +00:00
|
|
|
/* server-client.c */
|
2015-12-12 18:32:24 +00:00
|
|
|
void server_client_set_key_table(struct client *, const char *);
|
|
|
|
const char *server_client_get_key_table(struct client *);
|
2016-10-11 07:23:34 +00:00
|
|
|
int server_client_is_default_key_table(struct client *);
|
2015-06-04 23:27:51 +00:00
|
|
|
int server_client_check_nested(struct client *);
|
2015-11-12 11:05:34 +00:00
|
|
|
void server_client_handle_key(struct client *, key_code);
|
2009-10-22 19:41:51 +00:00
|
|
|
void server_client_create(int);
|
2015-05-08 16:48:12 +00:00
|
|
|
int server_client_open(struct client *, char **);
|
2015-06-05 18:06:30 +00:00
|
|
|
void server_client_unref(struct client *);
|
2009-10-22 19:41:51 +00:00
|
|
|
void server_client_lost(struct client *);
|
2015-12-08 01:10:31 +00:00
|
|
|
void server_client_detach(struct client *, enum msgtype);
|
2017-01-13 10:12:12 +00:00
|
|
|
void server_client_exec(struct client *, const char *);
|
2009-10-22 19:41:51 +00:00
|
|
|
void server_client_loop(void);
|
2015-11-14 09:41:06 +00:00
|
|
|
void server_client_push_stdout(struct client *);
|
|
|
|
void server_client_push_stderr(struct client *);
|
2017-02-09 12:09:33 +00:00
|
|
|
void printflike(2, 3) server_client_add_message(struct client *, const char *,
|
|
|
|
...);
|
2017-02-14 18:13:05 +00:00
|
|
|
char *server_client_get_path(struct client *, const char *);
|
|
|
|
const char *server_client_get_cwd(struct client *);
|
2009-10-22 19:41:51 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* server-fn.c */
|
2009-08-08 21:52:43 +00:00
|
|
|
void server_fill_environ(struct session *, struct environ *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void server_redraw_client(struct client *);
|
|
|
|
void server_status_client(struct client *);
|
|
|
|
void server_redraw_session(struct session *);
|
2009-10-10 10:02:48 +00:00
|
|
|
void server_redraw_session_group(struct session *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void server_status_session(struct session *);
|
2009-10-10 10:02:48 +00:00
|
|
|
void server_status_session_group(struct session *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void server_redraw_window(struct window *);
|
2010-01-03 12:51:05 +00:00
|
|
|
void server_redraw_window_borders(struct window *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void server_status_window(struct window *);
|
|
|
|
void server_lock(void);
|
2009-09-24 14:17:09 +00:00
|
|
|
void server_lock_session(struct session *);
|
|
|
|
void server_lock_client(struct client *);
|
2009-07-17 20:37:03 +00:00
|
|
|
void server_kill_window(struct window *);
|
2009-10-10 10:02:48 +00:00
|
|
|
int server_link_window(struct session *,
|
2009-09-20 17:27:18 +00:00
|
|
|
struct winlink *, struct session *, int, int, int, char **);
|
|
|
|
void server_unlink_window(struct session *, struct winlink *);
|
2015-12-16 22:05:35 +00:00
|
|
|
void server_destroy_pane(struct window_pane *, int);
|
2009-09-12 13:01:19 +00:00
|
|
|
void server_destroy_session(struct session *);
|
2012-11-27 20:22:12 +00:00
|
|
|
void server_check_unattached(void);
|
2009-08-31 20:46:19 +00:00
|
|
|
void server_set_identify(struct client *);
|
2016-06-16 10:55:47 +00:00
|
|
|
void server_clear_identify(struct client *, struct window_pane *);
|
2012-05-21 18:27:42 +00:00
|
|
|
int server_set_stdin_callback(struct client *, void (*)(struct client *,
|
|
|
|
int, void *), void *, char **);
|
2013-03-24 09:58:40 +00:00
|
|
|
void server_unzoom_window(struct window *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* status.c */
|
2015-08-28 12:16:28 +00:00
|
|
|
void status_timer_start(struct client *);
|
|
|
|
void status_timer_start_all(void);
|
2017-02-03 21:01:02 +00:00
|
|
|
void status_update_saved(struct session *s);
|
2012-01-29 09:37:02 +00:00
|
|
|
int status_at_line(struct client *);
|
2015-04-19 21:34:21 +00:00
|
|
|
struct window *status_get_window_at(struct client *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
int status_redraw(struct client *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) status_message_set(struct client *, const char *, ...);
|
2009-06-01 22:58:49 +00:00
|
|
|
void status_message_clear(struct client *);
|
|
|
|
int status_message_redraw(struct client *);
|
2011-07-02 21:05:44 +00:00
|
|
|
void status_prompt_set(struct client *, const char *, const char *,
|
2017-01-06 11:57:03 +00:00
|
|
|
int (*)(void *, const char *, int), void (*)(void *), void *, int);
|
2009-06-01 22:58:49 +00:00
|
|
|
void status_prompt_clear(struct client *);
|
|
|
|
int status_prompt_redraw(struct client *);
|
2016-10-12 13:03:27 +00:00
|
|
|
int status_prompt_key(struct client *, key_code);
|
2011-07-02 21:05:44 +00:00
|
|
|
void status_prompt_update(struct client *, const char *, const char *);
|
2015-07-20 15:50:04 +00:00
|
|
|
void status_prompt_load_history(void);
|
|
|
|
void status_prompt_save_history(void);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* resize.c */
|
|
|
|
void recalculate_sizes(void);
|
|
|
|
|
|
|
|
/* input.c */
|
|
|
|
void input_init(struct window_pane *);
|
|
|
|
void input_free(struct window_pane *);
|
2015-12-16 22:05:35 +00:00
|
|
|
void input_reset(struct window_pane *, int);
|
2015-05-08 16:18:04 +00:00
|
|
|
struct evbuffer *input_pending(struct window_pane *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void input_parse(struct window_pane *);
|
|
|
|
|
|
|
|
/* input-key.c */
|
2015-11-12 11:05:34 +00:00
|
|
|
void input_key(struct window_pane *, key_code, struct mouse_event *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2009-10-26 17:46:33 +00:00
|
|
|
/* xterm-keys.c */
|
2017-01-25 14:36:08 +00:00
|
|
|
char *xterm_keys_lookup(key_code);
|
2015-11-12 11:05:34 +00:00
|
|
|
int xterm_keys_find(const char *, size_t, size_t *, key_code *);
|
2009-10-26 17:46:33 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* colour.c */
|
2015-06-05 22:33:39 +00:00
|
|
|
int colour_find_rgb(u_char, u_char, u_char);
|
2016-07-15 00:49:08 +00:00
|
|
|
int colour_join_rgb(u_char, u_char, u_char);
|
|
|
|
void colour_split_rgb(int, u_char *, u_char *, u_char *);
|
2009-09-10 17:16:24 +00:00
|
|
|
const char *colour_tostring(int);
|
2016-07-15 00:49:08 +00:00
|
|
|
int colour_fromstring(const char *s);
|
2009-06-01 22:58:49 +00:00
|
|
|
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;
|
2016-07-15 00:49:08 +00:00
|
|
|
int grid_cells_equal(const struct grid_cell *, const struct grid_cell *);
|
2009-06-01 22:58:49 +00:00
|
|
|
struct grid *grid_create(u_int, u_int, u_int);
|
|
|
|
void grid_destroy(struct grid *);
|
|
|
|
int grid_compare(struct grid *, struct grid *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_collect_history(struct grid *, u_int);
|
|
|
|
void grid_scroll_history(struct grid *, u_int);
|
2009-10-13 15:38:37 +00:00
|
|
|
void grid_scroll_history_region(struct grid *, u_int, u_int);
|
2015-09-25 15:53:07 +00:00
|
|
|
void grid_clear_history(struct grid *);
|
2013-03-22 16:00:26 +00:00
|
|
|
const struct grid_line *grid_peek_line(struct grid *, u_int);
|
2015-11-13 08:09:28 +00:00
|
|
|
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *,
|
|
|
|
const char *, size_t);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_clear_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_move_lines(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
2013-03-22 15:51:54 +00:00
|
|
|
char *grid_string_cells(struct grid *, u_int, u_int, u_int,
|
2013-03-25 10:09:05 +00:00
|
|
|
struct grid_cell **, int, int, int);
|
2015-12-11 16:37:21 +00:00
|
|
|
void grid_duplicate_lines(struct grid *, u_int, struct grid *, u_int,
|
|
|
|
u_int);
|
2013-03-21 16:19:25 +00:00
|
|
|
u_int grid_reflow(struct grid *, struct grid *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* grid-view.c */
|
2015-11-13 08:09:28 +00:00
|
|
|
void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
|
|
|
void grid_view_set_cell(struct grid *, u_int, u_int,
|
|
|
|
const struct grid_cell *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void grid_view_set_cells(struct grid *, u_int, u_int,
|
|
|
|
const struct grid_cell *, const char *, size_t);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_clear_history(struct grid *, u_int);
|
|
|
|
void grid_view_clear(struct grid *, u_int, u_int, u_int, u_int, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
void grid_view_scroll_region_up(struct grid *, u_int, u_int);
|
|
|
|
void grid_view_scroll_region_down(struct grid *, u_int, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void grid_view_insert_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_insert_lines_region(struct grid *, u_int, u_int, u_int,
|
|
|
|
u_int);
|
|
|
|
void grid_view_delete_lines(struct grid *, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_lines_region(struct grid *, u_int, u_int, u_int,
|
|
|
|
u_int);
|
|
|
|
void grid_view_insert_cells(struct grid *, u_int, u_int, u_int, u_int);
|
|
|
|
void grid_view_delete_cells(struct grid *, u_int, u_int, u_int, u_int);
|
2009-06-24 22:04:18 +00:00
|
|
|
char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* screen-write.c */
|
2015-11-12 11:09:11 +00:00
|
|
|
void screen_write_start(struct screen_write_ctx *, struct window_pane *,
|
|
|
|
struct screen *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void screen_write_stop(struct screen_write_ctx *);
|
2012-01-21 08:10:21 +00:00
|
|
|
void screen_write_reset(struct screen_write_ctx *);
|
2015-11-12 11:09:11 +00:00
|
|
|
size_t printflike(1, 2) screen_write_cstrlen(const char *, ...);
|
|
|
|
void printflike(4, 5) screen_write_cnputs(struct screen_write_ctx *,
|
2016-04-29 13:21:33 +00:00
|
|
|
ssize_t, const struct grid_cell *, const char *, ...);
|
2015-11-12 11:09:11 +00:00
|
|
|
size_t printflike(1, 2) screen_write_strlen(const char *, ...);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(3, 4) screen_write_puts(struct screen_write_ctx *,
|
2016-04-29 13:21:33 +00:00
|
|
|
const struct grid_cell *, const char *, ...);
|
2015-11-12 11:09:11 +00:00
|
|
|
void printflike(4, 5) screen_write_nputs(struct screen_write_ctx *,
|
2016-04-29 13:21:33 +00:00
|
|
|
ssize_t, const struct grid_cell *, const char *, ...);
|
2015-11-12 11:09:11 +00:00
|
|
|
void screen_write_vnputs(struct screen_write_ctx *, ssize_t,
|
2016-04-29 13:21:33 +00:00
|
|
|
const struct grid_cell *, const char *, va_list);
|
|
|
|
void screen_write_putc(struct screen_write_ctx *, const struct grid_cell *,
|
2015-11-12 11:09:11 +00:00
|
|
|
u_char);
|
|
|
|
void screen_write_copy(struct screen_write_ctx *, struct screen *, u_int,
|
2017-01-05 09:07:15 +00:00
|
|
|
u_int, u_int, u_int, bitstr_t *, const struct grid_cell *);
|
2009-10-12 16:59:55 +00:00
|
|
|
void screen_write_backspace(struct screen_write_ctx *);
|
2013-03-21 18:47:56 +00:00
|
|
|
void screen_write_mode_set(struct screen_write_ctx *, int);
|
|
|
|
void screen_write_mode_clear(struct screen_write_ctx *, int);
|
2009-06-01 22:58:49 +00: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-03 23:30:40 +00:00
|
|
|
void screen_write_alignmenttest(struct screen_write_ctx *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_insertcharacter(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_deletecharacter(struct screen_write_ctx *, u_int, u_int);
|
2013-01-15 23:18:55 +00:00
|
|
|
void screen_write_clearcharacter(struct screen_write_ctx *, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_insertline(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_deleteline(struct screen_write_ctx *, u_int, u_int);
|
|
|
|
void screen_write_clearline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearendofline(struct screen_write_ctx *, u_int);
|
|
|
|
void screen_write_clearstartofline(struct screen_write_ctx *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
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 15:57:49 +00:00
|
|
|
void screen_write_linefeed(struct screen_write_ctx *, int);
|
2017-02-08 17:31:09 +00:00
|
|
|
void screen_write_scrollup(struct screen_write_ctx *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
void screen_write_carriagereturn(struct screen_write_ctx *);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
|
2017-02-06 19:26:49 +00:00
|
|
|
void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int);
|
2016-10-13 20:27:27 +00:00
|
|
|
void screen_write_clearscreen(struct screen_write_ctx *, u_int);
|
2011-10-23 10:16:14 +00:00
|
|
|
void screen_write_clearhistory(struct screen_write_ctx *);
|
2017-02-08 16:45:18 +00:00
|
|
|
void screen_write_collect_end(struct screen_write_ctx *);
|
|
|
|
void screen_write_collect_add(struct screen_write_ctx *,
|
|
|
|
const struct grid_cell *);
|
2013-01-18 02:16:21 +00:00
|
|
|
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
2011-05-18 20:24:29 +00:00
|
|
|
void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
|
2011-03-07 23:46:27 +00:00
|
|
|
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* screen-redraw.c */
|
2016-10-09 16:24:34 +00:00
|
|
|
void screen_redraw_update(struct client *);
|
2014-01-31 14:19:24 +00:00
|
|
|
void screen_redraw_screen(struct client *, int, int, int);
|
2009-06-01 22:58:49 +00: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 18:48:24 +00:00
|
|
|
void screen_reset_tabs(struct screen *);
|
2011-05-20 19:17:39 +00:00
|
|
|
void screen_set_cursor_style(struct screen *, u_int);
|
2011-05-20 19:03:58 +00:00
|
|
|
void screen_set_cursor_colour(struct screen *, const char *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void screen_set_title(struct screen *, const char *);
|
2013-02-05 11:08:59 +00:00
|
|
|
void screen_resize(struct screen *, u_int, u_int, int);
|
2010-02-06 17:35:01 +00:00
|
|
|
void screen_set_selection(struct screen *,
|
|
|
|
u_int, u_int, u_int, u_int, u_int, struct grid_cell *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void screen_clear_selection(struct screen *);
|
2016-11-24 13:38:44 +00:00
|
|
|
void screen_hide_selection(struct screen *);
|
2009-06-01 22:58:49 +00:00
|
|
|
int screen_check_selection(struct screen *, u_int, u_int);
|
2016-10-12 13:24:07 +00:00
|
|
|
void screen_select_cell(struct screen *, struct grid_cell *,
|
|
|
|
const struct grid_cell *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* window.c */
|
|
|
|
extern struct windows windows;
|
2011-03-27 20:27:26 +00:00
|
|
|
extern struct window_pane_tree all_window_panes;
|
2015-04-22 15:30:11 +00:00
|
|
|
int window_cmp(struct window *, struct window *);
|
|
|
|
RB_PROTOTYPE(windows, window, entry, window_cmp);
|
2009-06-01 22:58:49 +00:00
|
|
|
int winlink_cmp(struct winlink *, struct winlink *);
|
|
|
|
RB_PROTOTYPE(winlinks, winlink, entry, winlink_cmp);
|
2011-03-27 20:27:26 +00: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-01 22:58:49 +00:00
|
|
|
struct winlink *winlink_find_by_index(struct winlinks *, int);
|
2009-12-03 22:50:09 +00:00
|
|
|
struct winlink *winlink_find_by_window(struct winlinks *, struct window *);
|
2012-01-30 09:39:34 +00:00
|
|
|
struct winlink *winlink_find_by_window_id(struct winlinks *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
u_int winlink_count(struct winlinks *);
|
2011-01-25 22:31:50 +00:00
|
|
|
struct winlink *winlink_add(struct winlinks *, int);
|
|
|
|
void winlink_set_window(struct winlink *, struct window *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void winlink_remove(struct winlinks *, struct winlink *);
|
2009-11-26 21:37:13 +00:00
|
|
|
struct winlink *winlink_next(struct winlink *);
|
|
|
|
struct winlink *winlink_previous(struct winlink *);
|
2010-07-14 18:37:49 +00: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-01 22:58:49 +00:00
|
|
|
void winlink_stack_push(struct winlink_stack *, struct winlink *);
|
|
|
|
void winlink_stack_remove(struct winlink_stack *, struct winlink *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct window *window_find_by_id_str(const char *);
|
2012-01-30 09:39:34 +00:00
|
|
|
struct window *window_find_by_id(u_int);
|
2015-08-29 08:30:54 +00:00
|
|
|
void window_update_activity(struct window *);
|
2016-10-15 09:27:52 +00:00
|
|
|
struct window *window_create(u_int, u_int);
|
|
|
|
struct window *window_create_spawn(const char *, int, char **, const char *,
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *, const char *, struct environ *,
|
|
|
|
struct termios *, u_int, u_int, u_int, char **);
|
2011-06-05 10:53:05 +00:00
|
|
|
struct window_pane *window_get_active_at(struct window *, u_int, u_int);
|
|
|
|
struct window_pane *window_find_string(struct window *, const char *);
|
2015-04-19 21:34:21 +00:00
|
|
|
int window_has_pane(struct window *, struct window_pane *);
|
2014-10-21 22:22:04 +00:00
|
|
|
int window_set_active_pane(struct window *, struct window_pane *);
|
2015-09-14 11:34:50 +00:00
|
|
|
void window_redraw_active_switch(struct window *,
|
|
|
|
struct window_pane *);
|
2016-06-06 07:24:31 +00:00
|
|
|
struct window_pane *window_add_pane(struct window *, struct window_pane *,
|
2017-02-27 13:07:57 +00:00
|
|
|
int, u_int);
|
2009-07-21 19:54:22 +00:00
|
|
|
void window_resize(struct window *, u_int, u_int);
|
2013-03-24 09:58:40 +00:00
|
|
|
int window_zoom(struct window_pane *);
|
|
|
|
int window_unzoom(struct window *);
|
2014-04-17 09:13:13 +00:00
|
|
|
void window_lost_pane(struct window *, struct window_pane *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void window_remove_pane(struct window *, struct window_pane *);
|
|
|
|
struct window_pane *window_pane_at_index(struct window *, u_int);
|
2010-07-14 18:37:49 +00:00
|
|
|
struct window_pane *window_pane_next_by_number(struct window *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct window_pane *, u_int);
|
2010-07-14 18:37:49 +00:00
|
|
|
struct window_pane *window_pane_previous_by_number(struct window *,
|
2015-05-08 16:48:12 +00:00
|
|
|
struct window_pane *, u_int);
|
2011-11-15 23:19:51 +00:00
|
|
|
int window_pane_index(struct window_pane *, u_int *);
|
2009-06-01 22:58:49 +00:00
|
|
|
u_int window_count_panes(struct window *);
|
|
|
|
void window_destroy_panes(struct window *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct window_pane *window_pane_find_by_id_str(const char *);
|
2011-03-27 20:27:26 +00:00
|
|
|
struct window_pane *window_pane_find_by_id(u_int);
|
2014-05-13 08:08:32 +00:00
|
|
|
int window_pane_spawn(struct window_pane *, int, char **,
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *, const char *, const char *, struct environ *,
|
2014-04-17 13:02:59 +00:00
|
|
|
struct termios *, char **);
|
2009-07-21 19:54:22 +00:00
|
|
|
void window_pane_resize(struct window_pane *, u_int, u_int);
|
2012-11-27 20:08:42 +00: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);
|
2017-01-07 15:28:13 +00:00
|
|
|
void window_pane_set_palette(struct window_pane *, u_int, int);
|
|
|
|
void window_pane_unset_palette(struct window_pane *, u_int);
|
|
|
|
void window_pane_reset_palette(struct window_pane *);
|
2017-01-12 10:15:55 +00:00
|
|
|
int window_pane_get_palette(const struct window_pane *, int);
|
2015-12-11 16:37:21 +00:00
|
|
|
int window_pane_set_mode(struct window_pane *,
|
|
|
|
const struct window_mode *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void window_pane_reset_mode(struct window_pane *);
|
2015-04-19 21:34:21 +00:00
|
|
|
void window_pane_key(struct window_pane *, struct client *,
|
2015-11-12 11:05:34 +00:00
|
|
|
struct session *, key_code, struct mouse_event *);
|
2016-11-16 00:24:03 +00:00
|
|
|
int window_pane_outside(struct window_pane *);
|
2009-07-14 07:23:36 +00:00
|
|
|
int window_pane_visible(struct window_pane *);
|
2015-12-11 16:37:21 +00:00
|
|
|
char *window_pane_search(struct window_pane *, const char *,
|
|
|
|
u_int *);
|
2010-12-30 21:35:17 +00:00
|
|
|
char *window_printable_flags(struct session *, struct winlink *);
|
2010-03-22 19:07:52 +00: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 00:10:11 +00:00
|
|
|
void window_set_name(struct window *, const char *);
|
2012-08-21 10:00:33 +00:00
|
|
|
void window_remove_ref(struct window *);
|
2012-07-08 07:27:32 +00:00
|
|
|
void winlink_clear_flags(struct winlink *);
|
2015-06-17 16:50:28 +00:00
|
|
|
int winlink_shuffle_up(struct session *, struct winlink *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* layout.c */
|
2010-06-29 03:30:13 +00:00
|
|
|
u_int layout_count_cells(struct layout_cell *);
|
2009-07-19 13:21:40 +00: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);
|
2016-08-03 09:07:02 +00:00
|
|
|
void layout_destroy_cell(struct window *, struct layout_cell *,
|
2015-12-11 16:37:21 +00:00
|
|
|
struct layout_cell **);
|
|
|
|
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 *);
|
2009-07-19 13:21:40 +00:00
|
|
|
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);
|
2016-08-03 09:07:02 +00:00
|
|
|
void layout_resize_adjust(struct window *, struct layout_cell *,
|
|
|
|
enum layout_type, int);
|
2013-03-24 09:58:40 +00:00
|
|
|
void layout_init(struct window *, struct window_pane *);
|
2009-07-19 13:21:40 +00:00
|
|
|
void layout_free(struct window *);
|
|
|
|
void layout_resize(struct window *, u_int, u_int);
|
2013-03-22 10:37:39 +00:00
|
|
|
void layout_resize_pane(struct window_pane *, enum layout_type,
|
2016-10-10 17:28:30 +00:00
|
|
|
int, int);
|
2013-03-22 10:37:39 +00:00
|
|
|
void layout_resize_pane_to(struct window_pane *, enum layout_type,
|
|
|
|
u_int);
|
2010-01-07 20:52:18 +00:00
|
|
|
void layout_assign_pane(struct layout_cell *, struct window_pane *);
|
2015-12-11 16:37:21 +00:00
|
|
|
struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type,
|
2016-09-04 17:37:06 +00:00
|
|
|
int, int, int);
|
2009-07-19 13:21:40 +00:00
|
|
|
void layout_close_pane(struct window_pane *);
|
|
|
|
|
2010-06-29 03:30:13 +00:00
|
|
|
/* layout-custom.c */
|
2015-04-21 22:38:49 +00:00
|
|
|
char *layout_dump(struct layout_cell *);
|
2010-06-29 03:30:13 +00:00
|
|
|
int layout_parse(struct window *, const char *);
|
|
|
|
|
2009-07-19 13:21:40 +00:00
|
|
|
/* layout-set.c */
|
|
|
|
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 *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* window-clock.c */
|
|
|
|
extern const struct window_mode window_clock_mode;
|
2014-03-31 21:34:08 +00:00
|
|
|
extern const char window_clock_table[14][5][5];
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* window-copy.c */
|
|
|
|
extern const struct window_mode window_copy_mode;
|
2015-09-14 11:57:22 +00:00
|
|
|
void window_copy_init_from_pane(struct window_pane *, int);
|
2010-04-06 21:35:44 +00:00
|
|
|
void window_copy_init_for_output(struct window_pane *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) window_copy_add(struct window_pane *, const char *, ...);
|
2010-04-06 21:35:44 +00:00
|
|
|
void window_copy_vadd(struct window_pane *, const char *, va_list);
|
2016-05-01 13:39:05 +00:00
|
|
|
void window_copy_pageup(struct window_pane *, int);
|
2015-04-19 21:34:21 +00:00
|
|
|
void window_copy_start_drag(struct client *, struct mouse_event *);
|
2015-10-23 16:02:21 +00:00
|
|
|
int window_copy_scroll_position(struct window_pane *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* window-choose.c */
|
|
|
|
extern const struct window_mode window_choose_mode;
|
2012-06-25 14:08:55 +00:00
|
|
|
void window_choose_add(struct window_pane *,
|
|
|
|
struct window_choose_data *);
|
2009-06-01 22:58:49 +00:00
|
|
|
void window_choose_ready(struct window_pane *,
|
2013-03-21 16:09:59 +00: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_run(struct window_choose_data *);
|
2012-06-25 14:27:25 +00:00
|
|
|
struct window_choose_data *window_choose_add_window(struct window_pane *,
|
2013-03-21 16:09:59 +00:00
|
|
|
struct client *, struct session *, struct winlink *,
|
2013-03-21 16:19:25 +00:00
|
|
|
const char *, const char *, u_int);
|
2012-06-25 14:27:25 +00:00
|
|
|
struct window_choose_data *window_choose_add_session(struct window_pane *,
|
2013-03-21 16:09:59 +00:00
|
|
|
struct client *, struct session *, const char *,
|
2013-03-21 16:19:25 +00:00
|
|
|
const char *, u_int);
|
2012-12-24 12:33:05 +00:00
|
|
|
void window_choose_expand_all(struct window_pane *);
|
2013-04-22 22:17:29 +00:00
|
|
|
void window_choose_set_current(struct window_pane *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* names.c */
|
2015-08-29 00:29:15 +00:00
|
|
|
void check_window_name(struct window *);
|
2013-10-10 12:09:34 +00:00
|
|
|
char *default_window_name(struct window *);
|
|
|
|
char *parse_window_name(const char *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2010-05-04 17:28:16 +00:00
|
|
|
/* signal.c */
|
2015-10-27 13:23:24 +00:00
|
|
|
void set_signals(void(*)(int, short, void *), void *);
|
2012-07-13 06:27:41 +00:00
|
|
|
void clear_signals(int);
|
2010-05-04 17:28:16 +00:00
|
|
|
|
2012-06-18 13:16:42 +00:00
|
|
|
/* control.c */
|
2014-09-01 21:50:18 +00:00
|
|
|
void control_callback(struct client *, int, void *);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(2, 3) control_write(struct client *, const char *, ...);
|
2012-09-24 13:39:10 +00:00
|
|
|
void control_write_buffer(struct client *, struct evbuffer *);
|
2012-09-03 09:32:38 +00:00
|
|
|
|
|
|
|
/* control-notify.c */
|
2012-09-25 07:41:22 +00:00
|
|
|
void control_notify_input(struct client *, struct window_pane *,
|
|
|
|
struct evbuffer *);
|
2012-09-03 09:32:38 +00: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 *);
|
2016-10-16 22:06:40 +00:00
|
|
|
void control_notify_client_session_changed(struct client *);
|
2012-09-03 09:32:38 +00:00
|
|
|
void control_notify_session_renamed(struct session *);
|
|
|
|
void control_notify_session_created(struct session *);
|
2016-10-15 00:12:58 +00:00
|
|
|
void control_notify_session_closed(struct session *);
|
2012-06-18 13:16:42 +00:00
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
/* session.c */
|
|
|
|
extern struct sessions sessions;
|
2009-10-10 10:02:48 +00:00
|
|
|
extern struct session_groups session_groups;
|
2010-12-21 22:37:59 +00:00
|
|
|
int session_cmp(struct session *, struct session *);
|
|
|
|
RB_PROTOTYPE(sessions, session, entry, session_cmp);
|
2017-02-09 15:04:53 +00:00
|
|
|
int session_group_cmp(struct session_group *, struct session_group *);
|
|
|
|
RB_PROTOTYPE(session_groups, session_group, entry, session_group_cmp);
|
2010-12-20 00:03:55 +00:00
|
|
|
int session_alive(struct session *);
|
2009-06-01 22:58:49 +00:00
|
|
|
struct session *session_find(const char *);
|
2015-04-25 18:09:28 +00:00
|
|
|
struct session *session_find_by_id_str(const char *);
|
2013-03-25 10:11:45 +00:00
|
|
|
struct session *session_find_by_id(u_int);
|
2017-02-09 15:04:53 +00:00
|
|
|
struct session *session_create(const char *, const char *, int, char **,
|
|
|
|
const char *, const char *, struct environ *,
|
|
|
|
struct termios *, int, u_int, u_int, char **);
|
2009-12-03 22:50:09 +00:00
|
|
|
void session_destroy(struct session *);
|
2015-06-05 18:18:32 +00:00
|
|
|
void session_unref(struct session *);
|
2011-04-06 21:51:31 +00:00
|
|
|
int session_check_name(const char *);
|
2015-08-28 13:01:03 +00:00
|
|
|
void session_update_activity(struct session *, struct timeval *);
|
2010-09-08 22:02:28 +00:00
|
|
|
struct session *session_next_session(struct session *);
|
|
|
|
struct session *session_previous_session(struct session *);
|
2014-05-13 08:08:32 +00:00
|
|
|
struct winlink *session_new(struct session *, const char *, int, char **,
|
2015-10-31 08:13:58 +00:00
|
|
|
const char *, const char *, int, char **);
|
2014-05-13 08:08:32 +00:00
|
|
|
struct winlink *session_attach(struct session *, struct window *, int,
|
|
|
|
char **);
|
2009-06-01 22:58:49 +00:00
|
|
|
int session_detach(struct session *, struct winlink *);
|
2015-04-22 15:32:33 +00:00
|
|
|
int session_has(struct session *, struct window *);
|
2015-05-06 08:35:39 +00:00
|
|
|
int session_is_linked(struct session *, struct window *);
|
2009-06-01 22:58:49 +00: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 16:00:26 +00:00
|
|
|
int session_set_current(struct session *, struct winlink *);
|
2017-02-09 15:04:53 +00:00
|
|
|
struct session_group *session_group_contains(struct session *);
|
|
|
|
struct session_group *session_group_find(const char *);
|
|
|
|
struct session_group *session_group_new(const char *);
|
|
|
|
void session_group_add(struct session_group *, struct session *);
|
2009-10-10 10:02:48 +00:00
|
|
|
void session_group_synchronize_to(struct session *);
|
|
|
|
void session_group_synchronize_from(struct session *);
|
2012-04-29 17:20:01 +00:00
|
|
|
void session_renumber_windows(struct session *);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* utf8.c */
|
2014-04-17 15:37:55 +00:00
|
|
|
void utf8_set(struct utf8_data *, u_char);
|
2015-11-13 08:09:28 +00:00
|
|
|
void utf8_copy(struct utf8_data *, const struct utf8_data *);
|
2015-11-14 11:45:43 +00:00
|
|
|
enum utf8_state utf8_open(struct utf8_data *, u_char);
|
|
|
|
enum utf8_state utf8_append(struct utf8_data *, u_char);
|
2016-03-02 15:36:02 +00:00
|
|
|
enum utf8_state utf8_combine(const struct utf8_data *, wchar_t *);
|
2016-03-01 12:02:08 +00:00
|
|
|
enum utf8_state utf8_split(wchar_t, struct utf8_data *);
|
2014-04-17 15:37:55 +00:00
|
|
|
int utf8_strvis(char *, const char *, size_t, int);
|
2017-01-18 10:08:05 +00:00
|
|
|
int utf8_stravis(char **, const char *, int);
|
2015-11-12 11:10:50 +00:00
|
|
|
char *utf8_sanitize(const char *);
|
2016-10-11 07:11:40 +00:00
|
|
|
size_t utf8_strlen(const struct utf8_data *);
|
|
|
|
u_int utf8_strwidth(const struct utf8_data *, ssize_t);
|
2014-04-17 15:37:55 +00:00
|
|
|
struct utf8_data *utf8_fromcstr(const char *);
|
|
|
|
char *utf8_tocstr(struct utf8_data *);
|
|
|
|
u_int utf8_cstrwidth(const char *);
|
2016-01-31 09:57:41 +00:00
|
|
|
char *utf8_rtrimcstr(const char *, u_int);
|
2014-04-17 15:37:55 +00:00
|
|
|
char *utf8_trimcstr(const char *, u_int);
|
2015-11-12 12:43:36 +00:00
|
|
|
char *utf8_padcstr(const char *, u_int);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
|
|
|
/* procname.c */
|
|
|
|
char *get_proc_name(int, char *);
|
|
|
|
|
|
|
|
/* log.c */
|
2015-11-24 21:19:46 +00:00
|
|
|
void log_add_level(void);
|
|
|
|
int log_get_level(void);
|
|
|
|
void log_open(const char *);
|
|
|
|
void log_close(void);
|
2014-10-20 23:57:13 +00:00
|
|
|
void printflike(1, 2) log_debug(const char *, ...);
|
2015-11-18 13:06:54 +00:00
|
|
|
__dead void printflike(1, 2) fatal(const char *, ...);
|
|
|
|
__dead void printflike(1, 2) fatalx(const char *, ...);
|
2009-06-01 22:58:49 +00:00
|
|
|
|
2014-01-28 23:07:09 +00:00
|
|
|
/* style.c */
|
|
|
|
int style_parse(const struct grid_cell *,
|
|
|
|
struct grid_cell *, const char *);
|
|
|
|
const char *style_tostring(struct grid_cell *);
|
2014-04-16 21:16:19 +00:00
|
|
|
void style_apply(struct grid_cell *, struct options *,
|
|
|
|
const char *);
|
|
|
|
void style_apply_update(struct grid_cell *, struct options *,
|
|
|
|
const char *);
|
2015-09-14 11:34:50 +00:00
|
|
|
int style_equal(const struct grid_cell *,
|
|
|
|
const struct grid_cell *);
|
2014-01-28 23:07:09 +00:00
|
|
|
|
2017-01-23 10:09:43 +00:00
|
|
|
/* pty.c */
|
|
|
|
int pty_open(int *);
|
|
|
|
pid_t pty_fork(int, int *, char *, size_t, struct winsize *);
|
|
|
|
|
2009-06-01 22:58:49 +00:00
|
|
|
#endif /* TMUX_H */
|