+
+void check_pager_motion(int first, int stop) {
+ /* We check that the pager moved by an appropriate amount.
+ * The last gap can be smaller but not bigger.
+ */
+ int count= stop-first;
+
+#define PH(p) (page_structs[(p)].pagerheight)
+
+ debugf("CHECK_PAGER_MOTION %d..%d count=%d\n", first,stop,count);
+
+ if (count <= 1) return; /* only one page */
+
+ double firstheight= PH(first);
+ double max= count>2 ? firstheight / (count-2) : 1e6;
+ double min= firstheight / (count-1);
+ max *= 1.1;
+ min /= 1.1;
+ max += 1.0;
+ min -= 1.0;
+ debugf("CHECK_PAGER_MOTION min=%g max=%g\n", min,max);
+ assert(max>min);
+
+ int skips=0, firstskip=1;
+ int stops=0, firststop=1;
+
+#define REPORT(skipstop,msg) do{ \
+ skipstop##s++; \
+ if (first##skipstop<0) first##skipstop= page; \
+ if (skipstop##s<5) \
+ fprintf(stderr,msg " (page %d)\n",page); \
+ }while(0)
+
+ int page;
+ for (page=first+1; page<stop; page++) {
+ int gap= PH(page-1) - PH(page);
+ debugf("CHECK_PAGER_MOTION page=%2d gap=%2d\n", page, gap);
+ if (gap>max)
+ REPORT(skip, "scrollbar motion probable page skip detected!");
+ if (gap<min && page<stop-1)
+ REPORT(stop, "scrollbar short motion gives lie to our ideas!");
+ }
+ MUST(!skips && !stops,
+ MI(skips);MI(firstskip);MF(max);MI(PH(firstskip));MI(PH(firstskip-1));
+ MI(stops);MI(firststop);MF(min);MI(PH(firststop));MI(PH(firststop-1));
+ MF(firstheight);MI(PH(stop-2));MI(PH(stop-1));
+ MSB(
+"\n\n"
+"Your YPP client seems to be paging irregularly. Perhaps your computer\n"
+"is too slow or overloaded or perhaps you are messing with the mouse ?\n"
+ ));
+}