diff options
author | Thomas Adam <thomas@xteddy.org> | 2023-09-02 22:01:09 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2023-09-02 22:01:09 +0100 |
commit | 1742138f0534d953f640308c924576dd2e189cd6 (patch) | |
tree | 050af628b4a880c8b6ca7b591957e75efe5e7628 /tty.c | |
parent | 7ad29b98311b4961d203dc360e6a21f35dac9f97 (diff) | |
parent | c767d62329597b9152c0e1b33ba2656be8e0bced (diff) |
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -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 |