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

Diff for /src/usr.bin/tmux/input-keys.c between version 1.58 and 1.59

version 1.58, 2017/01/25 14:36:08 version 1.59, 2017/02/01 09:55:07
Line 235 
Line 235 
 static void  static void
 input_key_mouse(struct window_pane *wp, struct mouse_event *m)  input_key_mouse(struct window_pane *wp, struct mouse_event *m)
 {  {
         char    buf[40];          struct screen   *s = wp->screen;
         size_t  len;          int              mode = s->mode;
         u_int   x, y;          char             buf[40];
           size_t           len;
           u_int            x, y;
   
         if ((wp->screen->mode & ALL_MOUSE_MODES) == 0)          if ((mode & ALL_MOUSE_MODES) == 0)
                 return;                  return;
         if (!window_pane_visible(wp))          if (!window_pane_visible(wp))
                 return;                  return;
         if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)          if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)
                 return;                  return;
   
         /* If this pane is not in button mode, discard motion events. */          /* If this pane is not in button or all mode, discard motion events. */
         if (!(wp->screen->mode & MODE_MOUSE_BUTTON) && (m->b & MOUSE_MASK_DRAG))          if (MOUSE_DRAG(m->b) &&
                 return;              (mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0)
               return;
   
         /*          /*
            * If this event is a release event and not in all mode, discard it.
            * In SGR mode we can tell absolutely because a release is normally
            * shown by the last character. Without SGR, we check if the last
            * buttons was also a release.
            */
           if (m->sgr_type != ' ') {
                   if (MOUSE_DRAG(m->sgr_b) &&
                       MOUSE_BUTTONS(m->sgr_b) == 3 &&
                       (~mode & MODE_MOUSE_ALL))
                           return;
           } else {
                   if (MOUSE_DRAG(m->b) &&
                       MOUSE_BUTTONS(m->b) == 3 &&
                       MOUSE_BUTTONS(m->lb) == 3 &&
                       (~mode & MODE_MOUSE_ALL))
                           return;
           }
   
           /*
          * Use the SGR (1006) extension only if the application requested it           * Use the SGR (1006) extension only if the application requested it
          * and the underlying terminal also sent the event in this format (this           * and the underlying terminal also sent the event in this format (this
          * is because an old style mouse release event cannot be converted into           * is because an old style mouse release event cannot be converted into
Line 259 
Line 281 
          * UTF-8 (1005) extension if the application requested, or to the           * UTF-8 (1005) extension if the application requested, or to the
          * legacy format.           * legacy format.
          */           */
         if (m->sgr_type != ' ' && (wp->screen->mode & MODE_MOUSE_SGR)) {          if (m->sgr_type != ' ' && (s->mode & MODE_MOUSE_SGR)) {
                 len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",                  len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
                     m->sgr_b, x + 1, y + 1, m->sgr_type);                      m->sgr_b, x + 1, y + 1, m->sgr_type);
         } else if (wp->screen->mode & MODE_MOUSE_UTF8) {          } else if (s->mode & MODE_MOUSE_UTF8) {
                 if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33)                  if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33)
                         return;                          return;
                 len = xsnprintf(buf, sizeof buf, "\033[M");                  len = xsnprintf(buf, sizeof buf, "\033[M");

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59