View | Details | Raw Unified | Return to bug 157095 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/ports/graphics/mupdf/Makefile (+7 lines)
Lines 6-11 Link Here
6
6
7
PORTNAME=	mupdf
7
PORTNAME=	mupdf
8
PORTVERSION=	0.8.165
8
PORTVERSION=	0.8.165
9
PORTREVISION=	1
9
PORTEPOCH=	1
10
PORTEPOCH=	1
10
CATEGORIES=	graphics
11
CATEGORIES=	graphics
11
MASTER_SITES=	GOOGLE_CODE \
12
MASTER_SITES=	GOOGLE_CODE \
Lines 31-36 Link Here
31
LICENSE=	GPLv3
32
LICENSE=	GPLv3
32
LICENSE_FILE=	${WRKSRC}/COPYING
33
LICENSE_FILE=	${WRKSRC}/COPYING
33
34
35
.include <bsd.port.options.mk>
36
37
.if defined(WITH_SCROLL)
38
EXTRA_PATCHES+=	${FILESDIR}/scroll_hack-apps_pdfapp.c
39
.endif
40
34
post-patch:	.SILENT
41
post-patch:	.SILENT
35
	${REINPLACE_CMD} \
42
	${REINPLACE_CMD} \
36
		-e 's#\(PDF_APPS :=.*/\)#\1mu_#' \
43
		-e 's#\(PDF_APPS :=.*/\)#\1mu_#' \
(-)/usr/ports/graphics/mupdf/files/patch-apps_x11_main.c (+36 lines)
Line 0 Link Here
1
--- apps/x11_main.c.orig	2011-05-16 23:18:12.046785782 -0500
2
+++ apps/x11_main.c	2011-05-16 23:24:55.669305772 -0500
3
@@ -563,6 +563,24 @@ static void winresettmo(struct timeval *
4
 	tmo_at->tv_usec = 0;
5
 }
6
 
7
+/* reference:
8
+ * http://stackoverflow.com/questions/2621439/how-to-get-screen-dpi-linux-mac-programatically
9
+ */
10
+int get_dpi(void)
11
+{
12
+	Display *xdpy;
13
+	int xscr;
14
+	int x = 0;
15
+
16
+	if ((xdpy = XOpenDisplay(NULL))) {
17
+		xscr = DefaultScreen(xdpy);
18
+		x = (int) (DisplayWidth(xdpy, xscr) * 25.4 /
19
+				DisplayWidthMM(xdpy, xscr) + 0.5);
20
+		XCloseDisplay(xdpy);
21
+	}
22
+	return x;
23
+}
24
+
25
 int main(int argc, char **argv)
26
 {
27
 	int c;
28
@@ -571,7 +589,7 @@ int main(int argc, char **argv)
29
 	KeySym keysym;
30
 	int oldx = 0;
31
 	int oldy = 0;
32
-	int resolution = 72;
33
+	int resolution = get_dpi();
34
 	int pageno = 1;
35
 	int wasshowingpage;
36
 	struct timeval tmo, tmo_at;
(-)/usr/ports/graphics/mupdf/files/scroll_hack-apps_pdfapp.c (+46 lines)
Line 0 Link Here
1
--- apps/pdfapp.c.orig	2011-04-29 14:06:09.000000000 -0500
2
+++ apps/pdfapp.c	2011-05-16 19:58:55.650380651 -0500
3
@@ -777,11 +777,15 @@ void pdfapp_onkey(pdfapp_t *app, int c)
4
 		break;
5
 
6
 	case 'j':
7
+		if (app->pany + app->image->h <= app->winh)
8
+			goto pagedown;
9
 		app->pany -= app->image->h / 10;
10
 		pdfapp_showpage(app, 0, 0, 1);
11
 		break;
12
 
13
 	case 'k':
14
+		if (app->pany >= 0)
15
+			goto pageup;
16
 		app->pany += app->image->h / 10;
17
 		pdfapp_showpage(app, 0, 0, 1);
18
 		break;
19
@@ -843,6 +847,7 @@ void pdfapp_onkey(pdfapp_t *app, int c)
20
 	 */
21
 
22
 	case ',':
23
+	pageup:
24
 		panto = PAN_TO_BOTTOM;
25
 		if (app->numberlen > 0)
26
 			app->pageno -= atoi(app->number);
27
@@ -851,6 +856,7 @@ void pdfapp_onkey(pdfapp_t *app, int c)
28
 		break;
29
 
30
 	case '.':
31
+	pagedown:
32
 		panto = PAN_TO_TOP;
33
 		if (app->numberlen > 0)
34
 			app->pageno += atoi(app->number);
35
@@ -1022,6 +1028,11 @@ void pdfapp_onmouse(pdfapp_t *app, int x
36
 				int isx = (modifiers & (1<<0));
37
 				int xstep = isx ? 20 * dir : 0;
38
 				int ystep = !isx ? 20 * dir : 0;
39
+				if (!isx && dir < 0 && app->pany + app->image->h <= app->winh)
40
+					pdfapp_onkey(app, 'j');
41
+				else if (!isx && dir > 0 && app->pany >= 0)
42
+					pdfapp_onkey(app, 'k');
43
+				else
44
 				pdfapp_panview(app, app->panx + xstep, app->pany + ystep);
45
 			}
46
 		}

Return to bug 157095