[gs-commits] mupdf 1.16.1.25 x11: Just like mupdf-gl, number + space/b

[email protected] (Sebastian Rasmussen)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit 798fff06bde9c57ddd025c76de0940c3c0be020c
Author: Sebastian Rasmussen <[email protected]>
Date:   Thu Aug 22 14:44:30 2019 +0200

    x11: Just like mupdf-gl, number + space/b now jumps multiple steps.

diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 7293169..468df13 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -1472,56 +1472,72 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers)
 		break;
 
 	case 'b':
-		if (app->pany >= -app->imgh/20)
 		{
-			if (app->panx >= -app->imgw/20)
+			int number = 1;
+			if (app->numberlen > 0)
+				number = fz_maxi(atoi(app->number), number);
+			while (number--)
 			{
-				if (app->pageno - 1 > 0)
+				if (app->pany >= -app->imgh/20)
 				{
-					app->panx = INT_MIN;
-					app->pany = INT_MIN;
-					app->pageno--;
-					panto = DONT_PAN;
+					if (app->panx >= -app->imgw/20)
+					{
+						if (app->pageno - 1 > 0)
+						{
+							app->panx = INT_MIN;
+							app->pany = INT_MIN;
+							app->pageno--;
+							panto = DONT_PAN;
+						}
+					}
+					else
+					{
+						app->pany = -app->imgh;
+						app->panx += app->winw * 9 / 10;
+						pdfapp_showpage(app, 0, 0, 1, 0, 0);
+					}
+				}
+				else
+				{
+					app->pany += app->winh * 9 / 10;
+					pdfapp_showpage(app, 0, 0, 1, 0, 0);
 				}
 			}
-			else
-			{
-				app->pany = -app->imgh;
-				app->panx += app->winw * 9 / 10;
-				pdfapp_showpage(app, 0, 0, 1, 0, 0);
-			}
-		}
-		else
-		{
-			app->pany += app->winh * 9 / 10;
-			pdfapp_showpage(app, 0, 0, 1, 0, 0);
 		}
 		break;
 
 	case ' ':
-		if (app->imgh + app->pany <= app->winh + app->imgh/20)
 		{
-			if (app->imgw + app->panx <= app->winw + app->imgw/20)
+			int number = 1;
+			if (app->numberlen > 0)
+				number = fz_maxi(atoi(app->number), number);
+			while (number--)
 			{
-				if (app->pageno + 1 <= app->pagecount)
+				if (app->imgh + app->pany <= app->winh + app->imgh/20)
 				{
-					app->panx = 0;
-					app->pany = 0;
-					app->pageno++;
-					panto = DONT_PAN;
+					if (app->imgw + app->panx <= app->winw + app->imgw/20)
+					{
+						if (app->pageno + 1 <= app->pagecount)
+						{
+							app->panx = 0;
+							app->pany = 0;
+							app->pageno++;
+							panto = DONT_PAN;
+						}
+					}
+					else
+					{
+						app->pany = 0;
+						app->panx -= app->winw * 9 / 10;
+						pdfapp_showpage(app, 0, 0, 1, 0, 0);
+					}
+				}
+				else
+				{
+					app->pany -= app->winh * 9 / 10;
+					pdfapp_showpage(app, 0, 0, 1, 0, 0);
 				}
 			}
-			else
-			{
-				app->pany = 0;
-				app->panx -= app->winw * 9 / 10;
-				pdfapp_showpage(app, 0, 0, 1, 0, 0);
-			}
-		}
-		else
-		{
-			app->pany -= app->winh * 9 / 10;
-			pdfapp_showpage(app, 0, 0, 1, 0, 0);
 		}
 		break;
 

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=798fff06bde9c57ddd025c76de0940c3c0be020c

--
MuPDF library
Artifex Software, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.