aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-01-13 14:01:25 +0000
committerThomas Adam <thomas@xteddy.org>2020-01-13 14:01:25 +0000
commita01c9ffc6c750537e2700f756ea8479c0f8b8e69 (patch)
treee6d4054450d676d764d3970e6f4a91a5e9f1274a
parent8457f54edcdfdf7b6e48a291808135258abfe5b8 (diff)
parentda515570dc13daefc92e26a5c5417e1f190f80e8 (diff)
downloadrtmux-a01c9ffc6c750537e2700f756ea8479c0f8b8e69.tar.gz
rtmux-a01c9ffc6c750537e2700f756ea8479c0f8b8e69.tar.bz2
rtmux-a01c9ffc6c750537e2700f756ea8479c0f8b8e69.zip
Merge branch 'obsd-master'
-rw-r--r--tmux.h1
-rw-r--r--tty.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/tmux.h b/tmux.h
index 3438e794..54a50106 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1181,6 +1181,7 @@ LIST_HEAD(tty_terms, tty_term);
struct tty {
struct client *client;
+ struct event start_timer;
u_int sx;
u_int sy;
diff --git a/tty.c b/tty.c
index a1324528..3d58f05b 100644
--- a/tty.c
+++ b/tty.c
@@ -285,11 +285,22 @@ tty_open(struct tty *tty, char **cause)
return (0);
}
+static void
+tty_start_timer_callback(__unused int fd, __unused short events, void *data)
+{
+ struct tty *tty = data;
+ struct client *c = tty->client;
+
+ log_debug("%s: start timer fired", c->name);
+ tty->flags |= (TTY_HAVEDA|TTY_HAVEDSR);
+}
+
void
tty_start_tty(struct tty *tty)
{
struct client *c = tty->client;
struct termios tio;
+ struct timeval tv = { .tv_sec = 1 };
if (tty->fd != -1 && tcgetattr(tty->fd, &tty->tio) == 0) {
setblocking(tty->fd, 0);
@@ -328,9 +339,13 @@ tty_start_tty(struct tty *tty)
tty_puts(tty, "\033[?1004h");
}
tty_puts(tty, "\033[c\033[1337n"); /* DA and DSR */
+
} else
tty->flags |= (TTY_HAVEDA|TTY_HAVEDSR);
+ evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
+ evtimer_add(&tty->start_timer, &tv);
+
tty->flags |= TTY_STARTED;
tty_invalidate(tty);
@@ -351,6 +366,8 @@ tty_stop_tty(struct tty *tty)
return;
tty->flags &= ~TTY_STARTED;
+ evtimer_del(&tty->start_timer);
+
event_del(&tty->timer);
tty->flags &= ~TTY_BLOCK;