Revision: 2837
          http://tmux.svn.sourceforge.net/tmux/?rev=2837&view=rev
Author:   tcunha
Date:     2012-07-11 17:06:11 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
Sync OpenBSD patchset 1144:

Clear flags across all sessions, from Thomas Adam.

Modified Paths:
--------------
    trunk/server-window.c
    trunk/session.c
    trunk/tmux.h
    trunk/window.c

Modified: trunk/server-window.c
===================================================================
--- trunk/server-window.c       2012-07-11 09:28:11 UTC (rev 2836)
+++ trunk/server-window.c       2012-07-11 17:06:11 UTC (rev 2837)
@@ -56,9 +56,6 @@
                                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 @@
                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 @@
        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 @@
        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))

Modified: trunk/session.c
===================================================================
--- trunk/session.c     2012-07-11 09:28:11 UTC (rev 2836)
+++ trunk/session.c     2012-07-11 17:06:11 UTC (rev 2837)
@@ -352,7 +352,7 @@
        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);
 }
 
@@ -389,7 +389,7 @@
        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);
 }
 
@@ -407,7 +407,7 @@
        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);
 }
 
@@ -426,7 +426,7 @@
        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);
 }
 

Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h        2012-07-11 09:28:11 UTC (rev 2836)
+++ trunk/tmux.h        2012-07-11 17:06:11 UTC (rev 2837)
@@ -2072,6 +2072,7 @@
 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 *);

Modified: trunk/window.c
===================================================================
--- trunk/window.c      2012-07-11 09:28:11 UTC (rev 2836)
+++ trunk/window.c      2012-07-11 17:06:11 UTC (rev 2837)
@@ -1174,3 +1174,31 @@
        }
        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);
+               }
+       }
+}

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to