diff -ur xv-3.10a/xv.h xv-3.10a_wheelmouse/xv.h --- xv-3.10a/xv.h Tue Jul 2 12:34:28 2002 +++ xv-3.10a_wheelmouse/xv.h Tue Jul 2 12:30:26 2002 @@ -747,6 +747,7 @@ #define STDINSTR "" +#define MAX(a,b) ((a)>(b))?(a):(b) #ifndef MAIN #define WHERE extern diff -ur xv-3.10a/xvbrowse.c xv-3.10a_wheelmouse/xvbrowse.c --- xv-3.10a/xvbrowse.c Tue Jul 2 12:34:28 2002 +++ xv-3.10a_wheelmouse/xvbrowse.c Tue Jul 2 12:30:08 2002 @@ -148,6 +148,7 @@ #define BUTTW 80 #define BUTTH 24 + static char *showHstr = "Show hidden files"; static char *hideHstr = "Hide 'hidden' files"; @@ -809,14 +810,41 @@ XButtonEvent *e = (XButtonEvent *) xev; int i,x,y; x = e->x; y = e->y; - + if (e->button == Button1) { if (e->window == br->win) clickBrow(br,x,y); else if (e->window == br->scrl.win) SCTrack(&(br->scrl),x,y); else if (e->window == br->iconW) { i = clickIconWin(br, x,y,(unsigned long) e->time, (e->state&ControlMask) || (e->state&ShiftMask)); - + } + else rv = 0; + } + else if (e->button == Button4) { + /* scroll regardless of where we are in the browser window */ + if (e->window == br->win || + e->window == br->scrl.win || + e->window == br->iconW) { + SCRL *sp=&(br->scrl); + int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */ + if (sp->val > sp->min+halfpage) + SCSetVal(sp,sp->val-halfpage); + else + SCSetVal(sp,sp->min); + } + else rv = 0; + } + else if (e->button == Button5) { + /* scroll regardless of where we are in the browser window */ + if (e->window == br->win || + e->window == br->scrl.win || + e->window == br->iconW) { + SCRL *sp=&(br->scrl); + int halfpage=MAX(1,sp->page/2); /* user resize to 1 line? */ + if (sp->val < sp->max-halfpage) + SCSetVal(sp,sp->val+halfpage); + else + SCSetVal(sp,sp->max); } else rv = 0; } diff -ur xv-3.10a/xvevent.c xv-3.10a_wheelmouse/xvevent.c --- xv-3.10a/xvevent.c Tue Jul 2 12:34:27 2002 +++ xv-3.10a_wheelmouse/xvevent.c Tue Jul 2 12:18:07 2002 @@ -1254,7 +1254,6 @@ else if (win == dirW) { i=ClickDirW(x,y); - switch (i) { case S_BOK: if (dirUp == BLOAD) { if (!DirCheckCD()) { @@ -1297,7 +1296,45 @@ if (!shift && !useroot) CtrlBox(!ctrlUp); else if (shift) BlurPaint(); break; - + + case Button4: + if (win == ctrlW || win == nList.win || win == nList.scrl.win) { + SCRL *sp=&nList.scrl; + int halfpage=sp->page/2; + if (sp->val > sp->min+halfpage) + SCSetVal(sp,sp->val-halfpage); + else + SCSetVal(sp,sp->min); + } + else if (win == dirW || win == dList.win || win == dList.scrl.win) { + SCRL *sp=&dList.scrl; + int halfpage=sp->page/2; + if (sp->val > sp->min+halfpage) + SCSetVal(sp,sp->val-halfpage); + else + SCSetVal(sp,sp->min); + } + break; + + case Button5: + if (win == ctrlW || win == nList.win || win == nList.scrl.win) { + SCRL *sp=&nList.scrl; + int halfpage=sp->page/2; + if (sp->val < sp->max-halfpage) + SCSetVal(sp,sp->val+halfpage); + else + SCSetVal(sp,sp->max); + } + else if (win == dirW || win == dList.win || win == dList.scrl.win) { + SCRL *sp=&dList.scrl; + int halfpage=sp->page/2; + if (sp->val < sp->max-halfpage) + SCSetVal(sp,sp->val+halfpage); + else + SCSetVal(sp,sp->max); + } + break; + default: break; } } diff -ur xv-3.10a/xvtext.c xv-3.10a_wheelmouse/xvtext.c --- xv-3.10a/xvtext.c Tue Jul 2 12:34:28 2002 +++ xv-3.10a_wheelmouse/xvtext.c Tue Jul 2 12:21:05 2002 @@ -595,9 +595,39 @@ else if (e->window == tv->textW) { } else rv = 0; } + else if (e->button == Button4) { + /* scroll regardless of where we are in the text window */ + if (e->window == tv->win || + e->window == tv->vscrl.win || + e->window == tv->hscrl.win || + e->window == tv->textW) { + SCRL *sp=&(tv->vscrl); + int halfpage=sp->page/2; + if (sp->val > sp->min+halfpage) + SCSetVal(sp,sp->val-halfpage); + else + SCSetVal(sp,sp->min); + } + else rv = 0; + } + else if (e->button == Button5) { + /* scroll regardless of where we are in the text window */ + if (e->window == tv->win || + e->window == tv->vscrl.win || + e->window == tv->hscrl.win || + e->window == tv->textW) { + SCRL *sp=&(tv->vscrl); + int halfpage=sp->page/2; + if (sp->val < sp->max-halfpage) + SCSetVal(sp,sp->val+halfpage); + else + SCSetVal(sp,sp->max); + } + else rv = 0; + } else rv = 0; } - + else if (xev->type == KeyPress) { XKeyEvent *e = (XKeyEvent *) xev;