mirror of
https://github.com/tmux/tmux.git
synced 2026-01-12 01:00:22 +00:00
Merge changes from master.
This commit is contained in:
24
tty.c
24
tty.c
@@ -35,6 +35,8 @@
|
||||
|
||||
static int tty_log_fd = -1;
|
||||
|
||||
static void tty_start_timer_callback(int, short, void *);
|
||||
static void tty_clipboard_query_callback(int, short, void *);
|
||||
static void tty_set_italics(struct tty *);
|
||||
static int tty_try_colour(struct tty *, int, const char *);
|
||||
static void tty_force_cursor_colour(struct tty *, int);
|
||||
@@ -296,6 +298,8 @@ tty_open(struct tty *tty, char **cause)
|
||||
if (tty->out == NULL)
|
||||
fatal("out of memory");
|
||||
|
||||
evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty);
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_set(&tty->timer, tty_timer_callback, tty);
|
||||
|
||||
tty_start_tty(tty);
|
||||
@@ -327,7 +331,6 @@ tty_start_start_timer(struct tty *tty)
|
||||
|
||||
log_debug("%s: start timer started", c->name);
|
||||
evtimer_del(&tty->start_timer);
|
||||
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
|
||||
evtimer_add(&tty->start_timer, &tv);
|
||||
}
|
||||
|
||||
@@ -445,6 +448,7 @@ tty_stop_tty(struct tty *tty)
|
||||
tty->flags &= ~TTY_STARTED;
|
||||
|
||||
evtimer_del(&tty->start_timer);
|
||||
evtimer_del(&tty->clipboard_timer);
|
||||
|
||||
event_del(&tty->timer);
|
||||
tty->flags &= ~TTY_BLOCK;
|
||||
@@ -3296,12 +3300,6 @@ static void
|
||||
tty_clipboard_query_callback(__unused int fd, __unused short events, void *data)
|
||||
{
|
||||
struct tty *tty = data;
|
||||
struct client *c = tty->client;
|
||||
|
||||
c->flags &= ~CLIENT_CLIPBOARDBUFFER;
|
||||
free(c->clipboard_panes);
|
||||
c->clipboard_panes = NULL;
|
||||
c->clipboard_npanes = 0;
|
||||
|
||||
tty->flags &= ~TTY_OSC52QUERY;
|
||||
}
|
||||
@@ -3311,11 +3309,9 @@ tty_clipboard_query(struct tty *tty)
|
||||
{
|
||||
struct timeval tv = { .tv_sec = TTY_QUERY_TIMEOUT };
|
||||
|
||||
if ((~tty->flags & TTY_STARTED) || (tty->flags & TTY_OSC52QUERY))
|
||||
return;
|
||||
tty_putcode_ss(tty, TTYC_MS, "", "?");
|
||||
|
||||
tty->flags |= TTY_OSC52QUERY;
|
||||
evtimer_set(&tty->clipboard_timer, tty_clipboard_query_callback, tty);
|
||||
evtimer_add(&tty->clipboard_timer, &tv);
|
||||
if ((tty->flags & TTY_STARTED) && (~tty->flags & TTY_OSC52QUERY)) {
|
||||
tty_putcode_ss(tty, TTYC_MS, "", "?");
|
||||
tty->flags |= TTY_OSC52QUERY;
|
||||
evtimer_add(&tty->clipboard_timer, &tv);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user