[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.13 and 1.14

version 1.13, 2009/07/17 18:45:08 version 1.14, 2009/07/19 13:21:40
Line 35 
Line 35 
 #include "tmux.h"  #include "tmux.h"
   
 /*  /*
  * Each window is attached to one or two panes, each of which is a pty. This   * Each window is attached to a number of panes, each of which is a pty. This
  * file contains code to handle them.   * file contains code to handle them.
  *   *
  * A pane has two buffers attached, these are filled and emptied by the main   * A pane has two buffers attached, these are filled and emptied by the main
Line 230 
Line 230 
   
         TAILQ_INIT(&w->panes);          TAILQ_INIT(&w->panes);
         w->active = NULL;          w->active = NULL;
         w->layout = 0;  
   
           w->layout = 0;
           w->layout_root = NULL;
   
         w->sx = sx;          w->sx = sx;
         w->sy = sy;          w->sy = sy;
   
Line 254 
Line 256 
 window_create(const char *name, const char *cmd, const char *cwd,  window_create(const char *name, const char *cmd, const char *cwd,
     const char **envp, u_int sx, u_int sy, u_int hlimit, char **cause)      const char **envp, u_int sx, u_int sy, u_int hlimit, char **cause)
 {  {
         struct window   *w;          struct window           *w;
           struct window_pane      *wp;
   
         w = window_create1(sx, sy);          w = window_create1(sx, sy);
         if (window_add_pane(w, -1, cmd, cwd, envp, hlimit, cause) == NULL) {          if ((wp = window_add_pane(w, hlimit, cause)) == NULL) {
                 window_destroy(w);                  window_destroy(w);
                 return (NULL);                  return (NULL);
         }          }
           layout_init(w);
           if (window_pane_spawn(wp, cmd, cwd, envp, cause) != 0) {
                   window_destroy(w);
                   return (NULL);
           }
         w->active = TAILQ_FIRST(&w->panes);          w->active = TAILQ_FIRST(&w->panes);
   
         if (name != NULL) {          if (name != NULL) {
                 w->name = xstrdup(name);                  w->name = xstrdup(name);
                 options_set_number(&w->options, "automatic-rename", 0);                  options_set_number(&w->options, "automatic-rename", 0);
Line 282 
Line 289 
         while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL)          while (!ARRAY_EMPTY(&windows) && ARRAY_LAST(&windows) == NULL)
                 ARRAY_TRUNC(&windows, 1);                  ARRAY_TRUNC(&windows, 1);
   
           if (w->layout_root != NULL)
                   layout_free(w);
   
         options_free(&w->options);          options_free(&w->options);
   
         window_destroy_panes(w);          window_destroy_panes(w);
Line 304 
Line 314 
 window_set_active_pane(struct window *w, struct window_pane *wp)  window_set_active_pane(struct window *w, struct window_pane *wp)
 {  {
         w->active = wp;          w->active = 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 315 
Line 324 
 }  }
   
 struct window_pane *  struct window_pane *
 window_add_pane(struct window *w, int wanty, const char *cmd,  window_add_pane(struct window *w, u_int hlimit, unused char **cause)
     const char *cwd, const char **envp, u_int hlimit, char **cause)  
 {  {
         struct window_pane      *wp;          struct window_pane      *wp;
         u_int                    sizey;  
   
           wp = window_pane_create(w, w->sx, w->sy, hlimit);
         if (TAILQ_EMPTY(&w->panes))          if (TAILQ_EMPTY(&w->panes))
                 wanty = w->sy;  
         else {  
                 sizey = w->active->sy - 1; /* for separator */  
                 if (sizey < PANE_MINIMUM * 2) {  
                         *cause = xstrdup("pane too small");  
                         return (NULL);  
                 }  
   
                 if (wanty == -1)  
                         wanty = sizey / 2;  
   
                 if (wanty < PANE_MINIMUM)  
                         wanty = PANE_MINIMUM;  
                 if ((u_int) wanty > sizey - PANE_MINIMUM)  
                         wanty = sizey - PANE_MINIMUM;  
   
                 window_pane_resize(w->active, w->sx, sizey - wanty);  
         }  
   
         wp = window_pane_create(w, w->sx, wanty, hlimit);  
         if (TAILQ_EMPTY(&w->panes))  
                 TAILQ_INSERT_HEAD(&w->panes, wp, entry);                  TAILQ_INSERT_HEAD(&w->panes, wp, entry);
         else          else
                 TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);                  TAILQ_INSERT_AFTER(&w->panes, w->active, wp, entry);
         if (window_pane_spawn(wp, cmd, cwd, envp, cause) != 0) {  
                 window_remove_pane(w, wp);  
                 return (NULL);  
         }  
         return (wp);          return (wp);
 }  }
   
Line 434 
Line 417 
         wp->out = buffer_create(BUFSIZ);          wp->out = buffer_create(BUFSIZ);
   
         wp->mode = NULL;          wp->mode = NULL;
   
           wp->layout_cell = NULL;
   
         wp->xoff = 0;          wp->xoff = 0;
         wp->yoff = 0;          wp->yoff = 0;

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14