From acef311fe356f408690e9f94727ed63a934b742f Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 3 Apr 2014 08:20:29 +0000 Subject: 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. --- window-choose.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'window-choose.c') 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; -- cgit