tags 611221 +patch
thanks

FreeBSD carries a patch to fix this:
http://svnweb.freebsd.org/ports/head/graphics/mupdf/files/

I'm attaching a version of this patch forward-ported to mupdf 1.4. It
modifies the behavior of 'j', 'k' and the vertical mouse wheel to be
able to switch pages.

Index: mupdf-1.4/platform/x11/pdfapp.c
===================================================================
--- mupdf-1.4.orig/platform/x11/pdfapp.c	2014-04-11 08:10:41.000000000 -0700
+++ mupdf-1.4/platform/x11/pdfapp.c	2014-04-20 15:30:52.479324451 -0700
@@ -1122,11 +1122,15 @@
 		break;
 
 	case 'j':
+ 		if (app->pany + fz_pixmap_height(app->ctx, app->image) <= app->winh)
+ 			goto pagedown;
 		app->pany -= fz_pixmap_height(app->ctx, app->image) / 10;
 		pdfapp_showpage(app, 0, 0, 1, 0, 0);
 		break;
 
 	case 'k':
+ 		if (app->pany >= 0)
+ 			goto pageup;
 		app->pany += fz_pixmap_height(app->ctx, app->image) / 10;
 		pdfapp_showpage(app, 0, 0, 1, 0, 0);
 		break;
@@ -1194,6 +1198,7 @@
 	 */
 
 	case ',':
+	pageup:
 		panto = PAN_TO_BOTTOM;
 		if (app->numberlen > 0)
 			app->pageno -= atoi(app->number);
@@ -1202,6 +1207,7 @@
 		break;
 
 	case '.':
+	pagedown:
 		panto = PAN_TO_TOP;
 		if (app->numberlen > 0)
 			app->pageno += atoi(app->number);
@@ -1522,6 +1528,12 @@
 				int isx = (modifiers & (1<<0));
 				int xstep = isx ? 20 * dir : 0;
 				int ystep = !isx ? 20 * dir : 0;
+				if (!isx && dir < 0 && app->pany +
+				    fz_pixmap_height(app->ctx, app->image) <= app->winh)
+					pdfapp_onkey(app, 'j');
+				else if (!isx && dir > 0 && app->pany >= 0)
+					pdfapp_onkey(app, 'k');
+				else
 				pdfapp_panview(app, app->panx + xstep, app->pany + ystep);
 			}
 		}

Reply via email to