--- /dev/null
+/* $OpenBSD: tmux-protocol.h,v 1.1 2021/08/13 07:37:58 nicm Exp $ */
+
+/*
+ * Copyright (c) 2021 Nicholas Marriott <nicholas.marriott@gmail.com>
+ *
+ * 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_PROTOCOL_H
+#define TMUX_PROTOCOL_H
+
+/* Protocol version. */
+#define PROTOCOL_VERSION 8
+
+/* Message types. */
+enum msgtype {
+ MSG_VERSION = 12,
+
+ MSG_IDENTIFY_FLAGS = 100,
+ MSG_IDENTIFY_TERM,
+ MSG_IDENTIFY_TTYNAME,
+ MSG_IDENTIFY_OLDCWD, /* unused */
+ MSG_IDENTIFY_STDIN,
+ MSG_IDENTIFY_ENVIRON,
+ MSG_IDENTIFY_DONE,
+ MSG_IDENTIFY_CLIENTPID,
+ MSG_IDENTIFY_CWD,
+ MSG_IDENTIFY_FEATURES,
+ MSG_IDENTIFY_STDOUT,
+ MSG_IDENTIFY_LONGFLAGS,
+ MSG_IDENTIFY_TERMINFO,
+
+ MSG_COMMAND = 200,
+ MSG_DETACH,
+ MSG_DETACHKILL,
+ MSG_EXIT,
+ MSG_EXITED,
+ MSG_EXITING,
+ MSG_LOCK,
+ MSG_READY,
+ MSG_RESIZE,
+ MSG_SHELL,
+ MSG_SHUTDOWN,
+ MSG_OLDSTDERR, /* unused */
+ MSG_OLDSTDIN, /* unused */
+ MSG_OLDSTDOUT, /* unused */
+ MSG_SUSPEND,
+ MSG_UNLOCK,
+ MSG_WAKEUP,
+ MSG_EXEC,
+ MSG_FLAGS,
+
+ MSG_READ_OPEN = 300,
+ MSG_READ,
+ MSG_READ_DONE,
+ MSG_WRITE_OPEN,
+ MSG_WRITE,
+ MSG_WRITE_READY,
+ MSG_WRITE_CLOSE
+};
+
+/*
+ * Message data.
+ *
+ * Don't forget to bump PROTOCOL_VERSION if any of these change!
+ */
+struct msg_command {
+ int argc;
+}; /* followed by packed argv */
+
+struct msg_read_open {
+ int stream;
+ int fd;
+}; /* followed by path */
+
+struct msg_read_data {
+ int stream;
+};
+
+struct msg_read_done {
+ int stream;
+ int error;
+};
+
+struct msg_write_open {
+ int stream;
+ int fd;
+ int flags;
+}; /* followed by path */
+
+struct msg_write_data {
+ int stream;
+}; /* followed by data */
+
+struct msg_write_ready {
+ int stream;
+ int error;
+};
+
+struct msg_write_close {
+ int stream;
+};
+
+#endif /* TMUX_PROTOCOL_H */
-/* $OpenBSD: tmux.h,v 1.1117 2021/08/13 06:52:51 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1118 2021/08/13 07:37:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#include <stdio.h>
#include <termios.h>
+#include "tmux-protocol.h"
#include "xmalloc.h"
extern char **environ;
struct screen_write_ctx;
struct session;
struct tty_ctx;
+struct tty_code;
+struct tty_key;
struct tmuxpeer;
struct tmuxproc;
struct winlink;
-/* Client-server protocol version. */
-#define PROTOCOL_VERSION 8
-
/* Default configuration files and socket paths. */
#ifndef TMUX_CONF
#define TMUX_CONF "/etc/tmux.conf:~/.tmux.conf"
TTYC_XT
};
-/* Message codes. */
-enum msgtype {
- MSG_VERSION = 12,
-
- MSG_IDENTIFY_FLAGS = 100,
- MSG_IDENTIFY_TERM,
- MSG_IDENTIFY_TTYNAME,
- MSG_IDENTIFY_OLDCWD, /* unused */
- MSG_IDENTIFY_STDIN,
- MSG_IDENTIFY_ENVIRON,
- MSG_IDENTIFY_DONE,
- MSG_IDENTIFY_CLIENTPID,
- MSG_IDENTIFY_CWD,
- MSG_IDENTIFY_FEATURES,
- MSG_IDENTIFY_STDOUT,
- MSG_IDENTIFY_LONGFLAGS,
- MSG_IDENTIFY_TERMINFO,
-
- MSG_COMMAND = 200,
- MSG_DETACH,
- MSG_DETACHKILL,
- MSG_EXIT,
- MSG_EXITED,
- MSG_EXITING,
- MSG_LOCK,
- MSG_READY,
- MSG_RESIZE,
- MSG_SHELL,
- MSG_SHUTDOWN,
- MSG_OLDSTDERR, /* unused */
- MSG_OLDSTDIN, /* unused */
- MSG_OLDSTDOUT, /* unused */
- MSG_SUSPEND,
- MSG_UNLOCK,
- MSG_WAKEUP,
- MSG_EXEC,
- MSG_FLAGS,
-
- MSG_READ_OPEN = 300,
- MSG_READ,
- MSG_READ_DONE,
- MSG_WRITE_OPEN,
- MSG_WRITE,
- MSG_WRITE_READY,
- MSG_WRITE_CLOSE
-};
-
-/*
- * Message data.
- *
- * Don't forget to bump PROTOCOL_VERSION if any of these change!
- */
-struct msg_command {
- int argc;
-}; /* followed by packed argv */
-
-struct msg_read_open {
- int stream;
- int fd;
-}; /* followed by path */
-
-struct msg_read_data {
- int stream;
-};
-
-struct msg_read_done {
- int stream;
- int error;
-};
-
-struct msg_write_open {
- int stream;
- int fd;
- int flags;
-}; /* followed by path */
-
-struct msg_write_data {
- int stream;
-}; /* followed by data */
-
-struct msg_write_ready {
- int stream;
- int error;
-};
-
-struct msg_write_close {
- int stream;
-};
-
/* Character classes. */
#define WHITESPACE " "
struct mouse_event m;
};
-/* TTY information. */
-struct tty_key {
- char ch;
- key_code key;
-
- struct tty_key *left;
- struct tty_key *right;
-
- struct tty_key *next;
-};
-
-struct tty_code;
+/* Terminal definition. */
struct tty_term {
char *name;
struct tty *tty;
};
LIST_HEAD(tty_terms, tty_term);
+/* Client terminal. */
struct tty {
struct client *client;
struct event start_timer;
struct tty_key *key_tree;
};
-/* TTY command context. */
+/* Terminal command context. */
typedef void (*tty_ctx_redraw_cb)(const struct tty_ctx *);
typedef int (*tty_ctx_set_client_cb)(struct tty_ctx *, struct client *);
struct tty_ctx {
-/* $OpenBSD: tty-keys.c,v 1.149 2021/08/13 06:52:51 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.150 2021/08/13 07:37:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
static int tty_keys_extended_device_attributes(struct tty *, const char *,
size_t, size_t *);
+/* A key tree entry. */
+struct tty_key {
+ char ch;
+ key_code key;
+
+ struct tty_key *left;
+ struct tty_key *right;
+
+ struct tty_key *next;
+};
+
/* Default raw keys. */
struct tty_default_key_raw {
const char *string;