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

Diff for /src/usr.bin/tmux/server-client.c between version 1.305 and 1.306

version 1.305, 2020/02/19 14:25:00 version 1.306, 2020/03/12 13:16:16
Line 419 
Line 419 
         struct winlink          *wl;          struct winlink          *wl;
         struct window_pane      *wp;          struct window_pane      *wp;
         u_int                    x, y, b, sx, sy, px, py;          u_int                    x, y, b, sx, sy, px, py;
         int                      flag;  
         key_code                 key;          key_code                 key;
         struct timeval           tv;          struct timeval           tv;
         struct style_range      *sr;          struct style_range      *sr;
Line 443 
Line 442 
             m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag);              m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag);
   
         /* What type of event is this? */          /* What type of event is this? */
         if ((m->sgr_type != ' ' &&          if (event->key == KEYC_DOUBLECLICK) {
                   type = DOUBLE;
                   x = m->x, y = m->y, b = m->b;
                   log_debug("double-click at %u,%u", x, y);
           } else if ((m->sgr_type != ' ' &&
             MOUSE_DRAG(m->sgr_b) &&              MOUSE_DRAG(m->sgr_b) &&
             MOUSE_BUTTONS(m->sgr_b) == 3) ||              MOUSE_BUTTONS(m->sgr_b) == 3) ||
             (m->sgr_type == ' ' &&              (m->sgr_type == ' ' &&
Line 477 
Line 480 
                         evtimer_del(&c->click_timer);                          evtimer_del(&c->click_timer);
                         c->flags &= ~CLIENT_DOUBLECLICK;                          c->flags &= ~CLIENT_DOUBLECLICK;
                         if (m->b == c->click_button) {                          if (m->b == c->click_button) {
                                 type = DOUBLE;                                  type = NOTYPE;
                                 x = m->x, y = m->y, b = m->b;                                  c->flags |= CLIENT_TRIPLECLICK;
                                 log_debug("double-click at %u,%u", x, y);  
                                 flag = CLIENT_TRIPLECLICK;  
                                 goto add_timer;                                  goto add_timer;
                         }                          }
                 } else if (c->flags & CLIENT_TRIPLECLICK) {                  } else if (c->flags & CLIENT_TRIPLECLICK) {
Line 497 
Line 498 
                 type = DOWN;                  type = DOWN;
                 x = m->x, y = m->y, b = m->b;                  x = m->x, y = m->y, b = m->b;
                 log_debug("down at %u,%u", x, y);                  log_debug("down at %u,%u", x, y);
                 flag = CLIENT_DOUBLECLICK;                  c->flags |= CLIENT_DOUBLECLICK;
   
         add_timer:          add_timer:
                 if (KEYC_CLICK_TIMEOUT != 0) {                  if (KEYC_CLICK_TIMEOUT != 0) {
                         c->flags |= flag;                          memcpy(&c->click_event, m, sizeof c->click_event);
                         c->click_button = m->b;                          c->click_button = m->b;
   
                         tv.tv_sec = KEYC_CLICK_TIMEOUT / 1000;                          tv.tv_sec = KEYC_CLICK_TIMEOUT / 1000;
Line 1047 
Line 1048 
   
         /* Check for mouse keys. */          /* Check for mouse keys. */
         m->valid = 0;          m->valid = 0;
         if (key == KEYC_MOUSE) {          if (key == KEYC_MOUSE || key == KEYC_DOUBLECLICK) {
                 if (c->flags & CLIENT_READONLY)                  if (c->flags & CLIENT_READONLY)
                         goto out;                          goto out;
                 key = server_client_check_mouse(c, event);                  key = server_client_check_mouse(c, event);
Line 1549 
Line 1550 
 static void  static void
 server_client_click_timer(__unused int fd, __unused short events, void *data)  server_client_click_timer(__unused int fd, __unused short events, void *data)
 {  {
         struct client   *c = data;          struct client           *c = data;
           struct key_event        *event;
   
           log_debug("click timer expired");
   
           if (c->flags & CLIENT_TRIPLECLICK) {
                   /*
                    * Waiting for a third click that hasn't happened, so this must
                    * have been a double click.
                    */
                   event = xmalloc(sizeof *event);
                   event->key = KEYC_DOUBLECLICK;
                   memcpy(&event->m, &c->click_event, sizeof event->m);
                   if (!server_client_handle_key(c, event))
                           free(event);
           }
         c->flags &= ~(CLIENT_DOUBLECLICK|CLIENT_TRIPLECLICK);          c->flags &= ~(CLIENT_DOUBLECLICK|CLIENT_TRIPLECLICK);
 }  }
   

Legend:
Removed from v.1.305  
changed lines
  Added in v.1.306