summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-07-08 07:27:33 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-07-08 07:27:33 +0000
commit00fa172f244cb12526ff4cd2043c96f02fafb458 (patch)
tree20734e3c262eec80308de9f739552cdf0e967371
parent16d480615a003a0cc0d839fe9c7927732038f89c (diff)
Clear flags across all sessions, from Thomas Adam.
-rw-r--r--usr.bin/tmux/server-window.c13
-rw-r--r--usr.bin/tmux/session.c10
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window.c30
4 files changed, 45 insertions, 11 deletions
diff --git a/usr.bin/tmux/server-window.c b/usr.bin/tmux/server-window.c
index 2e7a650bebc..e6bcb69dd21 100644
--- a/usr.bin/tmux/server-window.c
+++ b/usr.bin/tmux/server-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-window.c,v 1.24 2012/06/18 10:58:44 nicm Exp $ */
+/* $OpenBSD: server-window.c,v 1.25 2012/07/08 07:27:32 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,9 +56,6 @@ server_window_loop(void)
server_status_session(s);
TAILQ_FOREACH(wp, &w->panes, entry)
server_window_check_content(s, wl, wp);
-
- if (!(s->flags & SESSION_UNATTACHED))
- w->flags &= ~(WINDOW_BELL|WINDOW_ACTIVITY);
}
}
}
@@ -78,6 +75,8 @@ server_window_check_bell(struct session *s, struct winlink *wl)
wl->flags |= WINLINK_BELL;
if (s->flags & SESSION_UNATTACHED)
return (1);
+ if (s->curw->window == wl->window)
+ w->flags &= ~WINDOW_BELL;
visual = options_get_number(&s->options, "visual-bell");
action = options_get_number(&s->options, "bell-action");
@@ -108,6 +107,9 @@ server_window_check_activity(struct session *s, struct winlink *wl)
struct window *w = wl->window;
u_int i;
+ if (s->curw->window == wl->window)
+ w->flags &= ~WINDOW_ACTIVITY;
+
if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
return (0);
if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
@@ -196,6 +198,9 @@ server_window_check_content(
char *found, *ptr;
/* Activity flag must be set for new content. */
+ if (s->curw->window == w)
+ w->flags &= ~WINDOW_ACTIVITY;
+
if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_CONTENT)
return (0);
if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c
index e4882e35dcf..b458c399a84 100644
--- a/usr.bin/tmux/session.c
+++ b/usr.bin/tmux/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.34 2012/04/29 17:20:01 nicm Exp $ */
+/* $OpenBSD: session.c,v 1.35 2012/07/08 07:27:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -353,7 +353,7 @@ session_next(struct session *s, int alert)
winlink_stack_remove(&s->lastw, wl);
winlink_stack_push(&s->lastw, s->curw);
s->curw = wl;
- wl->flags &= ~WINLINK_ALERTFLAGS;
+ winlink_clear_flags(wl);
return (0);
}
@@ -390,7 +390,7 @@ session_previous(struct session *s, int alert)
winlink_stack_remove(&s->lastw, wl);
winlink_stack_push(&s->lastw, s->curw);
s->curw = wl;
- wl->flags &= ~WINLINK_ALERTFLAGS;
+ winlink_clear_flags(wl);
return (0);
}
@@ -408,7 +408,7 @@ session_select(struct session *s, int idx)
winlink_stack_remove(&s->lastw, wl);
winlink_stack_push(&s->lastw, s->curw);
s->curw = wl;
- wl->flags &= ~WINLINK_ALERTFLAGS;
+ winlink_clear_flags(wl);
return (0);
}
@@ -427,7 +427,7 @@ session_last(struct session *s)
winlink_stack_remove(&s->lastw, wl);
winlink_stack_push(&s->lastw, s->curw);
s->curw = wl;
- wl->flags &= ~WINLINK_ALERTFLAGS;
+ winlink_clear_flags(wl);
return (0);
}
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index c7e50235b5d..48afbb76468 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.344 2012/06/25 14:27:25 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.345 2012/07/08 07:27:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -2076,6 +2076,7 @@ struct window_pane *window_pane_find_down(struct window_pane *);
struct window_pane *window_pane_find_left(struct window_pane *);
struct window_pane *window_pane_find_right(struct window_pane *);
void window_set_name(struct window *, const char *);
+void winlink_clear_flags(struct winlink *);
/* layout.c */
u_int layout_count_cells(struct layout_cell *);
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 1a73eef27ff..bcde5f13b9b 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.80 2012/05/28 08:55:43 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.81 2012/07/08 07:27:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1164,3 +1164,31 @@ window_pane_find_right(struct window_pane *wp)
}
return (NULL);
}
+
+/* Clear alert flags for a winlink */
+void
+winlink_clear_flags(struct winlink *wl)
+{
+ struct winlink *wm;
+ struct session *s;
+ struct window *w;
+ u_int i;
+
+ for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
+ if ((w = ARRAY_ITEM(&windows, i)) == NULL)
+ continue;
+
+ RB_FOREACH(s, sessions, &sessions) {
+ if ((wm = session_has(s, w)) == NULL)
+ continue;
+
+ if (wm->window != wl->window)
+ continue;
+ if ((wm->flags & WINLINK_ALERTFLAGS) == 0)
+ continue;
+
+ wm->flags &= ~WINLINK_ALERTFLAGS;
+ server_status_session(s);
+ }
+ }
+}