diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-12 11:24:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-10-12 11:24:15 +0000 |
commit | ad4a7423c039513bd55d336c9335013d5328811b (patch) | |
tree | e820af0c5cc36dc28b57a7b20b6007abd24a4bea /session.c | |
parent | d1589381782732386e07709956f4d6c7ed029d7b (diff) | |
download | rtmux-ad4a7423c039513bd55d336c9335013d5328811b.tar.gz rtmux-ad4a7423c039513bd55d336c9335013d5328811b.tar.bz2 rtmux-ad4a7423c039513bd55d336c9335013d5328811b.zip |
Mark windows in yellow on status line when bell.
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.21 2007-10-03 23:32:26 nicm Exp $ */ +/* $Id: session.c,v 1.22 2007-10-12 11:24:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,6 +27,36 @@ /* Global session list. */ struct sessions sessions; +void +session_cancelbell(struct session *s, struct window *w) +{ + u_int i; + + if (window_index(&s->bells, w, &i) == 0) + window_remove(&s->bells, w); +} + +void +session_addbell(struct session *s, struct window *w) +{ + u_int i; + + /* Never bell in the current window. */ + if (w == s->window || !session_has(s, w)) + return; + + if (window_index(&s->bells, w, &i) != 0) + window_add(&s->bells, w); +} + +int +session_hasbell(struct session *s, struct window *w) +{ + u_int i; + + return (window_index(&s->bells, w, &i) == 0); +} + /* Find session by name. */ struct session * session_find(const char *name) @@ -54,6 +84,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy) s->tim = time(NULL); s->window = s->last = NULL; ARRAY_INIT(&s->windows); + ARRAY_INIT(&s->bells); s->sx = sx; s->sy = sy; @@ -186,6 +217,7 @@ session_next(struct session *s) return (0); s->last = s->window; s->window = w; + session_cancelbell(s, w); return (0); } @@ -208,6 +240,7 @@ session_previous(struct session *s) return (0); s->last = s->window; s->window = w; + session_cancelbell(s, w); return (0); } @@ -224,6 +257,7 @@ session_select(struct session *s, u_int i) return (0); s->last = s->window; s->window = w; + session_cancelbell(s, w); return (0); } @@ -241,5 +275,6 @@ session_last(struct session *s) s->last = s->window; s->window = w; + session_cancelbell(s, w); return (0); } |