[BACK]Return to notify.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/notify.c between version 1.16 and 1.17

version 1.16, 2016/10/16 19:36:37 version 1.17, 2016/10/16 19:55:52
Line 41 
Line 41 
         "window-renamed",          "window-renamed",
         NULL, /* "attached-session-changed", */          NULL, /* "attached-session-changed", */
         "session-renamed",          "session-renamed",
         NULL, /* "session-created", */          "session-created",
         NULL, /* "session-closed" */          "session-closed"
 };  };
   
 struct notify_entry {  struct notify_entry {
Line 60 
Line 60 
         struct cmd_find_state    fs;          struct cmd_find_state    fs;
         struct hook             *hook;          struct hook             *hook;
         struct cmdq_item        *new_item;          struct cmdq_item        *new_item;
           struct session          *s = ne->session;
           struct window           *w = ne->window;
   
         name = notify_hooks[ne->type];          name = notify_hooks[ne->type];
         if (name == NULL)          if (name == NULL)
                 return;                  return;
   
         cmd_find_clear_state(&fs, NULL, 0);          cmd_find_clear_state(&fs, NULL, 0);
         if (ne->session != NULL && ne->window != NULL)          if (s != NULL && w != NULL)
                 cmd_find_from_session_window(&fs, ne->session, ne->window);                  cmd_find_from_session_window(&fs, s, w);
         else if (ne->window != NULL)          else if (w != NULL)
                 cmd_find_from_window(&fs, ne->window);                  cmd_find_from_window(&fs, w);
         else if (ne->session != NULL)          else if (s != NULL && session_alive(s))
                 cmd_find_from_session(&fs, ne->session);                  cmd_find_from_session(&fs, s);
         else          else
                 cmd_find_current(&fs, item, CMD_FIND_QUIET);                  cmd_find_current(&fs, item, CMD_FIND_QUIET);
         if (cmd_find_empty_state(&fs) || !cmd_find_valid_state(&fs))          if (cmd_find_empty_state(&fs) || !cmd_find_valid_state(&fs))
Line 84 
Line 86 
   
         new_item = cmdq_get_command(hook->cmdlist, &fs, NULL, CMDQ_NOHOOKS);          new_item = cmdq_get_command(hook->cmdlist, &fs, NULL, CMDQ_NOHOOKS);
         cmdq_format(new_item, "hook", "%s", name);          cmdq_format(new_item, "hook", "%s", name);
   
           if (s != NULL) {
                   cmdq_format(new_item, "hook_session", "$%u", s->id);
                   cmdq_format(new_item, "hook_session_name", "%s", s->name);
           }
           if (w != NULL) {
                   cmdq_format(new_item, "hook_window", "@%u", w->id);
                   cmdq_format(new_item, "hook_window_name", "%s", w->name);
           }
   
         cmdq_insert_after(item, new_item);          cmdq_insert_after(item, new_item);
 }  }
   

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17