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

Diff for /src/usr.bin/tmux/window.c between version 1.99 and 1.100

version 1.99, 2013/10/10 12:26:37 version 1.100, 2014/01/28 22:19:17
Line 61 
Line 61 
 u_int   next_window_pane_id;  u_int   next_window_pane_id;
 u_int   next_window_id;  u_int   next_window_id;
   
   struct window_pane *window_pane_active_set(struct window_pane *,
               struct window_pane *);
   void    window_pane_active_lost(struct window_pane *, struct window_pane *);
   
 void    window_pane_timer_callback(int, short, void *);  void    window_pane_timer_callback(int, short, void *);
 void    window_pane_read_callback(struct bufferevent *, void *);  void    window_pane_read_callback(struct bufferevent *, void *);
 void    window_pane_error_callback(struct bufferevent *, short, void *);  void    window_pane_error_callback(struct bufferevent *, short, void *);
Line 386 
Line 390 
         w->sy = sy;          w->sy = sy;
 }  }
   
   /*
    * Restore previously active pane when changing from wp to nextwp. The intended
    * pane is in nextwp and it returns the previously focused pane.
    */
   struct window_pane *
   window_pane_active_set(struct window_pane *wp, struct window_pane *nextwp)
   {
           struct layout_cell      *lc;
           struct window_pane      *lastwp;
   
           /* Target pane's parent must not be an ancestor of source pane. */
           for (lc = wp->layout_cell->parent; lc != NULL; lc = lc->parent) {
                   if (lc == nextwp->layout_cell->parent)
                           return (nextwp);
           }
   
           /*
            * Previously active pane, if any, must not be the same as the source
            * pane.
            */
           if (nextwp->layout_cell->parent != NULL) {
                   lastwp = nextwp->layout_cell->parent->lastwp;
                   if (lastwp != wp && window_pane_visible(lastwp))
                           return (lastwp);
           }
           return (nextwp);
   }
   
   /* Remember previously active pane when changing from wp to nextwp. */
 void  void
   window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp)
   {
           struct layout_cell      *lc, *lc2;
   
           /* Save the target pane in its parent. */
           nextwp->layout_cell->parent->lastwp = nextwp;
   
           /*
            * Save the source pane in all of its parents up to, but not including,
            * the common ancestor of itself and the target panes.
            */
           if (wp == NULL)
                   return;
           for (lc = wp->layout_cell->parent; lc != NULL; lc = lc->parent) {
                   lc2 = nextwp->layout_cell->parent;
                   for (; lc2 != NULL; lc2 = lc2->parent) {
                           if (lc == lc2)
                                   return;
                   }
                   lc->lastwp = wp;
           }
   }
   
   void
 window_set_active_pane(struct window *w, struct window_pane *wp)  window_set_active_pane(struct window *w, struct window_pane *wp)
 {  {
         if (wp == w->active)          if (wp == w->active)
                 return;                  return;
         w->last = w->active;          w->last = w->active;
         w->active = wp;          w->active = wp;
           window_pane_active_lost(w->last, wp);
         while (!window_pane_visible(w->active)) {          while (!window_pane_visible(w->active)) {
                 w->active = TAILQ_PREV(w->active, window_panes, entry);                  w->active = TAILQ_PREV(w->active, window_panes, entry);
                 if (w->active == NULL)                  if (w->active == NULL)
Line 707 
Line 765 
 void  void
 window_pane_destroy(struct window_pane *wp)  window_pane_destroy(struct window_pane *wp)
 {  {
           struct window_pane      *wp2;
   
           /* Forget removed pane in all layout cells that remember it. */
           RB_FOREACH(wp2, window_pane_tree, &all_window_panes) {
                   if (wp2->layout_cell != NULL &&
                       wp2->layout_cell->parent != NULL &&
                       wp2->layout_cell->parent->lastwp == wp)
                           wp2->layout_cell->parent->lastwp = NULL;
           }
   
         window_pane_reset_mode(wp);          window_pane_reset_mode(wp);
   
         if (event_initialized(&wp->changes_timer))          if (event_initialized(&wp->changes_timer))
Line 1130 
Line 1198 
                 if (wp2->yoff + wp2->sy + 1 != top)                  if (wp2->yoff + wp2->sy + 1 != top)
                         continue;                          continue;
                 if (left >= wp2->xoff && left <= wp2->xoff + wp2->sx)                  if (left >= wp2->xoff && left <= wp2->xoff + wp2->sx)
                         return (wp2);                          return (window_pane_active_set(wp, wp2));
         }          }
         return (NULL);          return (NULL);
 }  }
Line 1156 
Line 1224 
                 if (wp2->yoff != bottom)                  if (wp2->yoff != bottom)
                         continue;                          continue;
                 if (left >= wp2->xoff && left <= wp2->xoff + wp2->sx)                  if (left >= wp2->xoff && left <= wp2->xoff + wp2->sx)
                         return (wp2);                          return (window_pane_active_set(wp, wp2));
         }          }
         return (NULL);          return (NULL);
 }  }
Line 1185 
Line 1253 
                 if (wp2->xoff + wp2->sx + 1 != left)                  if (wp2->xoff + wp2->sx + 1 != left)
                         continue;                          continue;
                 if (top >= wp2->yoff && top <= wp2->yoff + wp2->sy)                  if (top >= wp2->yoff && top <= wp2->yoff + wp2->sy)
                         return (wp2);                          return (window_pane_active_set(wp, wp2));
         }          }
         return (NULL);          return (NULL);
 }  }
Line 1214 
Line 1282 
                 if (wp2->xoff != right)                  if (wp2->xoff != right)
                         continue;                          continue;
                 if (top >= wp2->yoff && top <= wp2->yoff + wp2->sy)                  if (top >= wp2->yoff && top <= wp2->yoff + wp2->sy)
                         return (wp2);                          return (window_pane_active_set(wp, wp2));
         }          }
         return (NULL);          return (NULL);
 }  }

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.100