aboutsummaryrefslogtreecommitdiff
path: root/server-window.c
diff options
context:
space:
mode:
authornicm <nicm>2015-04-22 15:30:11 +0000
committernicm <nicm>2015-04-22 15:30:11 +0000
commit8d66f4fba4972d45be64d108c7c8d952f85016a8 (patch)
treee4b4d2745922796fa06923b7d18e77b300daee59 /server-window.c
parent89e80cabd56bf2f7fa783575fe9b1f6192fade42 (diff)
downloadrtmux-8d66f4fba4972d45be64d108c7c8d952f85016a8.tar.gz
rtmux-8d66f4fba4972d45be64d108c7c8d952f85016a8.tar.bz2
rtmux-8d66f4fba4972d45be64d108c7c8d952f85016a8.zip
Change the windows array into an RB tree and fix some places where we
were only looking at the first winlink for a window in a session.
Diffstat (limited to 'server-window.c')
-rw-r--r--server-window.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/server-window.c b/server-window.c
index a2355701..f157da35 100644
--- a/server-window.c
+++ b/server-window.c
@@ -34,24 +34,20 @@ void
server_window_loop(void)
{
struct window *w;
- struct winlink *wl;
struct session *s;
- u_int i;
-
- for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
- w = ARRAY_ITEM(&windows, i);
- if (w == NULL)
- continue;
+ struct winlink *wl;
+ RB_FOREACH(w, windows, &windows) {
RB_FOREACH(s, sessions, &sessions) {
- wl = session_has(s, w);
- if (wl == NULL)
- continue;
-
- if (server_window_check_bell(s, wl) ||
- server_window_check_activity(s, wl) ||
- server_window_check_silence(s, wl))
- server_status_session(s);
+ RB_FOREACH(wl, winlinks, &s->windows) {
+ if (wl->window != w)
+ continue;
+
+ if (server_window_check_bell(s, wl) ||
+ server_window_check_activity(s, wl) ||
+ server_window_check_silence(s, wl))
+ server_status_session(s);
+ }
}
}
}