Support more mouse buttons when the terminal sends them, GitHub issue
authornicm <nicm@openbsd.org>
Wed, 16 Feb 2022 18:55:05 +0000 (18:55 +0000)
committernicm <nicm@openbsd.org>
Wed, 16 Feb 2022 18:55:05 +0000 (18:55 +0000)
3055.

usr.bin/tmux/input-keys.c
usr.bin/tmux/key-string.c
usr.bin/tmux/menu.c
usr.bin/tmux/popup.c
usr.bin/tmux/server-client.c
usr.bin/tmux/tmux.h
usr.bin/tmux/tty-keys.c

index fef2555..c0d44ef 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.86 2021/08/20 17:50:42 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.87 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -578,13 +578,13 @@ input_key_get_mouse(struct screen *s, struct mouse_event *m, u_int x, u_int y,
         */
        if (m->sgr_type != ' ') {
                if (MOUSE_DRAG(m->sgr_b) &&
-                   MOUSE_BUTTONS(m->sgr_b) == 3 &&
+                   MOUSE_RELEASE(m->sgr_b) &&
                    (~s->mode & MODE_MOUSE_ALL))
                        return (0);
        } else {
                if (MOUSE_DRAG(m->b) &&
-                   MOUSE_BUTTONS(m->b) == 3 &&
-                   MOUSE_BUTTONS(m->lb) == 3 &&
+                   MOUSE_RELEASE(m->b) &&
+                   MOUSE_RELEASE(m->lb) &&
                    (~s->mode & MODE_MOUSE_ALL))
                        return (0);
        }
index fca85da..c97d760 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-string.c,v 1.68 2021/06/16 08:37:58 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.69 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -91,26 +91,68 @@ static const struct {
        KEYC_MOUSE_STRING(MOUSEDOWN1, MouseDown1),
        KEYC_MOUSE_STRING(MOUSEDOWN2, MouseDown2),
        KEYC_MOUSE_STRING(MOUSEDOWN3, MouseDown3),
+       KEYC_MOUSE_STRING(MOUSEDOWN6, MouseDown6),
+       KEYC_MOUSE_STRING(MOUSEDOWN7, MouseDown7),
+       KEYC_MOUSE_STRING(MOUSEDOWN8, MouseDown8),
+       KEYC_MOUSE_STRING(MOUSEDOWN9, MouseDown9),
+       KEYC_MOUSE_STRING(MOUSEDOWN10, MouseDown10),
+       KEYC_MOUSE_STRING(MOUSEDOWN11, MouseDown11),
        KEYC_MOUSE_STRING(MOUSEUP1, MouseUp1),
        KEYC_MOUSE_STRING(MOUSEUP2, MouseUp2),
        KEYC_MOUSE_STRING(MOUSEUP3, MouseUp3),
+       KEYC_MOUSE_STRING(MOUSEUP6, MouseUp6),
+       KEYC_MOUSE_STRING(MOUSEUP7, MouseUp7),
+       KEYC_MOUSE_STRING(MOUSEUP8, MouseUp8),
+       KEYC_MOUSE_STRING(MOUSEUP9, MouseUp9),
+       KEYC_MOUSE_STRING(MOUSEUP10, MouseUp10),
+       KEYC_MOUSE_STRING(MOUSEUP11, MouseUp11),
        KEYC_MOUSE_STRING(MOUSEDRAG1, MouseDrag1),
        KEYC_MOUSE_STRING(MOUSEDRAG2, MouseDrag2),
        KEYC_MOUSE_STRING(MOUSEDRAG3, MouseDrag3),
+       KEYC_MOUSE_STRING(MOUSEDRAG6, MouseDrag6),
+       KEYC_MOUSE_STRING(MOUSEDRAG7, MouseDrag7),
+       KEYC_MOUSE_STRING(MOUSEDRAG8, MouseDrag8),
+       KEYC_MOUSE_STRING(MOUSEDRAG9, MouseDrag9),
+       KEYC_MOUSE_STRING(MOUSEDRAG10, MouseDrag10),
+       KEYC_MOUSE_STRING(MOUSEDRAG11, MouseDrag11),
        KEYC_MOUSE_STRING(MOUSEDRAGEND1, MouseDragEnd1),
        KEYC_MOUSE_STRING(MOUSEDRAGEND2, MouseDragEnd2),
        KEYC_MOUSE_STRING(MOUSEDRAGEND3, MouseDragEnd3),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND6, MouseDragEnd6),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND7, MouseDragEnd7),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND8, MouseDragEnd8),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND9, MouseDragEnd9),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND10, MouseDragEnd10),
+       KEYC_MOUSE_STRING(MOUSEDRAGEND11, MouseDragEnd11),
        KEYC_MOUSE_STRING(WHEELUP, WheelUp),
        KEYC_MOUSE_STRING(WHEELDOWN, WheelDown),
        KEYC_MOUSE_STRING(SECONDCLICK1, SecondClick1),
        KEYC_MOUSE_STRING(SECONDCLICK2, SecondClick2),
        KEYC_MOUSE_STRING(SECONDCLICK3, SecondClick3),
+       KEYC_MOUSE_STRING(SECONDCLICK6, SecondClick6),
+       KEYC_MOUSE_STRING(SECONDCLICK7, SecondClick7),
+       KEYC_MOUSE_STRING(SECONDCLICK8, SecondClick8),
+       KEYC_MOUSE_STRING(SECONDCLICK9, SecondClick9),
+       KEYC_MOUSE_STRING(SECONDCLICK10, SecondClick10),
+       KEYC_MOUSE_STRING(SECONDCLICK11, SecondClick11),
        KEYC_MOUSE_STRING(DOUBLECLICK1, DoubleClick1),
        KEYC_MOUSE_STRING(DOUBLECLICK2, DoubleClick2),
        KEYC_MOUSE_STRING(DOUBLECLICK3, DoubleClick3),
+       KEYC_MOUSE_STRING(DOUBLECLICK6, DoubleClick6),
+       KEYC_MOUSE_STRING(DOUBLECLICK7, DoubleClick7),
+       KEYC_MOUSE_STRING(DOUBLECLICK8, DoubleClick8),
+       KEYC_MOUSE_STRING(DOUBLECLICK9, DoubleClick9),
+       KEYC_MOUSE_STRING(DOUBLECLICK10, DoubleClick10),
+       KEYC_MOUSE_STRING(DOUBLECLICK11, DoubleClick11),
        KEYC_MOUSE_STRING(TRIPLECLICK1, TripleClick1),
        KEYC_MOUSE_STRING(TRIPLECLICK2, TripleClick2),
        KEYC_MOUSE_STRING(TRIPLECLICK3, TripleClick3),
+       KEYC_MOUSE_STRING(TRIPLECLICK6, TripleClick6),
+       KEYC_MOUSE_STRING(TRIPLECLICK7, TripleClick7),
+       KEYC_MOUSE_STRING(TRIPLECLICK8, TripleClick8),
+       KEYC_MOUSE_STRING(TRIPLECLICK9, TripleClick9),
+       KEYC_MOUSE_STRING(TRIPLECLICK10, TripleClick10),
+       KEYC_MOUSE_STRING(TRIPLECLICK11, TripleClick11)
 };
 
 /* Find key string in table. */
index f9bcbaf..54e0f96 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.43 2022/02/01 18:12:20 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.44 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -235,7 +235,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
 
        if (KEYC_IS_MOUSE(event->key)) {
                if (md->flags & MENU_NOMOUSE) {
-                       if (MOUSE_BUTTONS(m->b) != 0)
+                       if (MOUSE_BUTTONS(m->b) != MOUSE_BUTTON_1)
                                return (1);
                        return (0);
                }
@@ -248,7 +248,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
                                        return (1);
                        } else {
                                if (!MOUSE_RELEASE(m->b) &&
-                                   MOUSE_WHEEL(m->b) == 0 &&
+                                   !MOUSE_WHEEL(m->b) &&
                                    !MOUSE_DRAG(m->b))
                                        return (1);
                        }
@@ -262,7 +262,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
                        if (MOUSE_RELEASE(m->b))
                                goto chosen;
                } else {
-                       if (MOUSE_WHEEL(m->b) == 0 && !MOUSE_DRAG(m->b))
+                       if (!MOUSE_WHEEL(m->b) && !MOUSE_DRAG(m->b))
                                goto chosen;
                }
                md->choice = m->y - (md->py + 1);
index 79b01fc..a9dfe37 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: popup.c,v 1.44 2022/02/01 18:12:20 nicm Exp $ */
+/* $OpenBSD: popup.c,v 1.45 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -509,7 +509,7 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
                    m->x > pd->px + pd->sx - 1 ||
                    m->y < pd->py ||
                    m->y > pd->py + pd->sy - 1) {
-                       if (MOUSE_BUTTONS(m->b) == 2)
+                       if (MOUSE_BUTTONS(m->b) == MOUSE_BUTTON_3)
                                goto menu;
                        return (0);
                }
@@ -524,16 +524,16 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
                                border = BOTTOM;
                }
                if ((m->b & MOUSE_MASK_MODIFIERS) == 0 &&
-                   MOUSE_BUTTONS(m->b) == 2 &&
+                   MOUSE_BUTTONS(m->b) == MOUSE_BUTTON_3 &&
                    (border == LEFT || border == TOP))
                    goto menu;
                if (((m->b & MOUSE_MASK_MODIFIERS) == MOUSE_MASK_META) ||
                    border != NONE) {
                        if (!MOUSE_DRAG(m->b))
                                goto out;
-                       if (MOUSE_BUTTONS(m->lb) == 0)
+                       if (MOUSE_BUTTONS(m->lb) == MOUSE_BUTTON_1)
                                pd->dragging = MOVE;
-                       else if (MOUSE_BUTTONS(m->lb) == 2)
+                       else if (MOUSE_BUTTONS(m->lb) == MOUSE_BUTTON_3)
                                pd->dragging = SIZE;
                        pd->dx = m->lx - pd->px;
                        pd->dy = m->ly - pd->py;
index a91a24c..c6e9826 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.390 2021/11/15 10:58:13 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.391 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -596,11 +596,11 @@ server_client_check_mouse(struct client *c, struct key_event *event)
                log_debug("double-click at %u,%u", x, y);
        } else if ((m->sgr_type != ' ' &&
            MOUSE_DRAG(m->sgr_b) &&
-           MOUSE_BUTTONS(m->sgr_b) == 3) ||
+           MOUSE_RELEASE(m->sgr_b)) ||
            (m->sgr_type == ' ' &&
            MOUSE_DRAG(m->b) &&
-           MOUSE_BUTTONS(m->b) == 3 &&
-           MOUSE_BUTTONS(m->lb) == 3)) {
+           MOUSE_RELEASE(m->b) &&
+           MOUSE_RELEASE(m->lb))) {
                type = MOVE;
                x = m->x, y = m->y, b = 0;
                log_debug("move at %u,%u", x, y);
@@ -753,7 +753,7 @@ have_event:
                m->wp = -1;
 
        /* Stop dragging if needed. */
-       if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag) {
+       if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag != 0) {
                if (c->tty.mouse_drag_release != NULL)
                        c->tty.mouse_drag_release(c, m);
 
@@ -764,8 +764,8 @@ have_event:
                 * End a mouse drag by passing a MouseDragEnd key corresponding
                 * to the button that started the drag.
                 */
-               switch (c->tty.mouse_drag_flag) {
-               case 1:
+               switch (c->tty.mouse_drag_flag - 1) {
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_MOUSEDRAGEND1_PANE;
                        if (where == STATUS)
@@ -779,7 +779,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDRAGEND1_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_MOUSEDRAGEND2_PANE;
                        if (where == STATUS)
@@ -793,7 +793,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDRAGEND2_BORDER;
                        break;
-               case 3:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_MOUSEDRAGEND3_PANE;
                        if (where == STATUS)
@@ -807,6 +807,90 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDRAGEND3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND10_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND10_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND10_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND10_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND10_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND10_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDRAGEND11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDRAGEND11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDRAGEND11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDRAGEND11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDRAGEND11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDRAGEND11_BORDER;
+                       break;
                default:
                        key = KEYC_MOUSE;
                        break;
@@ -839,7 +923,7 @@ have_event:
                        key = KEYC_DRAGGING;
                else {
                        switch (MOUSE_BUTTONS(b)) {
-                       case 0:
+                       case MOUSE_BUTTON_1:
                                if (where == PANE)
                                        key = KEYC_MOUSEDRAG1_PANE;
                                if (where == STATUS)
@@ -853,7 +937,7 @@ have_event:
                                if (where == BORDER)
                                        key = KEYC_MOUSEDRAG1_BORDER;
                                break;
-                       case 1:
+                       case MOUSE_BUTTON_2:
                                if (where == PANE)
                                        key = KEYC_MOUSEDRAG2_PANE;
                                if (where == STATUS)
@@ -867,7 +951,7 @@ have_event:
                                if (where == BORDER)
                                        key = KEYC_MOUSEDRAG2_BORDER;
                                break;
-                       case 2:
+                       case MOUSE_BUTTON_3:
                                if (where == PANE)
                                        key = KEYC_MOUSEDRAG3_PANE;
                                if (where == STATUS)
@@ -881,6 +965,90 @@ have_event:
                                if (where == BORDER)
                                        key = KEYC_MOUSEDRAG3_BORDER;
                                break;
+                       case MOUSE_BUTTON_6:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG6_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG6_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG6_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG6_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG6_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG6_BORDER;
+                               break;
+                       case MOUSE_BUTTON_7:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG7_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG7_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG7_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG7_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG7_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG7_BORDER;
+                               break;
+                       case MOUSE_BUTTON_8:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG8_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG8_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG8_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG8_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG8_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG8_BORDER;
+                               break;
+                       case MOUSE_BUTTON_9:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG9_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG9_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG9_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG9_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG9_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG9_BORDER;
+                               break;
+                       case MOUSE_BUTTON_10:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG10_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG10_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG10_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG10_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG10_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG10_BORDER;
+                               break;
+                       case MOUSE_BUTTON_11:
+                               if (where == PANE)
+                                       key = KEYC_MOUSEDRAG11_PANE;
+                               if (where == STATUS)
+                                       key = KEYC_MOUSEDRAG11_STATUS;
+                               if (where == STATUS_LEFT)
+                                       key = KEYC_MOUSEDRAG11_STATUS_LEFT;
+                               if (where == STATUS_RIGHT)
+                                       key = KEYC_MOUSEDRAG11_STATUS_RIGHT;
+                               if (where == STATUS_DEFAULT)
+                                       key = KEYC_MOUSEDRAG11_STATUS_DEFAULT;
+                               if (where == BORDER)
+                                       key = KEYC_MOUSEDRAG11_BORDER;
+                               break;
                        }
                }
 
@@ -921,7 +1089,7 @@ have_event:
                break;
        case UP:
                switch (MOUSE_BUTTONS(b)) {
-               case 0:
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_MOUSEUP1_PANE;
                        if (where == STATUS)
@@ -935,7 +1103,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEUP1_BORDER;
                        break;
-               case 1:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_MOUSEUP2_PANE;
                        if (where == STATUS)
@@ -949,7 +1117,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEUP2_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_MOUSEUP3_PANE;
                        if (where == STATUS)
@@ -963,11 +1131,95 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEUP3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP1_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP1_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP1_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP1_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP1_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP1_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_MOUSEUP11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEUP11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEUP11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEUP11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEUP11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEUP11_BORDER;
+                       break;
                }
                break;
        case DOWN:
                switch (MOUSE_BUTTONS(b)) {
-               case 0:
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_MOUSEDOWN1_PANE;
                        if (where == STATUS)
@@ -981,7 +1233,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDOWN1_BORDER;
                        break;
-               case 1:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_MOUSEDOWN2_PANE;
                        if (where == STATUS)
@@ -995,7 +1247,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDOWN2_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_MOUSEDOWN3_PANE;
                        if (where == STATUS)
@@ -1009,11 +1261,95 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_MOUSEDOWN3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN10_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN10_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN10_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN10_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN10_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN10_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_MOUSEDOWN11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_MOUSEDOWN11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_MOUSEDOWN11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_MOUSEDOWN11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_MOUSEDOWN11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_MOUSEDOWN11_BORDER;
+                       break;
                }
                break;
        case SECOND:
                switch (MOUSE_BUTTONS(b)) {
-               case 0:
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_SECONDCLICK1_PANE;
                        if (where == STATUS)
@@ -1027,7 +1363,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_SECONDCLICK1_BORDER;
                        break;
-               case 1:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_SECONDCLICK2_PANE;
                        if (where == STATUS)
@@ -1041,7 +1377,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_SECONDCLICK2_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_SECONDCLICK3_PANE;
                        if (where == STATUS)
@@ -1055,11 +1391,95 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_SECONDCLICK3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK10_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK10_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK10_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK10_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK10_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK10_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_SECONDCLICK11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_SECONDCLICK11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_SECONDCLICK11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_SECONDCLICK11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_SECONDCLICK11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_SECONDCLICK11_BORDER;
+                       break;
                }
                break;
        case DOUBLE:
                switch (MOUSE_BUTTONS(b)) {
-               case 0:
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_DOUBLECLICK1_PANE;
                        if (where == STATUS)
@@ -1073,7 +1493,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_DOUBLECLICK1_BORDER;
                        break;
-               case 1:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_DOUBLECLICK2_PANE;
                        if (where == STATUS)
@@ -1087,7 +1507,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_DOUBLECLICK2_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_DOUBLECLICK3_PANE;
                        if (where == STATUS)
@@ -1101,11 +1521,95 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_DOUBLECLICK3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK10_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK10_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK10_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK10_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK10_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK10_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_DOUBLECLICK11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_DOUBLECLICK11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_DOUBLECLICK11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_DOUBLECLICK11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_DOUBLECLICK11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_DOUBLECLICK11_BORDER;
+                       break;
                }
                break;
        case TRIPLE:
                switch (MOUSE_BUTTONS(b)) {
-               case 0:
+               case MOUSE_BUTTON_1:
                        if (where == PANE)
                                key = KEYC_TRIPLECLICK1_PANE;
                        if (where == STATUS)
@@ -1119,7 +1623,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_TRIPLECLICK1_BORDER;
                        break;
-               case 1:
+               case MOUSE_BUTTON_2:
                        if (where == PANE)
                                key = KEYC_TRIPLECLICK2_PANE;
                        if (where == STATUS)
@@ -1133,7 +1637,7 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_TRIPLECLICK2_BORDER;
                        break;
-               case 2:
+               case MOUSE_BUTTON_3:
                        if (where == PANE)
                                key = KEYC_TRIPLECLICK3_PANE;
                        if (where == STATUS)
@@ -1147,6 +1651,90 @@ have_event:
                        if (where == BORDER)
                                key = KEYC_TRIPLECLICK3_BORDER;
                        break;
+               case MOUSE_BUTTON_6:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK6_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK6_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK6_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK6_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK6_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK6_BORDER;
+                       break;
+               case MOUSE_BUTTON_7:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK7_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK7_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK7_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK7_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK7_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK7_BORDER;
+                       break;
+               case MOUSE_BUTTON_8:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK8_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK8_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK8_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK8_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK8_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK8_BORDER;
+                       break;
+               case MOUSE_BUTTON_9:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK9_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK9_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK9_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK9_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK9_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK9_BORDER;
+                       break;
+               case MOUSE_BUTTON_10:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK10_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK10_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK10_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK10_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK10_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK10_BORDER;
+                       break;
+               case MOUSE_BUTTON_11:
+                       if (where == PANE)
+                               key = KEYC_TRIPLECLICK11_PANE;
+                       if (where == STATUS)
+                               key = KEYC_TRIPLECLICK11_STATUS;
+                       if (where == STATUS_LEFT)
+                               key = KEYC_TRIPLECLICK11_STATUS_LEFT;
+                       if (where == STATUS_RIGHT)
+                               key = KEYC_TRIPLECLICK11_STATUS_RIGHT;
+                       if (where == STATUS_DEFAULT)
+                               key = KEYC_TRIPLECLICK11_STATUS_DEFAULT;
+                       if (where == BORDER)
+                               key = KEYC_TRIPLECLICK11_BORDER;
+                       break;
                }
                break;
        }
index 98887d1..1822467 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.1159 2022/02/15 13:03:02 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1160 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -201,26 +201,68 @@ enum {
        KEYC_MOUSE_KEY(MOUSEDOWN1),
        KEYC_MOUSE_KEY(MOUSEDOWN2),
        KEYC_MOUSE_KEY(MOUSEDOWN3),
+       KEYC_MOUSE_KEY(MOUSEDOWN6),
+       KEYC_MOUSE_KEY(MOUSEDOWN7),
+       KEYC_MOUSE_KEY(MOUSEDOWN8),
+       KEYC_MOUSE_KEY(MOUSEDOWN9),
+       KEYC_MOUSE_KEY(MOUSEDOWN10),
+       KEYC_MOUSE_KEY(MOUSEDOWN11),
        KEYC_MOUSE_KEY(MOUSEUP1),
        KEYC_MOUSE_KEY(MOUSEUP2),
        KEYC_MOUSE_KEY(MOUSEUP3),
+       KEYC_MOUSE_KEY(MOUSEUP6),
+       KEYC_MOUSE_KEY(MOUSEUP7),
+       KEYC_MOUSE_KEY(MOUSEUP8),
+       KEYC_MOUSE_KEY(MOUSEUP9),
+       KEYC_MOUSE_KEY(MOUSEUP10),
+       KEYC_MOUSE_KEY(MOUSEUP11),
        KEYC_MOUSE_KEY(MOUSEDRAG1),
        KEYC_MOUSE_KEY(MOUSEDRAG2),
        KEYC_MOUSE_KEY(MOUSEDRAG3),
+       KEYC_MOUSE_KEY(MOUSEDRAG6),
+       KEYC_MOUSE_KEY(MOUSEDRAG7),
+       KEYC_MOUSE_KEY(MOUSEDRAG8),
+       KEYC_MOUSE_KEY(MOUSEDRAG9),
+       KEYC_MOUSE_KEY(MOUSEDRAG10),
+       KEYC_MOUSE_KEY(MOUSEDRAG11),
        KEYC_MOUSE_KEY(MOUSEDRAGEND1),
        KEYC_MOUSE_KEY(MOUSEDRAGEND2),
        KEYC_MOUSE_KEY(MOUSEDRAGEND3),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND6),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND7),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND8),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND9),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND10),
+       KEYC_MOUSE_KEY(MOUSEDRAGEND11),
        KEYC_MOUSE_KEY(WHEELUP),
        KEYC_MOUSE_KEY(WHEELDOWN),
        KEYC_MOUSE_KEY(SECONDCLICK1),
        KEYC_MOUSE_KEY(SECONDCLICK2),
        KEYC_MOUSE_KEY(SECONDCLICK3),
+       KEYC_MOUSE_KEY(SECONDCLICK6),
+       KEYC_MOUSE_KEY(SECONDCLICK7),
+       KEYC_MOUSE_KEY(SECONDCLICK8),
+       KEYC_MOUSE_KEY(SECONDCLICK9),
+       KEYC_MOUSE_KEY(SECONDCLICK10),
+       KEYC_MOUSE_KEY(SECONDCLICK11),
        KEYC_MOUSE_KEY(DOUBLECLICK1),
        KEYC_MOUSE_KEY(DOUBLECLICK2),
        KEYC_MOUSE_KEY(DOUBLECLICK3),
+       KEYC_MOUSE_KEY(DOUBLECLICK6),
+       KEYC_MOUSE_KEY(DOUBLECLICK7),
+       KEYC_MOUSE_KEY(DOUBLECLICK8),
+       KEYC_MOUSE_KEY(DOUBLECLICK9),
+       KEYC_MOUSE_KEY(DOUBLECLICK10),
+       KEYC_MOUSE_KEY(DOUBLECLICK11),
        KEYC_MOUSE_KEY(TRIPLECLICK1),
        KEYC_MOUSE_KEY(TRIPLECLICK2),
        KEYC_MOUSE_KEY(TRIPLECLICK3),
+       KEYC_MOUSE_KEY(TRIPLECLICK6),
+       KEYC_MOUSE_KEY(TRIPLECLICK7),
+       KEYC_MOUSE_KEY(TRIPLECLICK8),
+       KEYC_MOUSE_KEY(TRIPLECLICK9),
+       KEYC_MOUSE_KEY(TRIPLECLICK10),
+       KEYC_MOUSE_KEY(TRIPLECLICK11),
 
        /* Backspace key. */
        KEYC_BSPACE,
@@ -1198,21 +1240,33 @@ struct session {
 RB_HEAD(sessions, session);
 
 /* Mouse button masks. */
-#define MOUSE_MASK_BUTTONS 3
+#define MOUSE_MASK_BUTTONS 195
 #define MOUSE_MASK_SHIFT 4
 #define MOUSE_MASK_META 8
 #define MOUSE_MASK_CTRL 16
 #define MOUSE_MASK_DRAG 32
-#define MOUSE_MASK_WHEEL 64
 #define MOUSE_MASK_MODIFIERS (MOUSE_MASK_SHIFT|MOUSE_MASK_META|MOUSE_MASK_CTRL)
 
-/* Mouse wheel states. */
-#define MOUSE_WHEEL_UP 0
-#define MOUSE_WHEEL_DOWN 1
+/* Mouse wheel type. */
+#define MOUSE_WHEEL_UP 64
+#define MOUSE_WHEEL_DOWN 65
+
+/* Mouse button type. */
+#define MOUSE_BUTTON_1 0
+#define MOUSE_BUTTON_2 1
+#define MOUSE_BUTTON_3 2
+#define MOUSE_BUTTON_6 66
+#define MOUSE_BUTTON_7 67
+#define MOUSE_BUTTON_8 128
+#define MOUSE_BUTTON_9 129
+#define MOUSE_BUTTON_10 130
+#define MOUSE_BUTTON_11 131
 
 /* Mouse helpers. */
 #define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
-#define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
+#define MOUSE_WHEEL(b) \
+       (((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_UP || \
+        ((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_DOWN)
 #define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
 #define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)
 
index 9519b2a..3fcad31 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.152 2022/02/15 13:03:02 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.153 2022/02/16 18:55:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1118,7 +1118,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
                /* Type is M for press, m for release. */
                sgr_type = ch;
                if (sgr_type == 'm')
-                       b |= 3;
+                       b = 3;
 
                /*
                 * Some terminals (like PuTTY 0.63) mistakenly send
@@ -1126,7 +1126,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
                 * Discard it before it reaches any program running inside
                 * tmux.
                 */
-               if (sgr_type == 'm' && (sgr_b & 64))
+               if (sgr_type == 'm' && MOUSE_WHEEL(sgr_b))
                    return (-2);
        } else
                return (-1);