Couple mouse wheel to v-scrolls in file browser
[xboard.git] / filebrowser / draw.c
index b21d170..abab957 100644 (file)
@@ -505,7 +505,7 @@ SFscrollTimer(p, id)
        int     save;
        int     n;
 
-        n = (int) p;
+        n = (int)(intptr_t) p;
 
        dir = &(SFdirs[SFdirPtr + n]);
        save = dir->vOrigin;
@@ -535,7 +535,7 @@ SFscrollTimer(p, id)
 
        if (SFbuttonPressed) {
                SFscrollTimerId = XtAppAddTimeOut(SFapp,
-                       SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n);
+                       SFscrollTimerInterval(), SFscrollTimer, (XtPointer)(intptr_t) n);
        }
 }
 
@@ -576,7 +576,7 @@ SFnewInvertEntry(n, event)
                                SFscrollTimerAdded = 1;
                                SFscrollTimerId = XtAppAddTimeOut(SFapp,
                                        SFscrollTimerInterval(), SFscrollTimer,
-                                       (XtPointer) n);
+                                       (XtPointer)(intptr_t) n);
                        }
                }
 
@@ -655,7 +655,10 @@ SFvSliderMovedCallback(w, n, new)
 
        dir = &(SFdirs[SFdirPtr + n]);
 
+
        old = dir->vOrigin;
+       if(new == -1) new = old + 1; else if(new == -2) new = old - 1; // [HGM] indicates scroll direction on mousewheel event
+       if(new < 0 || new > dir->nEntries - SFlistSize) return;
        dir->vOrigin = new;
 
        if (old == new) {