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

Diff for /src/usr.bin/tmux/tty.c between version 1.398 and 1.399

version 1.398, 2021/08/11 07:51:31 version 1.399, 2021/08/11 20:49:55
Line 45 
Line 45 
                     const struct tty_ctx *, u_int, u_int);                      const struct tty_ctx *, u_int, u_int);
 static void     tty_invalidate(struct tty *);  static void     tty_invalidate(struct tty *);
 static void     tty_colours(struct tty *, const struct grid_cell *);  static void     tty_colours(struct tty *, const struct grid_cell *);
 static void     tty_check_fg(struct tty *, int *, struct grid_cell *);  static void     tty_check_fg(struct tty *, struct colour_palette *,
 static void     tty_check_bg(struct tty *, int *, struct grid_cell *);                      struct grid_cell *);
 static void     tty_check_us(struct tty *, int *, struct grid_cell *);  static void     tty_check_bg(struct tty *, struct colour_palette *,
                       struct grid_cell *);
   static void     tty_check_us(struct tty *, struct colour_palette *,
                       struct grid_cell *);
 static void     tty_colours_fg(struct tty *, const struct grid_cell *);  static void     tty_colours_fg(struct tty *, const struct grid_cell *);
 static void     tty_colours_bg(struct tty *, const struct grid_cell *);  static void     tty_colours_bg(struct tty *, const struct grid_cell *);
 static void     tty_colours_us(struct tty *, const struct grid_cell *);  static void     tty_colours_us(struct tty *, const struct grid_cell *);
Line 66 
Line 69 
 static void     tty_repeat_space(struct tty *, u_int);  static void     tty_repeat_space(struct tty *, u_int);
 static void     tty_draw_pane(struct tty *, const struct tty_ctx *, u_int);  static void     tty_draw_pane(struct tty *, const struct tty_ctx *, u_int);
 static void     tty_default_attributes(struct tty *, const struct grid_cell *,  static void     tty_default_attributes(struct tty *, const struct grid_cell *,
                     int *, u_int);                      struct colour_palette *, u_int);
 static int      tty_check_overlay(struct tty *, u_int, u_int);  static int      tty_check_overlay(struct tty *, u_int, u_int);
   
 #define tty_use_margin(tty) \  #define tty_use_margin(tty) \
Line 939 
Line 942 
         c->flags |= (CLIENT_REDRAWWINDOW|CLIENT_REDRAWSTATUS);          c->flags |= (CLIENT_REDRAWWINDOW|CLIENT_REDRAWSTATUS);
 }  }
   
 /* Get a palette entry. */  
 static int  
 tty_get_palette(int *palette, int c)  
 {  
         int     new;  
   
         if (palette == NULL)  
                 return (-1);  
   
         new = -1;  
         if (c < 8)  
                 new = palette[c];  
         else if (c >= 90 && c <= 97)  
                 new = palette[8 + c - 90];  
         else if (c & COLOUR_FLAG_256)  
                 new = palette[c & ~COLOUR_FLAG_256];  
         if (new == 0)  
                 return (-1);  
         return (new);  
 }  
   
 /*  /*
  * Is the region large enough to be worth redrawing once later rather than   * Is the region large enough to be worth redrawing once later rather than
  * probably several times now? Currently yes if it is more than 50% of the   * probably several times now? Currently yes if it is more than 50% of the
Line 1341 
Line 1323 
   
 void  void
 tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,  tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
     u_int atx, u_int aty, const struct grid_cell *defaults, int *palette)      u_int atx, u_int aty, const struct grid_cell *defaults,
       struct colour_palette *palette)
 {  {
         struct grid             *gd = s->grid;          struct grid             *gd = s->grid;
         struct grid_cell         gc, last;          struct grid_cell         gc, last;
Line 1356 
Line 1339 
   
         log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__,          log_debug("%s: px=%u py=%u nx=%u atx=%u aty=%u", __func__,
             px, py, nx, atx, aty);              px, py, nx, atx, aty);
           log_debug("%s: defaults: fg=%d, bg=%d", __func__, defaults->fg,
               defaults->bg);
   
         /*          /*
          * py is the line in the screen to draw.           * py is the line in the screen to draw.
Line 2061 
Line 2046 
   
 void  void
 tty_cell(struct tty *tty, const struct grid_cell *gc,  tty_cell(struct tty *tty, const struct grid_cell *gc,
     const struct grid_cell *defaults, int *palette)      const struct grid_cell *defaults, struct colour_palette *palette)
 {  {
         const struct grid_cell  *gcp;          const struct grid_cell  *gcp;
   
Line 2381 
Line 2366 
   
 void  void
 tty_attributes(struct tty *tty, const struct grid_cell *gc,  tty_attributes(struct tty *tty, const struct grid_cell *gc,
     const struct grid_cell *defaults, int *palette)      const struct grid_cell *defaults, struct colour_palette *palette)
 {  {
         struct grid_cell        *tc = &tty->cell, gc2;          struct grid_cell        *tc = &tty->cell, gc2;
         int                      changed;          int                      changed;
   
         /* Copy cell and update default colours. */          /* Copy cell and update default colours. */
         memcpy(&gc2, gc, sizeof gc2);          memcpy(&gc2, gc, sizeof gc2);
         if (gc2.fg == 8)          if (~gc->flags & GRID_FLAG_NOPALETTE) {
                 gc2.fg = defaults->fg;                  if (gc2.fg == 8)
         if (gc2.bg == 8)                          gc2.fg = defaults->fg;
                 gc2.bg = defaults->bg;                  if (gc2.bg == 8)
                           gc2.bg = defaults->bg;
           }
   
         /* Ignore cell if it is the same as the last one. */          /* Ignore cell if it is the same as the last one. */
         if (gc2.attr == tty->last_cell.attr &&          if (gc2.attr == tty->last_cell.attr &&
Line 2533 
Line 2520 
         if (!COLOUR_DEFAULT(gc->bg) && gc->bg != tc->bg)          if (!COLOUR_DEFAULT(gc->bg) && gc->bg != tc->bg)
                 tty_colours_bg(tty, gc);                  tty_colours_bg(tty, gc);
   
         /* Set the underscore color. */          /* Set the underscore colour. */
         if (gc->us != tc->us)          if (gc->us != tc->us)
                 tty_colours_us(tty, gc);                  tty_colours_us(tty, gc);
 }  }
   
 static void  static void
 tty_check_fg(struct tty *tty, int *palette, struct grid_cell *gc)  tty_check_fg(struct tty *tty, struct colour_palette *palette,
       struct grid_cell *gc)
 {  {
         u_char  r, g, b;          u_char  r, g, b;
         u_int   colours;          u_int   colours;
Line 2554 
Line 2542 
                 c = gc->fg;                  c = gc->fg;
                 if (c < 8 && gc->attr & GRID_ATTR_BRIGHT)                  if (c < 8 && gc->attr & GRID_ATTR_BRIGHT)
                         c += 90;                          c += 90;
                 if ((c = tty_get_palette(palette, c)) != -1)                  if ((c = colour_palette_get(palette, c)) != -1)
                         gc->fg = c;                          gc->fg = c;
         }          }
   
Line 2595 
Line 2583 
 }  }
   
 static void  static void
 tty_check_bg(struct tty *tty, int *palette, struct grid_cell *gc)  tty_check_bg(struct tty *tty, struct colour_palette *palette,
       struct grid_cell *gc)
 {  {
         u_char  r, g, b;          u_char  r, g, b;
         u_int   colours;          u_int   colours;
Line 2603 
Line 2592 
   
         /* Perform substitution if this pane has a palette. */          /* Perform substitution if this pane has a palette. */
         if (~gc->flags & GRID_FLAG_NOPALETTE) {          if (~gc->flags & GRID_FLAG_NOPALETTE) {
                 if ((c = tty_get_palette(palette, gc->bg)) != -1)                  if ((c = colour_palette_get(palette, gc->bg)) != -1)
                         gc->bg = c;                          gc->bg = c;
         }          }
   
Line 2646 
Line 2635 
 }  }
   
 static void  static void
 tty_check_us(__unused struct tty *tty, int *palette, struct grid_cell *gc)  tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
       struct grid_cell *gc)
 {  {
         int     c;          int     c;
   
         /* Perform substitution if this pane has a palette. */          /* Perform substitution if this pane has a palette. */
         if (~gc->flags & GRID_FLAG_NOPALETTE) {          if (~gc->flags & GRID_FLAG_NOPALETTE) {
                 if ((c = tty_get_palette(palette, gc->us)) != -1)                  if ((c = colour_palette_get(palette, gc->us)) != -1)
                         gc->us = c;                          gc->us = c;
         }          }
   
Line 2793 
Line 2783 
 tty_window_default_style(struct grid_cell *gc, struct window_pane *wp)  tty_window_default_style(struct grid_cell *gc, struct window_pane *wp)
 {  {
         memcpy(gc, &grid_default_cell, sizeof *gc);          memcpy(gc, &grid_default_cell, sizeof *gc);
         gc->fg = wp->fg;          gc->fg = wp->palette.fg;
         gc->bg = wp->bg;          gc->bg = wp->palette.bg;
 }  }
   
 void  void
Line 2831 
Line 2821 
   
 static void  static void
 tty_default_attributes(struct tty *tty, const struct grid_cell *defaults,  tty_default_attributes(struct tty *tty, const struct grid_cell *defaults,
     int *palette, u_int bg)      struct colour_palette *palette, u_int bg)
 {  {
         struct grid_cell        gc;          struct grid_cell        gc;
   

Legend:
Removed from v.1.398  
changed lines
  Added in v.1.399