[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.22 and 1.23

version 1.22, 2021/03/02 10:56:45 version 1.23, 2021/07/21 08:06:36
Line 39 
Line 39 
         popup_close_cb            cb;          popup_close_cb            cb;
         void                     *arg;          void                     *arg;
   
           /* Current position and size. */
         u_int                     px;          u_int                     px;
         u_int                     py;          u_int                     py;
         u_int                     sx;          u_int                     sx;
         u_int                     sy;          u_int                     sy;
   
           /* Preferred position and size. */
           u_int                     ppx;
           u_int                     ppy;
           u_int                     psx;
           u_int                     psy;
   
         enum { OFF, MOVE, SIZE }  dragging;          enum { OFF, MOVE, SIZE }  dragging;
         u_int                     dx;          u_int                     dx;
         u_int                     dy;          u_int                     dy;
Line 133 
Line 140 
         screen_init(&s, pd->sx, pd->sy, 0);          screen_init(&s, pd->sx, pd->sy, 0);
         screen_write_start(&ctx, &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_cursormove(&ctx, 1, 1, 0);          /* Skip drawing popup if the terminal is too small. */
         screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2, pd->sy - 2);          if (pd->sx > 2 && pd->sy > 2) {
                   screen_write_box(&ctx, pd->sx, pd->sy);
                   screen_write_cursormove(&ctx, 1, 1, 0);
                   screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2,
                       pd->sy - 2);
           }
         screen_write_stop(&ctx);          screen_write_stop(&ctx);
   
         c->overlay_check = NULL;          c->overlay_check = NULL;
Line 172 
Line 184 
 }  }
   
 static void  static void
   popup_resize_cb(struct client *c)
   {
           struct popup_data       *pd = c->overlay_data;
           struct tty              *tty = &c->tty;
   
           if (pd == NULL)
                   return;
   
           /* Adjust position and size. */
           if (pd->psy > tty->sy)
                   pd->sy = tty->sy;
           else
                   pd->sy = pd->psy;
           if (pd->psx > tty->sx)
                   pd->sx = tty->sx;
           else
                   pd->sx = pd->psx;
           if (pd->ppy + pd->sy > tty->sy)
                   pd->py = tty->sy - pd->sy;
           else
                   pd->py = pd->ppy;
           if (pd->ppx + pd->sx > tty->sx)
                   pd->px = tty->sx - pd->sx;
           else
                   pd->px = pd->ppx;
   
           /* Avoid zero size screens. */
           if (pd->sx > 2 && pd->sy > 2) {
                   screen_resize(&pd->s, pd->sx - 2, pd->sy - 2, 0);
                   if (pd->job != NULL)
                           job_resize(pd->job, pd->sx - 2, pd->sy - 2);
           }
   }
   
   static void
 popup_handle_drag(struct client *c, struct popup_data *pd,  popup_handle_drag(struct client *c, struct popup_data *pd,
     struct mouse_event *m)      struct mouse_event *m)
 {  {
Line 196 
Line 243 
                 pd->py = py;                  pd->py = py;
                 pd->dx = m->x - pd->px;                  pd->dx = m->x - pd->px;
                 pd->dy = m->y - pd->py;                  pd->dy = m->y - pd->py;
                   pd->ppx = px;
                   pd->ppy = py;
                 server_redraw_client(c);                  server_redraw_client(c);
         } else if (pd->dragging == SIZE) {          } else if (pd->dragging == SIZE) {
                 if (m->x < pd->px + 3)                  if (m->x < pd->px + 3)
Line 204 
Line 253 
                         return;                          return;
                 pd->sx = m->x - pd->px;                  pd->sx = m->x - pd->px;
                 pd->sy = m->y - pd->py;                  pd->sy = m->y - pd->py;
                   pd->psx = pd->sx;
                   pd->psy = pd->sy;
   
                 screen_resize(&pd->s, pd->sx - 2, pd->sy - 2, 0);                  screen_resize(&pd->s, pd->sx - 2, pd->sy - 2, 0);
                 if (pd->job != NULL)                  if (pd->job != NULL)
Line 348 
Line 399 
         pd->sx = sx;          pd->sx = sx;
         pd->sy = sy;          pd->sy = sy;
   
           pd->ppx = px;
           pd->ppy = py;
           pd->psx = sx;
           pd->psy = sy;
   
         pd->job = job_run(shellcmd, argc, argv, s, cwd,          pd->job = job_run(shellcmd, argc, argv, s, cwd,
             popup_job_update_cb, popup_job_complete_cb, NULL, pd,              popup_job_update_cb, popup_job_complete_cb, NULL, pd,
             JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE, pd->sx - 2, pd->sy - 2);              JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE, pd->sx - 2, pd->sy - 2);
         pd->ictx = input_init(NULL, job_get_event(pd->job));          pd->ictx = input_init(NULL, job_get_event(pd->job));
   
         server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb,          server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb,
             popup_draw_cb, popup_key_cb, popup_free_cb, pd);              popup_draw_cb, popup_key_cb, popup_free_cb, popup_resize_cb, pd);
         return (0);          return (0);
 }  }
   

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23