Based on http://article.gmane.org/gmane.editors.wily/270 http://article.gmane.org/gmane.editors.wily/271 diff -Naur wily-0.13.42/libXg/gwin.c wily-0.13.42-scrollwheel/libXg/gwin.c --- wily-0.13.42/libXg/gwin.c 2005-11-05 20:09:07.000000000 +0100 +++ wily-0.13.42-scrollwheel/libXg/gwin.c 2011-03-20 19:51:14.303669715 +0100 @@ -371,6 +371,8 @@ case 1: s |= Button1Mask; break; case 2: s |= Button2Mask; break; case 3: s |= Button3Mask; break; + case 4: s |= Button4Mask; break; + case 5: s |= Button5Mask; break; } break; case ButtonRelease: @@ -383,6 +385,8 @@ case 1: s &= ~Button1Mask; break; case 2: s &= ~Button2Mask; break; case 3: s &= ~Button3Mask; break; + case 4: s &= ~Button4Mask; break; + case 5: s &= ~Button5Mask; break; } break; case MotionNotify: @@ -399,6 +403,9 @@ if(s & Button1Mask) m.buttons |= 1; if(s & Button2Mask) m.buttons |= 2; if(s & Button3Mask) m.buttons |= 4; + if(s & Button4Mask) m.buttons |= 8; + if(s & Button5Mask) m.buttons |= 16; + f = ((GwinWidget)w)->gwin.gotmouse; if(f) (*f)(&m); diff -Naur wily-0.13.42/wily/const.h wily-0.13.42-scrollwheel/wily/const.h --- wily-0.13.42/wily/const.h 2005-11-05 20:09:07.000000000 +0100 +++ wily-0.13.42-scrollwheel/wily/const.h 2011-03-20 19:52:00.803019670 +0100 @@ -27,7 +27,7 @@ INSET = 4, /* mouse buttons */ - LEFT =1, MIDDLE=2, RIGHT=4, + LEFT =1, MIDDLE=2, RIGHT=4, UP=8, DOWN=16, /* keys */ Backspace = 0x7f, diff -Naur wily-0.13.42/wily/mouse.c wily-0.13.42-scrollwheel/wily/mouse.c --- wily-0.13.42/wily/mouse.c 2005-11-05 20:09:07.000000000 +0100 +++ wily-0.13.42-scrollwheel/wily/mouse.c 2011-03-20 19:57:04.458774672 +0100 @@ -151,6 +151,18 @@ } else { b2(v,r,false); } + } else if (oldbuttons & UP) { + if (m->buttons) /* cancelled an UP */ + while (m->buttons) + *m = emouse(); + else + view_linesdown(v,1,false); + } else if (oldbuttons & DOWN) { + if (m->buttons) /* cancelled a DOWN */ + while (m->buttons) + *m = emouse(); + else + view_linesdown(v,1,true); } else { assert((oldbuttons&RIGHT)); if(m->buttons) /* cancelled a b3 */ diff -Naur wily-0.13.42/wily/vshow.c wily-0.13.42-scrollwheel/wily/vshow.c --- wily-0.13.42/wily/vshow.c 2005-11-05 20:09:07.000000000 +0100 +++ wily-0.13.42-scrollwheel/wily/vshow.c 2011-03-20 19:57:55.701391654 +0100 @@ -184,6 +184,12 @@ n = back_height(v->t, v->visible.p0, v->f.font, Dx(v->f.r), m->xy.y - v->f.r.min.y); view_set(v, n); break; + case UP: + view_linesdown(v, 1, false); + break; + case DOWN: + view_linesdown(v, 1, true); + break; default: runepos = (text_length(v->t) * y) / Dy(v->f.r); n = text_startOfLine(v->t, runepos);