summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2023-09-02 22:01:09 +0100
committerThomas Adam <thomas@xteddy.org>2023-09-02 22:01:09 +0100
commit1742138f0534d953f640308c924576dd2e189cd6 (patch)
tree050af628b4a880c8b6ca7b591957e75efe5e7628 /tty.c
parent7ad29b98311b4961d203dc360e6a21f35dac9f97 (diff)
parentc767d62329597b9152c0e1b33ba2656be8e0bced (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 8b0d4f5a..bb32c096 100644
--- a/tty.c
+++ b/tty.c
@@ -87,6 +87,7 @@ static void tty_write_one(void (*)(struct tty *, const struct tty_ctx *),
#define TTY_BLOCK_STOP(tty) (1 + ((tty)->sx * (tty)->sy) / 8)
#define TTY_QUERY_TIMEOUT 5
+#define TTY_REQUEST_LIMIT 30
void
tty_create_log(void)
@@ -374,12 +375,29 @@ tty_send_requests(struct tty *tty)
tty_puts(tty, "\033[>c");
if (~tty->flags & TTY_HAVEXDA)
tty_puts(tty, "\033[>q");
- if (~tty->flags & TTY_HAVEFG)
- tty_puts(tty, "\033]10;?\033\\");
- if (~tty->flags & TTY_HAVEBG)
- tty_puts(tty, "\033]11;?\033\\");
+ tty_puts(tty, "\033]10;?\033\\");
+ tty_puts(tty, "\033]11;?\033\\");
} else
tty->flags |= TTY_ALL_REQUEST_FLAGS;
+ tty->last_requests = time (NULL);
+}
+
+void
+tty_repeat_requests(struct tty *tty)
+{
+ time_t t = time (NULL);
+
+ if (~tty->flags & TTY_STARTED)
+ return;
+
+ if (t - tty->last_requests <= TTY_REQUEST_LIMIT)
+ return;
+ tty->last_requests = t;
+
+ if (tty->term->flags & TERM_VT100LIKE) {
+ tty_puts(tty, "\033]10;?\033\\");
+ tty_puts(tty, "\033]11;?\033\\");
+ }
}
void