aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-04 23:29:42 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-04 23:29:42 +0000
commitb1264a7416789dad8fad1b4b00a63f99b1ca25e5 (patch)
treedf5e1caa4db6713325be59dc06ff33da4008a6a2 /status.c
parentb3c4956efeb62bae3c9ac64eab2371bb6384623a (diff)
downloadrtmux-b1264a7416789dad8fad1b4b00a63f99b1ca25e5.tar.gz
rtmux-b1264a7416789dad8fad1b4b00a63f99b1ca25e5.tar.bz2
rtmux-b1264a7416789dad8fad1b4b00a63f99b1ca25e5.zip
Use timeout events for the identify and message timers.
Diffstat (limited to 'status.c')
-rw-r--r--status.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/status.c b/status.c
index 4b0c81fb..deb3a621 100644
--- a/status.c
+++ b/status.c
@@ -33,6 +33,7 @@ char *status_job(struct client *, char **);
void status_job_callback(struct job *);
size_t status_width(struct winlink *);
char *status_print(struct session *, struct winlink *, struct grid_cell *);
+void status_message_callback(int, short, void *);
void status_prompt_add_history(struct client *);
char *status_prompt_complete(const char *);
@@ -579,10 +580,10 @@ status_message_set(struct client *c, const char *fmt, ...)
delay = options_get_number(&c->session->options, "display-time");
tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L;
-
- if (gettimeofday(&c->message_timer, NULL) != 0)
- fatal("gettimeofday failed");
- timeradd(&c->message_timer, &tv, &c->message_timer);
+
+ evtimer_del(&c->message_timer);
+ evtimer_set(&c->message_timer, status_message_callback, c);
+ evtimer_add(&c->message_timer, &tv);
c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
c->flags |= CLIENT_STATUS;
@@ -603,6 +604,14 @@ status_message_clear(struct client *c)
screen_reinit(&c->status);
}
+void
+status_message_callback(unused int fd, unused short event, void *data)
+{
+ struct client *c = data;
+
+ status_message_clear(c);
+}
+
/* Draw client message on status line of present else on last line. */
int
status_message_redraw(struct client *c)