mirror of
https://github.com/tmux/tmux.git
synced 2025-09-06 00:37:06 +00:00
Increase the escape delay when waiting for an RGB response no matter
when it is triggered (they can also be sent on resize). GitHub issue 4569.
This commit is contained in:
46
tty.c
46
tty.c
@ -44,11 +44,11 @@ static void tty_cursor_pane_unless_wrap(struct tty *,
|
||||
const struct tty_ctx *, u_int, u_int);
|
||||
static void tty_colours(struct tty *, const struct grid_cell *);
|
||||
static void tty_check_fg(struct tty *, struct colour_palette *,
|
||||
struct grid_cell *);
|
||||
struct grid_cell *);
|
||||
static void tty_check_bg(struct tty *, struct colour_palette *,
|
||||
struct grid_cell *);
|
||||
struct grid_cell *);
|
||||
static void tty_check_us(struct tty *, struct colour_palette *,
|
||||
struct grid_cell *);
|
||||
struct grid_cell *);
|
||||
static void tty_colours_fg(struct tty *, const struct grid_cell *);
|
||||
static void tty_colours_bg(struct tty *, const struct grid_cell *);
|
||||
static void tty_colours_us(struct tty *, const struct grid_cell *);
|
||||
@ -306,9 +306,23 @@ tty_start_timer_callback(__unused int fd, __unused short events, void *data)
|
||||
struct client *c = tty->client;
|
||||
|
||||
log_debug("%s: start timer fired", c->name);
|
||||
|
||||
if ((tty->flags & (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA)) == 0)
|
||||
tty_update_features(tty);
|
||||
tty->flags |= TTY_ALL_REQUEST_FLAGS;
|
||||
|
||||
tty->flags &= ~(TTY_WAITBG|TTY_WAITFG);
|
||||
}
|
||||
|
||||
static void
|
||||
tty_start_start_timer(struct tty *tty)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
struct timeval tv = { .tv_sec = TTY_QUERY_TIMEOUT };
|
||||
|
||||
log_debug("%s: start timer started", c->name);
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_add(&tty->start_timer, &tv);
|
||||
}
|
||||
|
||||
void
|
||||
@ -316,7 +330,6 @@ tty_start_tty(struct tty *tty)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
struct termios tio;
|
||||
struct timeval tv = { .tv_sec = TTY_QUERY_TIMEOUT };
|
||||
|
||||
setblocking(c->fd, 0);
|
||||
event_add(&tty->event_in, NULL);
|
||||
@ -356,8 +369,7 @@ tty_start_tty(struct tty *tty)
|
||||
tty_puts(tty, "\033[?2031h\033[?996n");
|
||||
}
|
||||
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_add(&tty->start_timer, &tv);
|
||||
tty_start_start_timer(tty);
|
||||
|
||||
tty->flags |= TTY_STARTED;
|
||||
tty_invalidate(tty);
|
||||
@ -383,29 +395,35 @@ tty_send_requests(struct tty *tty)
|
||||
tty_puts(tty, "\033[>c");
|
||||
if (~tty->flags & TTY_HAVEXDA)
|
||||
tty_puts(tty, "\033[>q");
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
|
||||
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
|
||||
} else
|
||||
tty->flags |= TTY_ALL_REQUEST_FLAGS;
|
||||
tty->last_requests = time(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
tty_repeat_requests(struct tty *tty)
|
||||
tty_repeat_requests(struct tty *tty, int force)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
time_t t = time(NULL);
|
||||
u_int n = t - tty->last_requests;
|
||||
|
||||
if (~tty->flags & TTY_STARTED)
|
||||
return;
|
||||
|
||||
if (t - tty->last_requests <= TTY_REQUEST_LIMIT)
|
||||
if (!force && n <= TTY_REQUEST_LIMIT) {
|
||||
log_debug("%s: not repeating requests (%u seconds)", c->name, n);
|
||||
return;
|
||||
}
|
||||
log_debug("%s: %srepeating requests (%u seconds)", c->name, force ? "(force) " : "" , n);
|
||||
tty->last_requests = t;
|
||||
|
||||
if (tty->term->flags & TERM_VT100LIKE) {
|
||||
tty_puts(tty, "\033]10;?\033\\");
|
||||
tty_puts(tty, "\033]11;?\033\\");
|
||||
}
|
||||
tty_puts(tty, "\033]10;?\033\\\033]11;?\033\\");
|
||||
tty->flags |= (TTY_WAITBG|TTY_WAITFG);
|
||||
}
|
||||
tty_start_start_timer(tty);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1643,7 +1661,7 @@ tty_sync_end(struct tty *tty)
|
||||
tty->flags &= ~TTY_SYNCING;
|
||||
|
||||
if (tty_term_has(tty->term, TTYC_SYNC)) {
|
||||
log_debug("%s sync end", tty->client->name);
|
||||
log_debug("%s sync end", tty->client->name);
|
||||
tty_putcode_i(tty, TTYC_SYNC, 2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user