aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-08 23:11:23 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-08 23:11:23 +0000
commit02438c01b72f0cf1c22d45d84d7dea808cc548d1 (patch)
treeac8f7e4ee9d8fa56b3d0de4e9c15835fca52d41b /status.c
parentbee17719d8212fa3ff87b4059727849bd3c807b2 (diff)
downloadrtmux-02438c01b72f0cf1c22d45d84d7dea808cc548d1.tar.gz
rtmux-02438c01b72f0cf1c22d45d84d7dea808cc548d1.tar.bz2
rtmux-02438c01b72f0cf1c22d45d84d7dea808cc548d1.zip
Sync OpenBSD patchset 504:
Use timeout events for the identify and message timers.
Diffstat (limited to 'status.c')
-rw-r--r--status.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/status.c b/status.c
index 05c76581..1e5701be 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.126 2009-11-08 22:56:04 tcunha Exp $ */
+/* $Id: status.c,v 1.127 2009-11-08 23:11:23 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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)