The branch, hooks has been updated
       via  bfbabeeda415f1b752ce7effbccb19a1310a3c3e (commit)
      from  d89c2e4a6068ff407baa20c3ef0cbae2d691bfd1 (commit)

- Log -----------------------------------------------------------------
commit bfbabeeda415f1b752ce7effbccb19a1310a3c3e
Author: Thomas Adam <[email protected]>
Commit: Thomas Adam <[email protected]>

    Fix alerts
---
 cmd-find.c      |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 cmd.c           |    1 -
 server-window.c |    4 ++-
 tmux.h          |    2 +
 4 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/cmd-find.c b/cmd-find.c
index fab3849..7c96502 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -276,15 +276,40 @@ cmd_find_current_session_with_client(struct 
cmd_find_state *fs)
 int
 cmd_find_current_session(struct cmd_find_state *fs)
 {
+       struct session  *s;
+       struct alert    *al;
+       struct winlink  *wl;
+
        /* If we know the current client, use it. */
        if (fs->cmdq->client != NULL) {
                if (fs->cmdq->client->session == NULL)
                        return (cmd_find_current_session_with_client(fs));
-               fs->s = fs->cmdq->client->session;
-               fs->wl = fs->s->curw;
-               fs->idx = fs->wl->idx;
-               fs->w = fs->wl->window;
-               fs->wp = fs->w->active;
+               else {
+                       RB_FOREACH(s, sessions, &sessions) {
+                               if (cmd_has_session_alert(s, &al)) {
+                                       fs->s = s;
+                                       RB_FOREACH(wl, winlinks, &s->windows) {
+                                               if (wl->flags & al->flag) {
+                                                       fs->wl = wl;
+                                                       fs->idx = wl->idx;
+                                                       fs->w = wl->window;
+                                                       fs->wp = fs->w->active;
+
+                                                       return (0);
+                                               }
+                                       }
+                                       break;
+                               }
+                       }
+               }
+
+               if (fs->s == NULL) {
+                       fs->s = fs->cmdq->client->session;
+                       fs->wl = fs->s->curw;
+                       fs->idx = fs->wl->idx;
+                       fs->w = fs->wl->window;
+                       fs->wp = fs->w->active;
+               }
                return (0);
        }
 
@@ -1016,9 +1041,19 @@ struct winlink *
 cmd_find_window(struct cmd_q *cmdq, const char *target, struct session **sp)
 {
        struct cmd_find_state   *fs;
+       struct alert            *al;
+       struct winlink          *wl;
 
        fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, 0);
        cmd_find_log_state(__func__, target, fs);
+
+       if (cmd_has_session_alert(fs->s, &al)) {
+               RB_FOREACH(wl, winlinks, &fs->s->windows) {
+                       if (wl->flags & al->flag)
+                               return (wl);
+               }
+       }
+
        if (fs == NULL)
                return (NULL);
 
@@ -1033,6 +1068,8 @@ cmd_find_pane(struct cmd_q *cmdq, const char *target, 
struct session **sp,
     struct window_pane **wpp)
 {
        struct cmd_find_state   *fs;
+       struct alert            *al;
+       struct winlink          *wl;
 
        fs = cmd_find_target(cmdq, target, CMD_FIND_PANE, 0);
        cmd_find_log_state(__func__, target, fs);
@@ -1043,6 +1080,19 @@ cmd_find_pane(struct cmd_q *cmdq, const char *target, 
struct session **sp,
                *sp = fs->s;
        if (wpp != NULL)
                *wpp = fs->wp;
+
+       if (target == NULL) {
+               if (!cmd_has_session_alert(fs->s, &al))
+                       return (fs->wl);
+               else {
+                       RB_FOREACH(wl, winlinks, &al->windows) {
+                               if (wl->flags & al->flag) {
+                                       *wpp = wl->window->active;
+                                       return (wl);
+                               }
+                       }
+               }
+       }
        return (fs->wl);
 }
 
diff --git a/cmd.c b/cmd.c
index fdb2184..cb8998f 100644
--- a/cmd.c
+++ b/cmd.c
@@ -35,7 +35,6 @@ int            cmd_find_index(struct cmd_q *, const char *,
                     struct session **);
 struct winlink *cmd_find_pane(struct cmd_q *, const char *, struct session **,
                     struct window_pane **);
-int             cmd_has_session_alert(struct session *, struct alert **);
 
 const struct cmd_entry *cmd_table[] = {
        &cmd_attach_session_entry,
diff --git a/server-window.c b/server-window.c
index 8b4eb1e..c192975 100644
--- a/server-window.c
+++ b/server-window.c
@@ -87,8 +87,10 @@ server_window_loop(void)
 
                                if (server_window_check_bell(s, wl) ||
                                    server_window_check_activity(s, wl) ||
-                                   server_window_check_silence(s, wl))
+                                   server_window_check_silence(s, wl)) {
+                                       server_window_run_hooks(s, wl);
                                        server_status_session(s);
+                               }
                        }
                }
        }
diff --git a/tmux.h b/tmux.h
index be7166e..1ec1674 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1848,6 +1848,8 @@ struct winlink    *cmd_mouse_window(struct mouse_event *, 
struct session **);
 struct window_pane *cmd_mouse_pane(struct mouse_event *, struct session **,
                     struct winlink **);
 char           *cmd_template_replace(const char *, const char *, int);
+int             cmd_has_session_alert(struct session *, struct alert **);
+
 extern const struct cmd_entry *cmd_table[];
 extern const struct cmd_entry cmd_attach_session_entry;
 extern const struct cmd_entry cmd_bind_key_entry;


-----------------------------------------------------------------------

Summary of changes:
 cmd-find.c      |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 cmd.c           |    1 -
 server-window.c |    4 ++-
 tmux.h          |    2 +
 4 files changed, 60 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to