[BACK]Return to cmd-refresh-client.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-refresh-client.c between version 1.44 and 1.45

version 1.44, 2021/08/21 10:28:05 version 1.45, 2021/08/27 17:15:57
Line 77 
Line 77 
         free(copy);          free(copy);
 }  }
   
   static enum cmd_retval
   cmd_refresh_client_control_client_size(struct cmd *self, struct cmdq_item *item)
   {
           struct args             *args = cmd_get_args(self);
           struct client           *tc = cmdq_get_target_client(item);
           const char              *size = args_get(args, 'C');
           u_int                    w, x, y;
           struct client_window    *cw;
   
           if (sscanf(size, "@%u:%ux%u", &w, &x, &y) == 3) {
                   if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM ||
                       y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) {
                           cmdq_error(item, "size too small or too big");
                           return (CMD_RETURN_ERROR);
                   }
                   log_debug("%s: client %s window @%u: size %ux%u", __func__,
                       tc->name, w, x, y);
                   cw = server_client_add_client_window(tc, w);
                   cw->sx = x;
                   cw->sy = y;
                   tc->flags |= CLIENT_WINDOWSIZECHANGED;
                   recalculate_sizes_now(1);
                   return (CMD_RETURN_NORMAL);
           }
           if (sscanf(size, "@%u:", &w) == 1) {
                   cw = server_client_get_client_window(tc, w);
                   if (cw != NULL) {
                           log_debug("%s: client %s window @%u: no size", __func__,
                               tc->name, w);
                           cw->sx = 0;
                           cw->sy = 0;
                           recalculate_sizes_now(1);
                   }
                   return (CMD_RETURN_NORMAL);
           }
   
           if (sscanf(size, "%u,%u", &x, &y) != 2 &&
               sscanf(size, "%ux%u", &x, &y) != 2) {
                   cmdq_error(item, "bad size argument");
                   return (CMD_RETURN_ERROR);
           }
           if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM ||
               y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) {
                   cmdq_error(item, "size too small or too big");
                   return (CMD_RETURN_ERROR);
           }
           tty_set_size(&tc->tty, x, y, 0, 0);
           tc->flags |= CLIENT_SIZECHANGED;
           recalculate_sizes_now(1);
           return (CMD_RETURN_NORMAL);
   }
   
 static void  static void
 cmd_refresh_client_update_offset(struct client *tc, const char *value)  cmd_refresh_client_update_offset(struct client *tc, const char *value)
 {  {
Line 117 
Line 169 
         struct client           *tc = cmdq_get_target_client(item);          struct client           *tc = cmdq_get_target_client(item);
         struct tty              *tty = &tc->tty;          struct tty              *tty = &tc->tty;
         struct window           *w;          struct window           *w;
         const char              *size, *errstr;          const char              *errstr;
         u_int                    x, y, adjust;          u_int                    adjust;
         struct args_value       *av;          struct args_value       *av;
   
         if (args_has(args, 'c') ||          if (args_has(args, 'c') ||
Line 205 
Line 257 
         if (args_has(args, 'C')) {          if (args_has(args, 'C')) {
                 if (~tc->flags & CLIENT_CONTROL)                  if (~tc->flags & CLIENT_CONTROL)
                         goto not_control_client;                          goto not_control_client;
                 size = args_get(args, 'C');                  return (cmd_refresh_client_control_client_size(self, item));
                 if (sscanf(size, "%u,%u", &x, &y) != 2 &&  
                     sscanf(size, "%ux%u", &x, &y) != 2) {  
                         cmdq_error(item, "bad size argument");  
                         return (CMD_RETURN_ERROR);  
                 }  
                 if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM ||  
                     y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) {  
                         cmdq_error(item, "size too small or too big");  
                         return (CMD_RETURN_ERROR);  
                 }  
                 tty_set_size(&tc->tty, x, y, 0, 0);  
                 tc->flags |= CLIENT_SIZECHANGED;  
                 recalculate_sizes_now(1);  
                 return (CMD_RETURN_NORMAL);  
         }          }
   
         if (args_has(args, 'S')) {          if (args_has(args, 'S')) {

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45