---
 server-client.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/server-client.c b/server-client.c
index c8a98f2..8d7fc2b 100644
--- a/server-client.c
+++ b/server-client.c
@@ -547,7 +547,8 @@ server_client_check_resize(struct window_pane *wp)
 void
 server_client_check_focus(struct window_pane *wp)
 {
-       struct session  *s;
+       u_int i;
+       struct client   *c;
 
        /* If we don't care about focus, forget it. */
        if (!(wp->base.mode & MODE_FOCUSON))
@@ -562,13 +563,18 @@ server_client_check_focus(struct window_pane *wp)
                goto not_focused;
 
        /*
-        * If our window is the current window in any attached sessions, we're
-        * focused.
+        * If our window is the current window in any focused clients with
+        * an attached session, we're focused.
         */
-       RB_FOREACH(s, sessions, &sessions) {
-               if (s->flags & SESSION_UNATTACHED)
+       for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+               c = ARRAY_ITEM(&clients, i);
+
+               if (!(c->flags & CLIENT_FOCUSED))
+                       continue;
+               if (c->session->flags & SESSION_UNATTACHED)
                        continue;
-               if (s->curw->window == wp->window)
+
+               if (c->session->curw->window == wp->window)
                        goto focused;
        }
 
-- 
1.8.1.3


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to