mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 19:39:04 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
d87ab0cadf
19
format.c
19
format.c
@ -1139,20 +1139,25 @@ format_defaults_client(struct format_tree *ft, struct client *c)
|
|||||||
{
|
{
|
||||||
struct session *s;
|
struct session *s;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
struct tty *tty = &c->tty;
|
||||||
|
const char *types[] = TTY_TYPES;
|
||||||
|
|
||||||
if (ft->s == NULL)
|
if (ft->s == NULL)
|
||||||
ft->s = c->session;
|
ft->s = c->session;
|
||||||
|
|
||||||
format_add(ft, "client_pid", "%ld", (long) c->pid);
|
format_add(ft, "client_pid", "%ld", (long) c->pid);
|
||||||
format_add(ft, "client_height", "%u", c->tty.sy);
|
format_add(ft, "client_height", "%u", tty->sy);
|
||||||
format_add(ft, "client_width", "%u", c->tty.sx);
|
format_add(ft, "client_width", "%u", tty->sx);
|
||||||
if (c->tty.path != NULL)
|
if (tty->path != NULL)
|
||||||
format_add(ft, "client_tty", "%s", c->tty.path);
|
format_add(ft, "client_tty", "%s", tty->path);
|
||||||
if (c->tty.termname != NULL)
|
|
||||||
format_add(ft, "client_termname", "%s", c->tty.termname);
|
|
||||||
format_add(ft, "client_control_mode", "%d",
|
format_add(ft, "client_control_mode", "%d",
|
||||||
!!(c->flags & CLIENT_CONTROL));
|
!!(c->flags & CLIENT_CONTROL));
|
||||||
|
|
||||||
|
if (tty->term_name != NULL)
|
||||||
|
format_add(ft, "client_termname", "%s", tty->term_name);
|
||||||
|
if (tty->term_name != NULL)
|
||||||
|
format_add(ft, "client_termtype", "%s", types[tty->term_type]);
|
||||||
|
|
||||||
format_add_tv(ft, "client_created", &c->creation_time);
|
format_add_tv(ft, "client_created", &c->creation_time);
|
||||||
format_add_tv(ft, "client_activity", &c->activity_time);
|
format_add_tv(ft, "client_activity", &c->activity_time);
|
||||||
|
|
||||||
@ -1163,7 +1168,7 @@ format_defaults_client(struct format_tree *ft, struct client *c)
|
|||||||
format_add(ft, "client_prefix", "%d", 1);
|
format_add(ft, "client_prefix", "%d", 1);
|
||||||
format_add(ft, "client_key_table", "%s", c->keytable->name);
|
format_add(ft, "client_key_table", "%s", c->keytable->name);
|
||||||
|
|
||||||
if (c->tty.flags & TTY_UTF8)
|
if (tty->flags & TTY_UTF8)
|
||||||
format_add(ft, "client_utf8", "%d", 1);
|
format_add(ft, "client_utf8", "%d", 1);
|
||||||
else
|
else
|
||||||
format_add(ft, "client_utf8", "%d", 0);
|
format_add(ft, "client_utf8", "%d", 0);
|
||||||
|
1
tmux.1
1
tmux.1
@ -3516,6 +3516,7 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "client_readonly" Ta "" Ta "1 if client is readonly"
|
.It Li "client_readonly" Ta "" Ta "1 if client is readonly"
|
||||||
.It Li "client_session" Ta "" Ta "Name of the client's session"
|
.It Li "client_session" Ta "" Ta "Name of the client's session"
|
||||||
.It Li "client_termname" Ta "" Ta "Terminal name of client"
|
.It Li "client_termname" Ta "" Ta "Terminal name of client"
|
||||||
|
.It Li "client_termtype" Ta "" Ta "Terminal type of client"
|
||||||
.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
|
.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
|
||||||
.It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
|
.It Li "client_utf8" Ta "" Ta "1 if client supports utf8"
|
||||||
.It Li "client_width" Ta "" Ta "Width of client"
|
.It Li "client_width" Ta "" Ta "Width of client"
|
||||||
|
7
tmux.h
7
tmux.h
@ -1114,9 +1114,6 @@ struct tty {
|
|||||||
u_int rleft;
|
u_int rleft;
|
||||||
u_int rright;
|
u_int rright;
|
||||||
|
|
||||||
char *termname;
|
|
||||||
struct tty_term *term;
|
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
struct bufferevent *event;
|
struct bufferevent *event;
|
||||||
|
|
||||||
@ -1133,6 +1130,8 @@ struct tty {
|
|||||||
#define TTY_FOCUS 0x40
|
#define TTY_FOCUS 0x40
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
struct tty_term *term;
|
||||||
|
char *term_name;
|
||||||
int term_flags;
|
int term_flags;
|
||||||
enum {
|
enum {
|
||||||
TTY_VT100,
|
TTY_VT100,
|
||||||
@ -1154,6 +1153,8 @@ struct tty {
|
|||||||
struct event key_timer;
|
struct event key_timer;
|
||||||
struct tty_key *key_tree;
|
struct tty_key *key_tree;
|
||||||
};
|
};
|
||||||
|
#define TTY_TYPES \
|
||||||
|
{ "VT100", "VT101", "VT102", "VT220", "VT320", "VT420", "UNKNOWN" }
|
||||||
|
|
||||||
/* TTY command context. */
|
/* TTY command context. */
|
||||||
struct tty_ctx {
|
struct tty_ctx {
|
||||||
|
35
tty-keys.c
35
tty-keys.c
@ -837,9 +837,10 @@ static int
|
|||||||
tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
|
tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
|
||||||
size_t *size)
|
size_t *size)
|
||||||
{
|
{
|
||||||
u_int i, a, b;
|
u_int i, a, b;
|
||||||
char tmp[64], *endptr;
|
char tmp[64], *endptr;
|
||||||
const char *s;
|
static const char *types[] = TTY_TYPES;
|
||||||
|
int type;
|
||||||
|
|
||||||
*size = 0;
|
*size = 0;
|
||||||
|
|
||||||
@ -877,35 +878,29 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
|
|||||||
} else
|
} else
|
||||||
a = b = 0;
|
a = b = 0;
|
||||||
|
|
||||||
s = "UNKNOWN";
|
type = TTY_UNKNOWN;
|
||||||
switch (a) {
|
switch (a) {
|
||||||
case 1:
|
case 1:
|
||||||
if (b == 2) {
|
if (b == 2)
|
||||||
tty_set_type(tty, TTY_VT100);
|
type = TTY_VT100;
|
||||||
s = "VT100";
|
else if (b == 0)
|
||||||
} else if (b == 0) {
|
type = TTY_VT101;
|
||||||
tty_set_type(tty, TTY_VT101);
|
|
||||||
s = "VT101";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
tty_set_type(tty, TTY_VT102);
|
type = TTY_VT102;
|
||||||
s = "VT102";
|
|
||||||
break;
|
break;
|
||||||
case 62:
|
case 62:
|
||||||
tty_set_type(tty, TTY_VT220);
|
type = TTY_VT220;
|
||||||
s = "VT220";
|
|
||||||
break;
|
break;
|
||||||
case 63:
|
case 63:
|
||||||
tty_set_type(tty, TTY_VT320);
|
type = TTY_VT320;
|
||||||
s = "VT320";
|
|
||||||
break;
|
break;
|
||||||
case 64:
|
case 64:
|
||||||
tty_set_type(tty, TTY_VT420);
|
type = TTY_VT420;
|
||||||
s = "VT420";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log_debug("received DA %.*s (%s)", (int)*size, buf, s);
|
tty_set_type(tty, type);
|
||||||
|
|
||||||
|
log_debug("received DA %.*s (%s)", (int)*size, buf, types[type]);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
8
tty.c
8
tty.c
@ -105,9 +105,9 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term)
|
|||||||
memset(tty, 0, sizeof *tty);
|
memset(tty, 0, sizeof *tty);
|
||||||
|
|
||||||
if (term == NULL || *term == '\0')
|
if (term == NULL || *term == '\0')
|
||||||
tty->termname = xstrdup("unknown");
|
tty->term_name = xstrdup("unknown");
|
||||||
else
|
else
|
||||||
tty->termname = xstrdup(term);
|
tty->term_name = xstrdup(term);
|
||||||
tty->fd = fd;
|
tty->fd = fd;
|
||||||
tty->client = c;
|
tty->client = c;
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ tty_set_size(struct tty *tty, u_int sx, u_int sy)
|
|||||||
int
|
int
|
||||||
tty_open(struct tty *tty, char **cause)
|
tty_open(struct tty *tty, char **cause)
|
||||||
{
|
{
|
||||||
tty->term = tty_term_find(tty->termname, tty->fd, cause);
|
tty->term = tty_term_find(tty->term_name, tty->fd, cause);
|
||||||
if (tty->term == NULL) {
|
if (tty->term == NULL) {
|
||||||
tty_close(tty);
|
tty_close(tty);
|
||||||
return (-1);
|
return (-1);
|
||||||
@ -364,7 +364,7 @@ tty_free(struct tty *tty)
|
|||||||
|
|
||||||
free(tty->ccolour);
|
free(tty->ccolour);
|
||||||
free(tty->path);
|
free(tty->path);
|
||||||
free(tty->termname);
|
free(tty->term_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user