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

Diff for /src/usr.bin/tmux/layout.c between version 1.37 and 1.38

version 1.37, 2018/09/24 15:29:56 version 1.38, 2018/10/18 08:38:01
Line 253 
Line 253 
   
 /* Update pane offsets and sizes based on their cells. */  /* Update pane offsets and sizes based on their cells. */
 void  void
 layout_fix_panes(struct window *w, u_int wsx, u_int wsy)  layout_fix_panes(struct window *w)
 {  {
         struct window_pane      *wp;          struct window_pane      *wp;
         struct layout_cell      *lc;          struct layout_cell      *lc;
         u_int                    sx, sy;          int                      shift, status;
         int                      shift, status, at_top;  
   
         status = options_get_number(w->options, "pane-border-status");          status = options_get_number(w->options, "pane-border-status");
         at_top = (status == 1);  
         TAILQ_FOREACH(wp, &w->panes, entry) {          TAILQ_FOREACH(wp, &w->panes, entry) {
                 if ((lc = wp->layout_cell) == NULL)                  if ((lc = wp->layout_cell) == NULL)
                         continue;                          continue;
   
                 if (status != 0)                  if (status != 0)
                         shift = layout_need_status(lc, at_top);                          shift = layout_need_status(lc, status == 1);
                 else                  else
                         shift = 0;                          shift = 0;
   
                 wp->xoff = lc->xoff;                  wp->xoff = lc->xoff;
                 wp->yoff = lc->yoff;                  wp->yoff = lc->yoff;
   
                 if (shift && at_top)                  if (shift && status == 1)
                         wp->yoff += 1;                          wp->yoff += 1;
   
                 /*                  window_pane_resize(wp, lc->sx, lc->sy - shift);
                  * Layout cells are limited by the smallest size of other cells  
                  * within the same row or column; if this isn't the case  
                  * resizing becomes difficult.  
                  *  
                  * However, panes do not have to take up their entire cell, so  
                  * they can be cropped to the window edge if the layout  
                  * overflows and they are partly visible.  
                  *  
                  * This stops cells being hidden unnecessarily.  
                  */  
   
                 /*  
                  * Work out the horizontal size. If the pane is actually  
                  * outside the window or the entire pane is already visible,  
                  * don't crop.  
                  */  
                 if (lc->xoff >= wsx || lc->xoff + lc->sx < wsx)  
                         sx = lc->sx;  
                 else {  
                         sx = wsx - lc->xoff;  
                         if (sx < 1)  
                                 sx = lc->sx;  
                 }  
   
                 /*  
                  * Similarly for the vertical size; the minimum vertical size  
                  * is two because scroll regions cannot be one line.  
                  */  
                 if (lc->yoff >= wsy || lc->yoff + lc->sy < wsy)  
                         sy = lc->sy;  
                 else {  
                         sy = wsy - lc->yoff;  
                         if (sy < 2)  
                                 sy = lc->sy;  
                 }  
   
                 if (shift)  
                         sy -= 1;  
   
                 window_pane_resize(wp, sx, sy);  
         }          }
 }  }
   
Line 492 
Line 450 
         lc = w->layout_root = layout_create_cell(NULL);          lc = w->layout_root = layout_create_cell(NULL);
         layout_set_size(lc, w->sx, w->sy, 0, 0);          layout_set_size(lc, w->sx, w->sy, 0, 0);
         layout_make_leaf(lc, wp);          layout_make_leaf(lc, wp);
           layout_fix_panes(w);
         layout_fix_panes(w, w->sx, w->sy);  
 }  }
   
 void  void
Line 551 
Line 508 
   
         /* Fix cell offsets. */          /* Fix cell offsets. */
         layout_fix_offsets(lc);          layout_fix_offsets(lc);
         layout_fix_panes(w, sx, sy);          layout_fix_panes(w);
 }  }
   
 /* Resize a pane to an absolute size. */  /* Resize a pane to an absolute size. */
Line 611 
Line 568 
   
         /* Fix cell offsets. */          /* Fix cell offsets. */
         layout_fix_offsets(w->layout_root);          layout_fix_offsets(w->layout_root);
         layout_fix_panes(w, w->sx, w->sy);          layout_fix_panes(w);
         notify_window("window-layout-changed", w);          notify_window("window-layout-changed", w);
 }  }
   
Line 718 
Line 675 
 layout_assign_pane(struct layout_cell *lc, struct window_pane *wp)  layout_assign_pane(struct layout_cell *lc, struct window_pane *wp)
 {  {
         layout_make_leaf(lc, wp);          layout_make_leaf(lc, wp);
         layout_fix_panes(wp->window, wp->window->sx, wp->window->sy);          layout_fix_panes(wp->window);
 }  }
   
 /* Calculate the new pane size for resized parent. */  /* Calculate the new pane size for resized parent. */
Line 1038 
Line 995 
         /* Fix pane offsets and sizes. */          /* Fix pane offsets and sizes. */
         if (w->layout_root != NULL) {          if (w->layout_root != NULL) {
                 layout_fix_offsets(w->layout_root);                  layout_fix_offsets(w->layout_root);
                 layout_fix_panes(w, w->sx, w->sy);                  layout_fix_panes(w);
         }          }
         notify_window("window-layout-changed", w);          notify_window("window-layout-changed", w);
 }  }
Line 1095 
Line 1052 
         do {          do {
                 if (layout_spread_cell(w, parent)) {                  if (layout_spread_cell(w, parent)) {
                         layout_fix_offsets(parent);                          layout_fix_offsets(parent);
                         layout_fix_panes(w, w->sx, w->sy);                          layout_fix_panes(w);
                         break;                          break;
                 }                  }
         } while ((parent = parent->parent) != NULL);          } while ((parent = parent->parent) != NULL);

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38