summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-11-22 14:26:04 +0000
committernicm <nicm@openbsd.org>2012-11-22 14:26:04 +0000
commit3e0afa48d22ca72f7dad31d02fd4500ee39cd10a (patch)
tree2d8cea999985d431d0866966d5ed2c3058a8c24c
parentDon't need to send DECSL on detaching now, the code using higher levels (diff)
downloadwireguard-openbsd-3e0afa48d22ca72f7dad31d02fd4500ee39cd10a.tar.xz
wireguard-openbsd-3e0afa48d22ca72f7dad31d02fd4500ee39cd10a.zip
Instead of worrying about xterm version, send DA and read DEC service
class which is more likely to be useful. Not used for anything yet anyway.
-rw-r--r--usr.bin/tmux/cmd-server-info.c6
-rw-r--r--usr.bin/tmux/tmux.h5
-rw-r--r--usr.bin/tmux/tty-keys.c32
-rw-r--r--usr.bin/tmux/tty.c12
4 files changed, 20 insertions, 35 deletions
diff --git a/usr.bin/tmux/cmd-server-info.c b/usr.bin/tmux/cmd-server-info.c
index 9d5514fa100..af75a9f016a 100644
--- a/usr.bin/tmux/cmd-server-info.c
+++ b/usr.bin/tmux/cmd-server-info.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-server-info.c,v 1.27 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-server-info.c,v 1.28 2012/11/22 14:26:04 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -89,10 +89,10 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
continue;
ctx->print(ctx,"%2d: %s (%d, %d): %s [%ux%u %s bs=%hho "
- "xterm=%u] [flags=0x%x/0x%x, references=%u]", i,
+ "class=%u] [flags=0x%x/0x%x, references=%u]", i,
c->tty.path, c->ibuf.fd, c->tty.fd, c->session->name,
c->tty.sx, c->tty.sy, c->tty.termname,
- c->tty.tio.c_cc[VERASE], c->tty.xterm_version,
+ c->tty.tio.c_cc[VERASE], c->tty.service_class,
c->flags, c->tty.flags, c->references);
}
ctx->print(ctx, "%s", "");
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index d38b4337d43..159ecc7574c 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.362 2012/11/19 10:38:06 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.363 2012/11/22 14:26:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1193,7 +1193,7 @@ struct tty {
struct client *client;
char *path;
- u_int xterm_version;
+ u_int service_class;
u_int sx;
u_int sy;
@@ -1638,7 +1638,6 @@ void tty_init(struct tty *, struct client *, int, char *);
int tty_resize(struct tty *);
int tty_set_size(struct tty *, u_int, u_int);
void tty_start_tty(struct tty *);
-void tty_set_version(struct tty *, u_int);
void tty_stop_tty(struct tty *);
void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int, struct screen *);
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 06f6ab7c7ff..466bd80587c 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.45 2012/10/26 14:35:42 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.46 2012/11/22 14:26:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -724,18 +724,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
int
tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
{
- u_int i, a, b;
+ u_int i, n;
char tmp[64], *endptr;
/*
* Primary device attributes are \033[?a;b and secondary are
- * \033[>a;b;c. We only request attributes on xterm, so we only care
- * about the middle values which is the xterm version.
+ * \033[>a;b;c.
*/
*size = 0;
- /* First three bytes are always \033[>. */
+ /* First three bytes are always \033[?. */
if (buf[0] != '\033')
return (-1);
if (len == 1)
@@ -760,22 +759,17 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
tmp[i] = '\0';
*size = 4 + i;
- /* Only secondary is of interest. */
- if (buf[2] != '>')
+ /* Only primary is of interest. */
+ if (buf[2] != '?')
return (0);
- /* Convert version numbers. */
- a = strtoul(tmp, &endptr, 10);
- if (*endptr == ';') {
- b = strtoul(endptr + 1, &endptr, 10);
- if (*endptr != '\0' && *endptr != ';')
- b = 0;
- } else
- a = b = 0;
-
- log_debug("received xterm version %u", b);
- if (b < 500)
- tty_set_version(tty, b);
+ /* Convert service class. */
+ n = strtoul(tmp, &endptr, 10);
+ if (*endptr != ';')
+ n = 0;
+
+ log_debug("received service class %u", n);
+ tty->service_class = n;
return (0);
}
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 46a0a24284b..20c9b67a672 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.143 2012/11/22 14:10:53 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.144 2012/11/22 14:26:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -224,7 +224,7 @@ tty_start_tty(struct tty *tty)
tty_puts(tty, "\033[?1000l");
if (tty_term_has(tty->term, TTYC_XT))
- tty_puts(tty, "\033[>c");
+ tty_puts(tty, "\033[c");
tty->cx = UINT_MAX;
tty->cy = UINT_MAX;
@@ -240,14 +240,6 @@ tty_start_tty(struct tty *tty)
}
void
-tty_set_version(struct tty *tty, u_int version)
-{
- if (tty->xterm_version != 0)
- return;
- tty->xterm_version = version;
-}
-
-void
tty_stop_tty(struct tty *tty)
{
struct winsize ws;