summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 16:46:23 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-04 16:46:23 +0000
commit14b951254674c75d8422a8ac5f320a54d1dd8a48 (patch)
treee361a5b014694cb4b609f6c05cd54ce250cf669d /server.c
parentf7ba4dfdc91eb3121ca070a0706d0ec2dfe502e1 (diff)
Add activity monitoring, also invert items on taskbar which have activity.
Diffstat (limited to 'server.c')
-rw-r--r--server.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/server.c b/server.c
index ff2411c7..ab1d90c2 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.51 2008-06-04 05:47:46 nicm Exp $ */
+/* $Id: server.c,v 1.52 2008-06-04 16:46:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -415,31 +415,40 @@ server_handle_window(struct window *w)
{
struct session *s;
u_int i;
+ int action;
window_parse(w);
- if (!(w->flags & WINDOW_BELL))
+ if (!(w->flags & (WINDOW_BELL|WINDOW_ACTIVITY)))
return;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
if (s == NULL || !session_has(s, w))
continue;
- session_addbell(s, w);
-
- switch (options_get_number(&s->options, "bell-action")) {
- case BELL_ANY:
- tty_write_session(s, TTY_CHARACTER, '\007');
- break;
- case BELL_CURRENT:
- if (s->curw->window == w)
+
+ if (w->flags & WINDOW_BELL) {
+ session_alert_add(s, w, WINDOW_BELL);
+
+ action = options_get_number(&s->options, "bell-action");
+ switch (action) {
+ case BELL_ANY:
+ tty_write_session(s, TTY_CHARACTER, '\007');
+ break;
+ case BELL_CURRENT:
+ if (s->curw->window != w)
+ break;
tty_write_session(s, TTY_CHARACTER, '\007');
- break;
+ break;
+ }
}
+
+ if (w->flags & WINDOW_ACTIVITY)
+ session_alert_add(s, w, WINDOW_ACTIVITY);
}
server_status_window(w);
- w->flags &= ~WINDOW_BELL;
+ w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
}
/* Lost window: move clients on to next window. */