=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/server-window.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/tmux/Attic/server-window.c 2010/02/19 00:03:21 1.14 --- src/usr.bin/tmux/Attic/server-window.c 2010/06/21 01:27:46 1.15 *************** *** 1,4 **** ! /* $OpenBSD: server-window.c,v 1.14 2010/02/19 00:03:21 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-window.c,v 1.15 2010/06/21 01:27:46 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 24,33 **** #include "tmux.h" int server_window_backoff(struct window_pane *); ! int server_window_check_bell(struct session *, struct window *); ! int server_window_check_activity(struct session *, struct window *); int server_window_check_content( ! struct session *, struct window *, struct window_pane *); /* Check if this window should suspend reading. */ int --- 24,33 ---- #include "tmux.h" int server_window_backoff(struct window_pane *); ! int server_window_check_bell(struct session *, struct winlink *); ! int server_window_check_activity(struct session *, struct winlink *); int server_window_check_content( ! struct session *, struct winlink *, struct window_pane *); /* Check if this window should suspend reading. */ int *************** *** 59,64 **** --- 59,65 ---- server_window_loop(void) { struct window *w; + struct winlink *wl; struct window_pane *wp; struct session *s; u_int i, j; *************** *** 81,114 **** for (j = 0; j < ARRAY_LENGTH(&sessions); j++) { s = ARRAY_ITEM(&sessions, j); ! if (s == NULL || !session_has(s, w)) continue; ! if (server_window_check_bell(s, w) || ! server_window_check_activity(s, w)) server_status_session(s); TAILQ_FOREACH(wp, &w->panes, entry) ! server_window_check_content(s, w, wp); } ! w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_CONTENT); } } /* Check for bell in window. */ int ! server_window_check_bell(struct session *s, struct window *w) { struct client *c; u_int i; int action, visual; ! if (!(w->flags & WINDOW_BELL)) return (0); ! ! if (session_alert_has_window(s, w, WINDOW_BELL)) return (0); - session_alert_add(s, w, WINDOW_BELL); action = options_get_number(&s->options, "bell-action"); switch (action) { case BELL_ANY: --- 82,119 ---- for (j = 0; j < ARRAY_LENGTH(&sessions); j++) { s = ARRAY_ITEM(&sessions, j); ! if (s == NULL) continue; + wl = session_has(s, w); + if (wl == NULL) + continue; ! if (server_window_check_bell(s, wl) || ! server_window_check_activity(s, wl)) server_status_session(s); TAILQ_FOREACH(wp, &w->panes, entry) ! server_window_check_content(s, wl, wp); } ! w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY); } } /* Check for bell in window. */ int ! server_window_check_bell(struct session *s, struct winlink *wl) { struct client *c; + struct window *w = wl->window; u_int i; int action, visual; ! if (!(w->flags & WINDOW_BELL) || wl->flags & WINLINK_BELL) return (0); ! if (s->curw == wl) return (0); + wl->flags |= WINLINK_BELL; + action = options_get_number(&s->options, "bell-action"); switch (action) { case BELL_ANY: *************** *** 155,179 **** /* Check for activity in window. */ int ! server_window_check_activity(struct session *s, struct window *w) { struct client *c; u_int i; ! if (!(w->flags & WINDOW_ACTIVITY)) return (0); ! if (s->curw->window == w) return (0); if (!options_get_number(&w->options, "monitor-activity")) return (0); ! if (session_alert_has_window(s, w, WINDOW_ACTIVITY)) ! return (0); ! session_alert_add(s, w, WINDOW_ACTIVITY); - if (s->flags & SESSION_UNATTACHED) - return (0); if (options_get_number(&s->options, "visual-activity")) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); --- 160,181 ---- /* Check for activity in window. */ int ! server_window_check_activity(struct session *s, struct winlink *wl) { struct client *c; + struct window *w = wl->window; u_int i; ! if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY) return (0); ! if (s->curw == wl) return (0); if (!options_get_number(&w->options, "monitor-activity")) return (0); ! wl->flags |= WINLINK_ACTIVITY; if (options_get_number(&s->options, "visual-activity")) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); *************** *** 190,220 **** /* Check for content change in window. */ int server_window_check_content( ! struct session *s, struct window *w, struct window_pane *wp) { struct client *c; u_int i; char *found, *ptr; ! if (!(w->flags & WINDOW_ACTIVITY)) /* activity for new content */ return (0); ! if (s->curw->window == w) return (0); ptr = options_get_string(&w->options, "monitor-content"); if (ptr == NULL || *ptr == '\0') return (0); - - if (session_alert_has_window(s, w, WINDOW_CONTENT)) - return (0); - if ((found = window_pane_search(wp, ptr, NULL)) == NULL) return (0); xfree(found); ! session_alert_add(s, w, WINDOW_CONTENT); ! if (s->flags & SESSION_UNATTACHED) ! return (0); if (options_get_number(&s->options, "visual-content")) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); --- 192,219 ---- /* Check for content change in window. */ int server_window_check_content( ! struct session *s, struct winlink *wl, struct window_pane *wp) { struct client *c; + struct window *w = wl->window; u_int i; char *found, *ptr; ! /* Activity flag must be set for new content. */ ! if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_CONTENT) return (0); ! if (s->curw == wl) return (0); ptr = options_get_string(&w->options, "monitor-content"); if (ptr == NULL || *ptr == '\0') return (0); if ((found = window_pane_search(wp, ptr, NULL)) == NULL) return (0); xfree(found); ! wl->flags |= WINLINK_CONTENT; ! if (options_get_number(&s->options, "visual-content")) { for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i);