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

Diff for /src/usr.bin/tmux/popup.c between version 1.14 and 1.15

version 1.14, 2020/05/16 15:24:28 version 1.15, 2020/05/16 15:34:08
Line 58 
Line 58 
 };  };
   
 static void  static void
   popup_redraw_cb(const struct tty_ctx *ttyctx)
   {
           struct popup_data       *pd = ttyctx->arg;
   
           pd->c->flags |= CLIENT_REDRAWOVERLAY;
   }
   
   static int
   popup_set_client_cb(struct tty_ctx *ttyctx, struct client *c)
   {
           struct popup_data       *pd = ttyctx->arg;
   
           if (pd->c->flags & CLIENT_REDRAWOVERLAY)
                   return (-1);
   
           ttyctx->bigger = 0;
           ttyctx->wox = 0;
           ttyctx->woy = 0;
           ttyctx->wsx = c->tty.sx;
           ttyctx->wsy = c->tty.sy;
   
           ttyctx->xoff = ttyctx->rxoff = pd->px + 1;
           ttyctx->yoff = ttyctx->ryoff = pd->py + 1;
   
           return (1);
   }
   
   static void
   popup_init_ctx_cb(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx)
   {
           struct popup_data       *pd = ctx->arg;
   
           ttyctx->redraw_cb = popup_redraw_cb;
           ttyctx->set_client_cb = popup_set_client_cb;
           ttyctx->arg = pd;
   }
   
   static void
 popup_write_screen(struct client *c, struct popup_data *pd)  popup_write_screen(struct client *c, struct popup_data *pd)
 {  {
         struct cmdq_item        *item = pd->item;          struct cmdq_item        *item = pd->item;
Line 72 
Line 110 
         else          else
                 format_defaults(ft, c, NULL, NULL, NULL);                  format_defaults(ft, c, NULL, NULL, NULL);
   
         screen_write_start(&ctx, NULL, &pd->s);          screen_write_start(&ctx, &pd->s);
         screen_write_clearscreen(&ctx, 8);          screen_write_clearscreen(&ctx, 8);
   
         y = 0;          y = 0;
Line 98 
Line 136 
         screen_write_stop(&ctx);          screen_write_stop(&ctx);
 }  }
   
 static int  static struct screen *
 popup_mode_cb(struct client *c, u_int *cx, u_int *cy)  popup_mode_cb(struct client *c, u_int *cx, u_int *cy)
 {  {
         struct popup_data       *pd = c->overlay_data;          struct popup_data       *pd = c->overlay_data;
Line 107 
Line 145 
                 return (0);                  return (0);
         *cx = pd->px + 1 + pd->s.cx;          *cx = pd->px + 1 + pd->s.cx;
         *cy = pd->py + 1 + pd->s.cy;          *cy = pd->py + 1 + pd->s.cy;
         return (pd->s.mode);          return (&pd->s);
 }  }
   
 static int  static int
Line 132 
Line 170 
         u_int                    i, px = pd->px, py = pd->py;          u_int                    i, px = pd->px, py = pd->py;
   
         screen_init(&s, pd->sx, pd->sy, 0);          screen_init(&s, pd->sx, pd->sy, 0);
         screen_write_start(&ctx, NULL, &s);          screen_write_start(&ctx, &s);
         screen_write_clearscreen(&ctx, 8);          screen_write_clearscreen(&ctx, 8);
         screen_write_box(&ctx, pd->sx, pd->sy);          screen_write_box(&ctx, pd->sx, pd->sy);
         screen_write_cursormove(&ctx, 1, 1, 0);          screen_write_cursormove(&ctx, 1, 1, 0);
Line 140 
Line 178 
         screen_write_stop(&ctx);          screen_write_stop(&ctx);
   
         c->overlay_check = NULL;          c->overlay_check = NULL;
         for (i = 0; i < pd->sy; i++)          for (i = 0; i < pd->sy; i++){
                 tty_draw_line(tty, NULL, &s, 0, i, pd->sx, px, py + i);                  tty_draw_line(tty, &s, 0, i, pd->sx, px, py + i,
                       &grid_default_cell, NULL);
           }
         c->overlay_check = popup_check_cb;          c->overlay_check = popup_check_cb;
 }  }
   
Line 327 
Line 367 
 {  {
         struct popup_data       *pd = job_get_data(job);          struct popup_data       *pd = job_get_data(job);
         struct evbuffer         *evb = job_get_event(job)->input;          struct evbuffer         *evb = job_get_event(job)->input;
           struct client           *c = pd->c;
         struct screen           *s = &pd->s;          struct screen           *s = &pd->s;
         void                    *data = EVBUFFER_DATA(evb);          void                    *data = EVBUFFER_DATA(evb);
         size_t                   size = EVBUFFER_LENGTH(evb);          size_t                   size = EVBUFFER_LENGTH(evb);
   
         if (size != 0) {          if (size == 0)
                 input_parse_screen(pd->ictx, s, data, size);                  return;
                 evbuffer_drain(evb, size);  
                 pd->c->flags |= CLIENT_REDRAWOVERLAY;          c->overlay_check = NULL;
         }          c->tty.flags &= ~TTY_FREEZE;
   
           input_parse_screen(pd->ictx, s, popup_init_ctx_cb, pd, data, size);
   
           c->tty.flags |= TTY_FREEZE;
           c->overlay_check = popup_check_cb;
   
           evbuffer_drain(evb, size);
 }  }
   
 static void  static void

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