summaryrefslogtreecommitdiffstats
path: root/window-choose.c
diff options
context:
space:
mode:
authornicm <nicm>2014-04-03 08:20:29 +0000
committernicm <nicm>2014-04-03 08:20:29 +0000
commitacef311fe356f408690e9f94727ed63a934b742f (patch)
treede04ad3fd0267ac02a8fd127aaf802b4287d2b45 /window-choose.c
parent8824dae6f7b21f95ea824ecc1abc31140763c971 (diff)
Work out mouse scroll wheel effect when the mouse is first detected and
store it in struct mouse_event, reduce the scroll size the 3 but allow shift to reduce it to 1 and meta and ctrl to multiply by 3 if the terminal supports them, also support wheel in choose mode. From Marcel Partap.
Diffstat (limited to 'window-choose.c')
-rw-r--r--window-choose.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/window-choose.c b/window-choose.c
index bb881aa5..c354d46f 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -721,7 +721,17 @@ window_choose_mouse(
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct window_choose_mode_item *item;
- u_int idx;
+ u_int i, idx;
+
+ if (m->event == MOUSE_EVENT_WHEEL) {
+ for (i = 0; i < m->scroll; i++) {
+ if (m->wheel == MOUSE_WHEEL_UP)
+ window_choose_key(wp, sess, KEYC_UP);
+ else
+ window_choose_key(wp, sess, KEYC_DOWN);
+ }
+ return;
+ }
if (~m->event & MOUSE_EVENT_CLICK)
return;