Use timeout events for the identify and message timers.

This commit is contained in:
Nicholas Marriott
2009-11-04 23:29:42 +00:00
parent b3c4956efe
commit b1264a7416
4 changed files with 32 additions and 16 deletions

View File

@ -24,6 +24,8 @@
#include "tmux.h"
void server_callback_identify(int, short, void *);
void
server_fill_environ(struct session *s, struct environ *env)
{
@ -353,10 +355,10 @@ server_set_identify(struct client *c)
delay = options_get_number(&c->session->options, "display-panes-time");
tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L;
if (gettimeofday(&c->identify_timer, NULL) != 0)
fatal("gettimeofday failed");
timeradd(&c->identify_timer, &tv, &c->identify_timer);
evtimer_del(&c->identify_timer);
evtimer_set(&c->identify_timer, server_callback_identify, c);
evtimer_add(&c->identify_timer, &tv);
c->flags |= CLIENT_IDENTIFY;
c->tty.flags |= (TTY_FREEZE|TTY_NOCURSOR);
@ -373,6 +375,14 @@ server_clear_identify(struct client *c)
}
}
void
server_callback_identify(unused int fd, unused short events, void *data)
{
struct client *c = data;
server_clear_identify(c);
}
void
server_update_event(struct client *c)
{