Mouse support on the scrollbars, from Michael Grant.

This commit is contained in:
nicm 2024-11-12 09:32:56 +00:00
parent c26d71d3e9
commit 713cacab1e
7 changed files with 634 additions and 70 deletions

View File

@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
.name = "copy-mode",
.alias = NULL,
.args = { "deHMs:t:uq", 0, 0, NULL },
.usage = "[-deHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE,
.args = { "deHMqSs:t:u", 0, 0, NULL },
.usage = "[-deHMqSu] [-s src-pane] " CMD_TARGET_PANE_USAGE,
.source = { 's', CMD_FIND_PANE, 0 },
.target = { 't', CMD_FIND_PANE, 0 },
@ -92,7 +92,12 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'u'))
window_copy_pageup(wp, 0);
if (args_has(args, 'd'))
window_copy_pagedown(wp, 0, args_has(args, 'e'));
window_copy_pagedown(wp, 0, args_has(args, 'e'));
if (args_has(args, 'S')) {
window_copy_scroll(wp, c->tty.mouse_slider_mpos, event->m.y,
args_has(args, 'e'));
return (CMD_RETURN_NORMAL);
}
return (CMD_RETURN_NORMAL);
}

View File

@ -478,6 +478,11 @@ key_bindings_init(void)
"bind -n MouseDown3Pane { if -Ft= '#{||:#{mouse_any_flag},#{&&:#{pane_in_mode},#{?#{m/r:(copy|view)-mode,#{pane_mode}},0,1}}}' { select-pane -t=; send -M } { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " } }",
"bind -n M-MouseDown3Pane { display-menu -t= -xM -yM -T '#[align=centre]#{pane_index} (#{pane_id})' " DEFAULT_PANE_MENU " }",
/* Mouse on scrollbar. */
"bind -n MouseDown1ScrollbarUp { copy-mode -u }",
"bind -n MouseDown1ScrollbarDown { copy-mode -d }",
"bind -n MouseDrag1ScrollbarSlider { copy-mode -S }",
/* Copy mode (emacs) keys. */
"bind -Tcopy-mode C-Space { send -X begin-selection }",
"bind -Tcopy-mode C-a { send -X start-of-line }",

View File

@ -1001,6 +1001,10 @@ screen_redraw_draw_pane_scrollbar(struct screen_redraw_ctx *ctx,
screen_redraw_draw_scrollbar(ctx, wp, sb_pos, sb_x, sb_y, sb_h,
slider_h, slider_y);
/* Store current position and height of the slider */
wp->sb_slider_y = slider_y; /* top of slider y pos in scrollbar */
wp->sb_slider_h = slider_h; /* height of slider */
}
static void

View File

@ -576,10 +576,12 @@ server_client_check_mouse(struct client *c, struct key_event *event)
{
struct mouse_event *m = &event->m;
struct session *s = c->session, *fs;
struct options *wo = s->curw->window->options;
struct winlink *fwl;
struct window_pane *wp, *fwp;
u_int x, y, b, sx, sy, px, py;
int ignore = 0;
u_int x, y, b, sx, sy, px, py, line = 0, sb_pos;
u_int sl_top, sl_bottom, sl_mpos = 0;
int ignore = 0, sb, sb_w, pane_status;
key_code key;
struct timeval tv;
struct style_range *sr;
@ -598,7 +600,10 @@ server_client_check_mouse(struct client *c, struct key_event *event)
STATUS_LEFT,
STATUS_RIGHT,
STATUS_DEFAULT,
BORDER } where = NOWHERE;
BORDER,
SCROLLBAR_UP,
SCROLLBAR_SLIDER,
SCROLLBAR_DOWN } where = NOWHERE;
log_debug("%s mouse %02x at %u,%u (last %u,%u) (%d)", c->name, m->b,
m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag);
@ -747,54 +752,114 @@ have_event:
}
}
/* Not on status line. Adjust position and check for border or pane. */
/*
* Not on status line. Adjust position and check for border, pane, or
* scrollbar.
*/
if (where == NOWHERE) {
px = x;
if (m->statusat == 0 && y >= m->statuslines)
py = y - m->statuslines;
else if (m->statusat > 0 && y >= (u_int)m->statusat)
py = m->statusat - 1;
else
py = y;
tty_window_offset(&c->tty, &m->ox, &m->oy, &sx, &sy);
log_debug("mouse window @%u at %u,%u (%ux%u)",
s->curw->window->id, m->ox, m->oy, sx, sy);
if (px > sx || py > sy)
return (KEYC_UNKNOWN);
px = px + m->ox;
py = py + m->oy;
/* Try the pane borders if not zoomed. */
if (~s->curw->window->flags & WINDOW_ZOOMED) {
TAILQ_FOREACH(wp, &s->curw->window->panes, entry) {
if ((wp->xoff + wp->sx == px &&
wp->yoff <= 1 + py &&
wp->yoff + wp->sy >= py) ||
(wp->yoff + wp->sy == py &&
wp->xoff <= 1 + px &&
wp->xoff + wp->sx >= px))
break;
}
if (wp != NULL)
where = BORDER;
}
/* Otherwise try inside the pane. */
if (where == NOWHERE) {
wp = window_get_active_at(s->curw->window, px, py);
if (wp != NULL)
where = PANE;
if (c->tty.mouse_scrolling_flag)
where = SCROLLBAR_SLIDER;
else {
px = x;
if (m->statusat == 0 && y >= m->statuslines)
py = y - m->statuslines;
else if (m->statusat > 0 && y >= (u_int)m->statusat)
py = m->statusat - 1;
else
py = y;
tty_window_offset(&c->tty, &m->ox, &m->oy, &sx, &sy);
log_debug("mouse window @%u at %u,%u (%ux%u)",
s->curw->window->id, m->ox, m->oy, sx, sy);
if (px > sx || py > sy)
return (KEYC_UNKNOWN);
px = px + m->ox;
py = py + m->oy;
/* Try inside the pane. */
wp = window_get_active_at(s->curw->window, px, py);
if (wp == NULL)
return (KEYC_UNKNOWN);
/* Try the scrollbar next to a pane. */
sb = options_get_number(wo, "pane-scrollbars");
sb_pos = options_get_number(wo,
"pane-scrollbars-position");
if (sb == PANE_SCROLLBARS_ALWAYS ||
(sb == PANE_SCROLLBARS_MODAL &&
window_pane_mode(wp) != WINDOW_PANE_NO_MODE))
sb_w = PANE_SCROLLBARS_WIDTH;
else
sb_w = 0;
pane_status = options_get_number(wo,
"pane-border-status");
if (pane_status == PANE_STATUS_TOP)
line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM)
line = wp->yoff + wp->sy;
/*
* Check if py could lie within a scrollbar. If the
* pane is at the top, then py is 0; if not then the
* top, then yoff to yoff + sy.
*/
if ((pane_status != PANE_STATUS_OFF && py != line) ||
(wp->yoff == 0 && py < wp->sy) ||
(py >= wp->yoff && py < wp->yoff + wp->sy)) {
if ((sb_pos == PANE_SCROLLBARS_RIGHT &&
(px >= wp->xoff + wp->sx &&
px < wp->xoff + wp->sx + sb_w)) ||
(sb_pos == PANE_SCROLLBARS_LEFT &&
(px >= wp->xoff - sb_w &&
px < wp->xoff))) {
sl_top = wp->yoff + wp->sb_slider_y;
sl_bottom = (wp->yoff +
wp->sb_slider_y +
wp->sb_slider_h - 1);
if (py < sl_top)
where = SCROLLBAR_UP;
else if (py >= sl_top &&
py <= sl_bottom) {
where = SCROLLBAR_SLIDER;
sl_mpos = (py -
wp->sb_slider_y - wp->yoff);
} else /* py > sl_bottom */
where = SCROLLBAR_DOWN;
} else
where = PANE;
} else {
/* Try the pane borders if not zoomed. */
if (~s->curw->window->flags & WINDOW_ZOOMED) {
TAILQ_FOREACH(wp,
&s->curw->window->panes, entry) {
if ((wp->xoff + wp->sx == px &&
wp->yoff <= 1 + py &&
wp->yoff + wp->sy >= py) ||
(wp->yoff + wp->sy == py &&
wp->xoff <= 1 + px &&
wp->xoff + wp->sx >= px))
break;
}
if (wp != NULL)
where = BORDER;
}
}
if (where == PANE) {
log_debug("mouse %u,%u on pane %%%u", x, y,
wp->id);
} else if (where == BORDER)
log_debug("mouse on pane %%%u border", wp->id);
else if (where == SCROLLBAR_UP ||
where == SCROLLBAR_SLIDER ||
where == SCROLLBAR_DOWN) {
log_debug("mouse on pane %%%u scrollbar",
wp->id);
}
m->wp = wp->id;
m->w = wp->window->id;
}
if (where == PANE)
log_debug("mouse %u,%u on pane %%%u", x, y, wp->id);
else if (where == BORDER)
log_debug("mouse on pane %%%u border", wp->id);
m->wp = wp->id;
m->w = wp->window->id;
}
} else
m->wp = -1;
/* Stop dragging if needed. */
if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag != 0) {
@ -803,6 +868,7 @@ have_event:
c->tty.mouse_drag_update = NULL;
c->tty.mouse_drag_release = NULL;
c->tty.mouse_scrolling_flag = 0;
/*
* End a mouse drag by passing a MouseDragEnd key corresponding
@ -820,6 +886,8 @@ have_event:
key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND1_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND1_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND1_BORDER;
break;
@ -834,6 +902,8 @@ have_event:
key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND2_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND2_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND2_BORDER;
break;
@ -848,6 +918,8 @@ have_event:
key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND3_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND3_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND3_BORDER;
break;
@ -862,6 +934,8 @@ have_event:
key = KEYC_MOUSEDRAGEND6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND6_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND6_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND6_BORDER;
break;
@ -876,6 +950,8 @@ have_event:
key = KEYC_MOUSEDRAGEND7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND7_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND7_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND7_BORDER;
break;
@ -890,6 +966,8 @@ have_event:
key = KEYC_MOUSEDRAGEND8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND8_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND8_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND8_BORDER;
break;
@ -904,6 +982,8 @@ have_event:
key = KEYC_MOUSEDRAGEND9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND9_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND9_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND9_BORDER;
break;
@ -918,6 +998,8 @@ have_event:
key = KEYC_MOUSEDRAGEND10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND10_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND10_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND10_BORDER;
break;
@ -932,6 +1014,8 @@ have_event:
key = KEYC_MOUSEDRAGEND11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND11_STATUS_DEFAULT;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAGEND11_SCROLLBAR_SLIDER;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND11_BORDER;
break;
@ -940,6 +1024,7 @@ have_event:
break;
}
c->tty.mouse_drag_flag = 0;
c->tty.mouse_slider_mpos = -1;
goto out;
}
@ -978,6 +1063,12 @@ have_event:
key = KEYC_MOUSEDRAG1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG1_BORDER;
break;
@ -992,6 +1083,12 @@ have_event:
key = KEYC_MOUSEDRAG2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG2_BORDER;
break;
@ -1006,6 +1103,12 @@ have_event:
key = KEYC_MOUSEDRAG3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG3_BORDER;
break;
@ -1020,6 +1123,12 @@ have_event:
key = KEYC_MOUSEDRAG6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG6_BORDER;
break;
@ -1034,6 +1143,12 @@ have_event:
key = KEYC_MOUSEDRAG7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG7_BORDER;
break;
@ -1048,6 +1163,12 @@ have_event:
key = KEYC_MOUSEDRAG8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG8_BORDER;
break;
@ -1062,6 +1183,12 @@ have_event:
key = KEYC_MOUSEDRAG9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG9_BORDER;
break;
@ -1076,6 +1203,12 @@ have_event:
key = KEYC_MOUSEDRAG10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG10_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG10_BORDER;
break;
@ -1090,6 +1223,12 @@ have_event:
key = KEYC_MOUSEDRAG11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDRAG11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDRAG11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDRAG11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDRAG11_BORDER;
break;
@ -1098,9 +1237,16 @@ have_event:
/*
* Begin a drag by setting the flag to a non-zero value that
* corresponds to the mouse button in use.
* corresponds to the mouse button in use. If starting to drag
* the scrollbar, store the relative position in the slider
* where the user grabbed.
*/
c->tty.mouse_drag_flag = MOUSE_BUTTONS(b) + 1;
if (c->tty.mouse_scrolling_flag == 0 &&
where == SCROLLBAR_SLIDER) {
c->tty.mouse_scrolling_flag = 1;
c->tty.mouse_slider_mpos = sl_mpos;
}
break;
case WHEEL:
if (MOUSE_BUTTONS(b) == MOUSE_WHEEL_UP) {
@ -1144,6 +1290,12 @@ have_event:
key = KEYC_MOUSEUP1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER;
break;
@ -1158,6 +1310,12 @@ have_event:
key = KEYC_MOUSEUP2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP2_BORDER;
break;
@ -1172,6 +1330,12 @@ have_event:
key = KEYC_MOUSEUP3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP3_BORDER;
break;
@ -1186,6 +1350,12 @@ have_event:
key = KEYC_MOUSEUP6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP6_BORDER;
break;
@ -1200,6 +1370,12 @@ have_event:
key = KEYC_MOUSEUP7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP7_BORDER;
break;
@ -1214,6 +1390,12 @@ have_event:
key = KEYC_MOUSEUP8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP8_BORDER;
break;
@ -1228,6 +1410,12 @@ have_event:
key = KEYC_MOUSEUP9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP9_BORDER;
break;
@ -1241,7 +1429,13 @@ have_event:
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
key = KEYC_MOUSEUP10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER;
break;
@ -1256,6 +1450,12 @@ have_event:
key = KEYC_MOUSEUP11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEUP11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEUP11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEUP11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEUP11_BORDER;
break;
@ -1274,6 +1474,12 @@ have_event:
key = KEYC_MOUSEDOWN1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN1_BORDER;
break;
@ -1288,6 +1494,12 @@ have_event:
key = KEYC_MOUSEDOWN2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN2_BORDER;
break;
@ -1302,6 +1514,12 @@ have_event:
key = KEYC_MOUSEDOWN3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN3_BORDER;
break;
@ -1316,6 +1534,12 @@ have_event:
key = KEYC_MOUSEDOWN6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN6_BORDER;
break;
@ -1330,6 +1554,12 @@ have_event:
key = KEYC_MOUSEDOWN7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN7_BORDER;
break;
@ -1344,6 +1574,12 @@ have_event:
key = KEYC_MOUSEDOWN8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN8_BORDER;
break;
@ -1358,6 +1594,12 @@ have_event:
key = KEYC_MOUSEDOWN9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN9_BORDER;
break;
@ -1372,6 +1614,12 @@ have_event:
key = KEYC_MOUSEDOWN10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN10_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN10_BORDER;
break;
@ -1386,6 +1634,12 @@ have_event:
key = KEYC_MOUSEDOWN11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_MOUSEDOWN11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_MOUSEDOWN11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_MOUSEDOWN11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_MOUSEDOWN11_BORDER;
break;
@ -1404,6 +1658,12 @@ have_event:
key = KEYC_SECONDCLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK1_BORDER;
break;
@ -1418,6 +1678,12 @@ have_event:
key = KEYC_SECONDCLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK2_BORDER;
break;
@ -1432,6 +1698,12 @@ have_event:
key = KEYC_SECONDCLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK3_BORDER;
break;
@ -1446,6 +1718,12 @@ have_event:
key = KEYC_SECONDCLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK6_BORDER;
break;
@ -1460,6 +1738,12 @@ have_event:
key = KEYC_SECONDCLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK7_BORDER;
break;
@ -1474,6 +1758,12 @@ have_event:
key = KEYC_SECONDCLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK8_BORDER;
break;
@ -1488,6 +1778,12 @@ have_event:
key = KEYC_SECONDCLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK9_BORDER;
break;
@ -1502,6 +1798,12 @@ have_event:
key = KEYC_SECONDCLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK10_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK10_BORDER;
break;
@ -1516,6 +1818,12 @@ have_event:
key = KEYC_SECONDCLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_SECONDCLICK11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_SECONDCLICK11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_SECONDCLICK11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_SECONDCLICK11_BORDER;
break;
@ -1534,6 +1842,12 @@ have_event:
key = KEYC_DOUBLECLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK1_BORDER;
break;
@ -1548,6 +1862,12 @@ have_event:
key = KEYC_DOUBLECLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK2_BORDER;
break;
@ -1562,6 +1882,12 @@ have_event:
key = KEYC_DOUBLECLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK3_BORDER;
break;
@ -1576,6 +1902,12 @@ have_event:
key = KEYC_DOUBLECLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK6_BORDER;
break;
@ -1590,6 +1922,12 @@ have_event:
key = KEYC_DOUBLECLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK7_BORDER;
break;
@ -1604,6 +1942,12 @@ have_event:
key = KEYC_DOUBLECLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK8_BORDER;
break;
@ -1618,6 +1962,12 @@ have_event:
key = KEYC_DOUBLECLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK9_BORDER;
break;
@ -1632,6 +1982,12 @@ have_event:
key = KEYC_DOUBLECLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK10_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK10_BORDER;
break;
@ -1646,6 +2002,12 @@ have_event:
key = KEYC_DOUBLECLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_DOUBLECLICK11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_DOUBLECLICK11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_DOUBLECLICK11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_DOUBLECLICK11_BORDER;
break;
@ -1664,6 +2026,12 @@ have_event:
key = KEYC_TRIPLECLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK1_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK1_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK1_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK1_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK1_BORDER;
break;
@ -1678,6 +2046,12 @@ have_event:
key = KEYC_TRIPLECLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK2_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK2_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK2_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK2_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK2_BORDER;
break;
@ -1692,6 +2066,12 @@ have_event:
key = KEYC_TRIPLECLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK3_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK3_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK3_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK3_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK3_BORDER;
break;
@ -1706,6 +2086,12 @@ have_event:
key = KEYC_TRIPLECLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK6_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK6_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK6_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK6_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK6_BORDER;
break;
@ -1720,6 +2106,12 @@ have_event:
key = KEYC_TRIPLECLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK7_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK7_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK7_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK7_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK7_BORDER;
break;
@ -1734,6 +2126,12 @@ have_event:
key = KEYC_TRIPLECLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK8_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK8_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK8_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK8_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK8_BORDER;
break;
@ -1748,6 +2146,12 @@ have_event:
key = KEYC_TRIPLECLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK9_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK9_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK9_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK9_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK9_BORDER;
break;
@ -1762,6 +2166,12 @@ have_event:
key = KEYC_TRIPLECLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK10_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK10_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK10_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK10_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK10_BORDER;
break;
@ -1776,6 +2186,12 @@ have_event:
key = KEYC_TRIPLECLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK11_STATUS_DEFAULT;
if (where == SCROLLBAR_UP)
key = KEYC_TRIPLECLICK11_SCROLLBAR_UP;
if (where == SCROLLBAR_SLIDER)
key = KEYC_TRIPLECLICK11_SCROLLBAR_SLIDER;
if (where == SCROLLBAR_DOWN)
key = KEYC_TRIPLECLICK11_SCROLLBAR_DOWN;
if (where == BORDER)
key = KEYC_TRIPLECLICK11_BORDER;
break;

24
tmux.1
View File

@ -2400,22 +2400,31 @@ The synopsis for the
command is:
.Bl -tag -width Ds
.It Xo Ic copy-mode
.Op Fl deHMqu
.Op Fl deHMqSu
.Op Fl s Ar src-pane
.Op Fl t Ar target-pane
.Xc
Enter copy mode.
.Pp
.Fl u
also scrolls one page up after entering and
enters copy mode and scrolls one page up and
.Fl d
one page down if already in copy mode.
.Fl M
begins a mouse drag (only valid if bound to a mouse key binding, see
.Sx MOUSE SUPPORT ) .
one page down.
.Fl H
hides the position indicator in the top right.
.Fl q
cancels copy mode and any other modes.
.Pp
.Fl M
begins a mouse drag (only valid if bound to a mouse key binding, see
.Sx MOUSE SUPPORT ) .
.Fl S
scrolls when bound to a mouse drag event; for example,
.Ic copy-mode -Se
is bound to
.Ar MouseDrag1ScrollbarSlider
by default.
.Pp
.Fl s
copies from
.Ar src-pane
@ -5441,6 +5450,9 @@ and a location suffix, one of the following:
.It Li "StatusLeft" Ta "the left part of the status line"
.It Li "StatusRight" Ta "the right part of the status line"
.It Li "StatusDefault" Ta "any other part of the status line"
.It Li "ScrollbarSlider" Ta "the scrollbar slider"
.It Li "ScrollbarUp" Ta "above the scrollbar slider"
.It Li "ScrollbarDown" Ta "below the scrollbar slider"
.El
.Pp
The following mouse events are available:

37
tmux.h
View File

@ -169,19 +169,25 @@ struct winlink;
#define KEYC_CLICK_TIMEOUT 300
/* Mouse key codes. */
#define KEYC_MOUSE_KEY(name) \
KEYC_ ## name ## _PANE, \
KEYC_ ## name ## _STATUS, \
KEYC_ ## name ## _STATUS_LEFT, \
KEYC_ ## name ## _STATUS_RIGHT, \
KEYC_ ## name ## _STATUS_DEFAULT, \
#define KEYC_MOUSE_KEY(name) \
KEYC_ ## name ## _PANE, \
KEYC_ ## name ## _STATUS, \
KEYC_ ## name ## _STATUS_LEFT, \
KEYC_ ## name ## _STATUS_RIGHT, \
KEYC_ ## name ## _STATUS_DEFAULT, \
KEYC_ ## name ## _SCROLLBAR_UP, \
KEYC_ ## name ## _SCROLLBAR_SLIDER, \
KEYC_ ## name ## _SCROLLBAR_DOWN, \
KEYC_ ## name ## _BORDER
#define KEYC_MOUSE_STRING(name, s) \
{ #s "Pane", KEYC_ ## name ## _PANE }, \
{ #s "Status", KEYC_ ## name ## _STATUS }, \
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
#define KEYC_MOUSE_STRING(name, s) \
{ #s "Pane", KEYC_ ## name ## _PANE }, \
{ #s "Status", KEYC_ ## name ## _STATUS }, \
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
{ #s "ScrollbarUp", KEYC_ ## name ## _SCROLLBAR_UP }, \
{ #s "ScrollbarSlider", KEYC_ ## name ## _SCROLLBAR_SLIDER }, \
{ #s "ScrollbarDown", KEYC_ ## name ## _SCROLLBAR_DOWN }, \
{ #s "Border", KEYC_ ## name ## _BORDER }
/*
@ -1109,6 +1115,9 @@ struct window_pane {
#define PANE_UNSEENCHANGES 0x2000
#define PANE_REDRAWSCROLLBAR 0x4000
u_int sb_slider_y;
u_int sb_slider_h;
int argc;
char **argv;
char *shell;
@ -1509,6 +1518,9 @@ struct tty {
u_int mouse_last_y;
u_int mouse_last_b;
int mouse_drag_flag;
int mouse_scrolling_flag;
int mouse_slider_mpos;
void (*mouse_drag_update)(struct client *,
struct mouse_event *);
void (*mouse_drag_release)(struct client *,
@ -3266,6 +3278,7 @@ void printflike(3, 4) window_copy_add(struct window_pane *, int, const char *,
...);
void printflike(3, 0) window_copy_vadd(struct window_pane *, int, const char *,
va_list);
void window_copy_scroll(struct window_pane *, int, u_int, int);
void window_copy_pageup(struct window_pane *, int);
void window_copy_pagedown(struct window_pane *, int, int);
void window_copy_start_drag(struct client *, struct mouse_event *);

View File

@ -40,6 +40,8 @@ static void window_copy_free(struct window_mode_entry *);
static void window_copy_resize(struct window_mode_entry *, u_int, u_int);
static void window_copy_formats(struct window_mode_entry *,
struct format_tree *);
static void window_copy_scroll1(struct window_mode_entry *,
struct window_pane *wp, int, u_int, int);
static void window_copy_pageup1(struct window_mode_entry *, int);
static int window_copy_pagedown1(struct window_mode_entry *, int, int);
static void window_copy_next_paragraph(struct window_mode_entry *);
@ -598,6 +600,113 @@ window_copy_vadd(struct window_pane *wp, int parse, const char *fmt, va_list ap)
screen_write_stop(&ctx);
}
void
window_copy_scroll(struct window_pane *wp, int sl_mpos, u_int my,
int scroll_exit)
{
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
if (wme != NULL) {
window_set_active_pane(wp->window, wp, 0);
window_copy_scroll1(wme, wp, sl_mpos, my, scroll_exit);
}
}
static void
window_copy_scroll1(struct window_mode_entry *wme, struct window_pane *wp,
int sl_mpos, u_int my, int scroll_exit)
{
struct window_copy_mode_data *data = wme->data;
u_int ox, oy, px, py, n, offset, size;
u_int new_offset, slider_y = wp->sb_slider_y;
u_int slider_height = wp->sb_slider_h;
u_int sb_height = wp->sy, sb_top = wp->yoff;
u_int sy = screen_size_y(data->backing);
int new_slider_y, delta;
/*
* sl_mpos is where in the slider the user is dragging, mouse is
* dragging this y point relative to top of slider.
*/
if (my <= sb_top + sl_mpos) {
/* Slider banged into top. */
new_slider_y = sb_top - wp->yoff;
} else if (my - sl_mpos > sb_top + sb_height - slider_height) {
/* Slider banged into bottom. */
new_slider_y = sb_top - wp->yoff + (sb_height - slider_height);
} else {
/* Slider is somewhere in the middle. */
new_slider_y = my - wp->yoff - sl_mpos + 1;
}
if (TAILQ_FIRST(&wp->modes) == NULL ||
window_copy_get_current_offset(wp, &offset, &size) == 0)
return;
/*
* See screen_redraw_draw_pane_scrollbar - this is the inverse of the
* formula used there.
*/
new_offset = new_slider_y * ((float)(size + sb_height) / sb_height);
delta = (int)offset - new_offset;
/*
* Move pane view around based on delta relative to the cursor,
* maintaining the selection.
*/
oy = screen_hsize(data->backing) + data->cy - data->oy;
ox = window_copy_find_length(wme, oy);
if (data->cx != ox) {
data->lastcx = data->cx;
data->lastsx = ox;
}
data->cx = data->lastcx;
if (delta >= 0) {
n = (u_int)delta;
if (data->oy + n > screen_hsize(data->backing)) {
data->oy = screen_hsize(data->backing);
if (data->cy < n)
data->cy = 0;
else
data->cy -= n;
} else
data->oy += n;
} else {
n = (u_int)-delta;
if (data->oy < n) {
data->oy = 0;
if (data->cy + (n - data->oy) >= sy)
data->cy = sy - 1;
else
data->cy += n - data->oy;
} else
data->oy -= n;
}
/* Don't also drag tail when dragging a scrollbar, it looks weird. */
data->cursordrag = CURSORDRAG_NONE;
if (data->screen.sel == NULL || !data->rectflag) {
py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wme, py);
if ((data->cx >= data->lastsx && data->cx != px) ||
data->cx > px)
window_copy_cursor_end_of_line(wme);
}
if (scroll_exit && data->oy == 0) {
window_pane_reset_mode(wp);
return;
}
if (data->searchmark != NULL && !data->timeout)
window_copy_search_marks(wme, NULL, data->searchregex, 1);
window_copy_update_selection(wme, 1, 0);
window_copy_redraw_screen(wme);
}
void
window_copy_pageup(struct window_pane *wp, int half_page)
{