Package: mupdf
Version: 0.9-2
Followup-For: Bug #641746

Dear Maintainer,
please find attached a patch to add continuous scrolling for mupdf.

Regards,
Xavier

-- System Information:
Debian Release: 7.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'stable-updates'), (500, 
'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mupdf depends on:
ii  libc6         2.13-38
ii  libfreetype6  2.4.9-1.1
ii  libjbig2dec0  0.11+20120125-1
ii  libjpeg8      8d-1
ii  libopenjpeg2  1.3+dfsg-4.6
ii  libx11-6      2:1.5.0-1
ii  libxext6      2:1.3.1-2
ii  zlib1g        1:1.2.7.dfsg-13

mupdf recommends no packages.

Versions of packages mupdf suggests:
pn  mupdf-tools  <none>

-- no debconf information
--- mupdf-1.2-source/apps/pdfapp.c	2013-02-26 18:07:16.000000000 +0100
+++ mupdf-1.2-source_mod/apps/pdfapp.c	2013-04-21 16:50:17.984022968 +0200
@@ -1142,13 +1142,29 @@
 		break;
 
 	case 'j':
-		app->pany -= fz_pixmap_height(app->ctx, app->image) / 10;
-		pdfapp_showpage(app, 0, 0, 1, 0);
+        {
+		int image_h = fz_pixmap_height(app->ctx, app->image);
+		if (app->pany + image_h <= app->winh || app->winh >= image_h) {
+			panto = PAN_TO_TOP;
+			app->pageno++;
+			break;
+		}
+		app->pany -= image_h / 10;
+ 		pdfapp_showpage(app, 0, 0, 1, 0);
+		}
 		break;
 
 	case 'k':
-		app->pany += fz_pixmap_height(app->ctx, app->image) / 10;
-		pdfapp_showpage(app, 0, 0, 1, 0);
+        {
+		int image_h = fz_pixmap_height(app->ctx, app->image);
+		if (app->pany == 0 || app->winh >= image_h) {
+			panto = PAN_TO_BOTTOM;
+			app->pageno--;
+			break;
+		}
+		app->pany += image_h / 10;
+ 		pdfapp_showpage(app, 0, 0, 1, 0);
+		}
 		break;
 
 	case 'l':
@@ -1523,7 +1539,17 @@
 				int isx = (modifiers & (1<<0));
 				int xstep = isx ? 20 * dir : 0;
 				int ystep = !isx ? 20 * dir : 0;
-				pdfapp_panview(app, app->panx + xstep, app->pany + ystep);
+				int image_h = fz_pixmap_height(app->ctx, app->image);
+				if (ystep > 0 && app->pageno > 1 && (app->pany == 0 || app->winh >= image_h)) {
+					app->pany = -2000;
+					app->pageno--;
+					pdfapp_showpage(app, 1, 1, 1, 1);
+				} else if (ystep < 0 && app->pageno < app->pagecount &&
+						(app->pany + ystep + image_h <= app->winh || app->winh >= image_h)) {
+					app->pany = 0;
+					app->pageno++;
+					pdfapp_showpage(app, 1, 1, 1, 1);
+				} else pdfapp_panview(app, app->panx + xstep, app->pany + ystep);
 			}
 		}
 	}

Reply via email to