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

Diff for /src/usr.bin/tmux/menu.c between version 1.34 and 1.35

version 1.34, 2021/07/21 08:06:36 version 1.35, 2021/08/13 18:54:54
Line 131 
Line 131 
         free(menu);          free(menu);
 }  }
   
 static struct screen *  struct screen *
 menu_mode_cb(struct client *c, __unused u_int *cx, __unused u_int *cy)  menu_mode_cb(__unused struct client *c, void *data, __unused u_int *cx,
       __unused u_int *cy)
 {  {
         struct menu_data        *md = c->overlay_data;          struct menu_data        *md = data;
   
         return (&md->s);          return (&md->s);
 }  }
   
 static void  int
 menu_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0)  menu_check_cb(__unused struct client *c, void *data, u_int px, u_int py)
 {  {
         struct menu_data        *md = c->overlay_data;          struct menu_data        *md = data;
           struct menu             *menu = md->menu;
   
           if (px < md->px || px > md->px + menu->width + 3)
                   return (1);
           if (py < md->py || py > md->py + menu->count + 1)
                   return (1);
           return (0);
   }
   
   void
   menu_draw_cb(struct client *c, void *data,
       __unused struct screen_redraw_ctx *rctx)
   {
           struct menu_data        *md = data;
         struct tty              *tty = &c->tty;          struct tty              *tty = &c->tty;
         struct screen           *s = &md->s;          struct screen           *s = &md->s;
         struct menu             *menu = md->menu;          struct menu             *menu = md->menu;
Line 163 
Line 178 
         }          }
 }  }
   
 static void  void
 menu_free_cb(struct client *c)  menu_free_cb(__unused struct client *c, void *data)
 {  {
         struct menu_data        *md = c->overlay_data;          struct menu_data        *md = data;
   
         if (md->item != NULL)          if (md->item != NULL)
                 cmdq_continue(md->item);                  cmdq_continue(md->item);
Line 179 
Line 194 
         free(md);          free(md);
 }  }
   
 static int  int
 menu_key_cb(struct client *c, struct key_event *event)  menu_key_cb(struct client *c, void *data, struct key_event *event)
 {  {
         struct menu_data                *md = c->overlay_data;          struct menu_data                *md = data;
         struct menu                     *menu = md->menu;          struct menu                     *menu = md->menu;
         struct mouse_event              *m = &event->m;          struct mouse_event              *m = &event->m;
         u_int                            i;          u_int                            i;
Line 342 
Line 357 
         return (1);          return (1);
 }  }
   
 int  struct menu_data *
 menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px,  menu_prepare(struct menu *menu, int flags, struct cmdq_item *item, u_int px,
     u_int py, struct client *c, struct cmd_find_state *fs, menu_choice_cb cb,      u_int py, struct client *c, struct cmd_find_state *fs, menu_choice_cb cb,
     void *data)      void *data)
 {  {
Line 352 
Line 367 
         const char              *name;          const char              *name;
   
         if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2)          if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2)
                 return (-1);                  return (NULL);
         if (px + menu->width + 4 > c->tty.sx)          if (px + menu->width + 4 > c->tty.sx)
                 px = c->tty.sx - menu->width - 4;                  px = c->tty.sx - menu->width - 4;
         if (py + menu->count + 2 > c->tty.sy)          if (py + menu->count + 2 > c->tty.sy)
Line 388 
Line 403 
   
         md->cb = cb;          md->cb = cb;
         md->data = data;          md->data = data;
           return (md);
   }
   
   int
   menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px,
       u_int py, struct client *c, struct cmd_find_state *fs, menu_choice_cb cb,
       void *data)
   {
           struct menu_data        *md;
   
           md = menu_prepare(menu, flags, item, px, py, c, fs, cb, data);
           if (md == NULL)
                   return (-1);
         server_client_set_overlay(c, 0, NULL, menu_mode_cb, menu_draw_cb,          server_client_set_overlay(c, 0, NULL, menu_mode_cb, menu_draw_cb,
             menu_key_cb, menu_free_cb, NULL, md);              menu_key_cb, menu_free_cb, NULL, md);
         return (0);          return (0);

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35