[Eyecatcher-general] Re: Debian "eyecatcher" Project

Christoph Berg cb@df7cb.de
Mon, 10 Jan 2005 03:35:30 +0100


--DozTQjXnjm3C9Xhk
Content-Type: multipart/mixed; boundary="Tu8ztk+XgTAiG9Id"
Content-Disposition: inline


--Tu8ztk+XgTAiG9Id
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Re: To eyecatcher-general@lists.alioth.debian.org in <20050109165750.GG2175=
@df7cb.de>
> while true ; do
>         for page in `seq 1 $PAGES` ; do
>                 xpdf -fullscreen -remote "$FILE" "$FILE" $page &
>                 sleep "$DELAY"
>         done
> done

23:58 <Tolimar> Myon: Ich h=E4tte nicht gedacht, dass das m=F6glich ist, ab=
er dein xpdf script ist ja noch h=E4sslicher als mein mgp script ;)
23:59 <Myon> lol
23:59 <Myon> Tolimar: wie ist denn der Stand? wird jetzt mgp genommen oder =
was?
23:59 <Myon> irgendwie war die "Diskussion" wenig =FCbersichtlich
Day changed to 10 Jan 2005
00:00 <Tolimar> Myon: Bevor du dein xpdf-loop geschickt hast, hab es keinen=
 Grund, etwas anderes zu nehmen als mgp.
00:01 <Tolimar> Da wir jetzt auch pdf-Dateie nehmen k=F6nnen, ist also wied=
er alles offen.
00:01 <Tolimar> Menno.
00:02 <youam> war das eine private mail?
00:02 <youam> tut so, als gaeb's das nicht :)
00:02 <Tolimar> Nein, aber da es nichts auf den ganzen anderen Listen zu su=
chen hat, war Myon schlau genug, es an die einzige Liste zu schicken,f=FCr =
die es relevant ist.
00:03 <youam> hoho
00:04 <Tolimar> Menno, das funktioniert ja sogar.
00:05 <Myon> nat=FCrlich hab ich das probiert ;)
00:05 <Ganneff> hehe
00:05 <Myon> man darf nur nicht erwarten, dass die Pr=E4sentation rum ist, =
wenn man 'q' dr=FCckt *g*
00:06 <Ganneff> macht xpdf keine exit-codes anders je nachdem wies beendet =
ist?
00:06 <Ganneff> wenn nicht: Myon wo is der patch? :)

This patch doesn't modify exit codes, but gives xpdf some new options:

  {"-reload",     argFlag,        &doRemoteReload, 0,
   "reload xpdf remove server window (with -remote only)"},
  {"-next",       argFlag,        &doRemoteNext,  0,
   "display next page in xpdf remote server window (with -remote only)"},
  {"-prev",       argFlag,        &doRemotePrev,  0,
   "display previous page in xpdf remote server window (with -remote only)"=
},
  {"-slidedelay", argInt,         &slidedelay,    0,
   "delay in second for slideshow in -fullscreen mode"},

The full source (original & patched) is at
http://www.df7cb.de/debian/xpdf/

Happy presenting :)

Christoph
--=20
cb@df7cb.de | http://www.df7cb.de/

--Tu8ztk+XgTAiG9Id
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xpdf_3.00-11.1.slideshow.patch"
Content-Transfer-Encoding: quoted-printable

diff -u xpdf-3.00/splash/Makefile xpdf-3.00/splash/Makefile
--- xpdf-3.00/splash/Makefile
+++ xpdf-3.00/splash/Makefile
@@ -16,7 +16,7 @@
 FOFISRCDIR =3D $(srcdir)/../fofi
 FOFILIBDIR =3D ../fofi
=20
-CXXFLAGS =3D -g -O2 -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I=
$(srcdir) -I/usr/include -I/usr/include/freetype2 =20
+CXXFLAGS =3D -g -O2 -DHAVE_CONFIG_H -I.. -I$(GOOSRCDIR) -I$(FOFISRCDIR) -I=
$(srcdir)  -I/usr/include/freetype2 =20
=20
 CXX =3D g++
 AR =3D ar rc
diff -u xpdf-3.00/xpdf/XPDFCore.cc xpdf-3.00/xpdf/XPDFCore.cc
--- xpdf-3.00/xpdf/XPDFCore.cc
+++ xpdf-3.00/xpdf/XPDFCore.cc
@@ -103,6 +103,7 @@
=20
 XPDFCore::XPDFCore(Widget shellA, Widget parentWidgetA,
 		   SplashRGB8 paperColorA, GBool fullScreenA,
+		   GBool loopA, int slideDelayA,
 		   GBool reverseVideo, GBool installCmap, int rgbCubeSize) {
   GString *initialZoom;
   SplashColor paperColor2;
@@ -116,6 +117,8 @@
=20
   paperColor =3D paperColorA;
   fullScreen =3D fullScreenA;
+  loop =3D loopA;
+  slideDelay =3D slideDelayA;
=20
   // for some reason, querying XmNvisual doesn't work (even if done
   // after the window is mapped)
@@ -615,9 +618,9 @@
   if (!doc || doc->getNumPages() =3D=3D 0) {
     return;
   }
-  if (page < doc->getNumPages()) {
+  if (page < doc->getNumPages() || loop) {
     if ((pg =3D page + inc) > doc->getNumPages()) {
-      pg =3D doc->getNumPages();
+      pg =3D loop ? 1 : doc->getNumPages();
     }
     displayPage(pg, zoom, rotate, top, gTrue);
   } else {
@@ -631,7 +634,7 @@
   if (!doc || doc->getNumPages() =3D=3D 0) {
     return;
   }
-  if (page > 1) {
+  if (page > 1 || loop) {
     if (!fullScreen && bottom) {
       scrollY =3D out->getBitmapHeight() - drawAreaHeight;
       if (scrollY < 0) {
@@ -640,7 +643,7 @@
       // displayPage will call updateScrollBars()
     }
     if ((pg =3D page - dec) < 1) {
-      pg =3D 1;
+      pg =3D loop ? doc->getNumPages() : 1;
     }
     displayPage(pg, zoom, rotate, top, gTrue);
   } else {
diff -u xpdf-3.00/xpdf/XPDFViewer.cc xpdf-3.00/xpdf/XPDFViewer.cc
--- xpdf-3.00/xpdf/XPDFViewer.cc
+++ xpdf-3.00/xpdf/XPDFViewer.cc
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <signal.h>
 #include <X11/cursorfont.h>
 #ifdef HAVE_X11_XPM_H
 #include <X11/xpm.h>
@@ -110,6 +111,17 @@
=20
 //------------------------------------------------------------------------
=20
+static XPDFViewer *alarm_viewer =3D NULL;
+static int alarm_slideDelay =3D 0;
+
+void alarm_hander(int sig) {
+  if(alarm_viewer)
+    alarm_viewer->next();
+  alarm(alarm_slideDelay);
+}
+
+//------------------------------------------------------------------------
+
 XPDFViewer::XPDFViewer(XPDFApp *appA, GString *fileName,
 		       int pageA, GString *destName,
 		       GString *ownerPassword, GString *userPassword) {
@@ -176,6 +188,13 @@
     displayPage(pg, z, core->getRotate(), gTrue, gTrue);
   }
=20
+  if(app->getSlideDelay()) {
+    alarm_viewer =3D this;
+    alarm_slideDelay =3D app->getSlideDelay();
+    signal(SIGALRM, alarm_hander);
+    alarm(app->getSlideDelay());
+  }
+
   ok =3D gTrue;
 }
=20
@@ -267,6 +286,20 @@
   displayPage(pg, core->getZoom(), core->getRotate(), gFalse, gFalse);
 }
=20
+void XPDFViewer::next() { /* callback for -remove -next */
+  if (!core->getDoc()) {
+    return;
+  }
+  core->gotoNextPage(1, gTrue);
+}
+
+void XPDFViewer::prev() { /* callback for -remove -prev */
+  if (!core->getDoc()) {
+    return;
+  }
+  core->gotoPrevPage(1, gTrue, gFalse);
+}
+
 void XPDFViewer::displayPage(int pageA, double zoomA, int rotateA,
 			     GBool scrollToTop, GBool addToHist) {
   core->displayPage(pageA, zoomA, rotateA, scrollToTop, addToHist);
@@ -813,7 +846,8 @@
=20
     // core
     core =3D new XPDFCore(win, form, app->getPaperRGB(),
-			app->getFullScreen(), app->getReverseVideo(),
+			app->getFullScreen(), app->getLoop(), app->getSlideDelay(),
+			app->getReverseVideo(),
 			app->getInstallCmap(), app->getRGBCubeSize());
     core->setUpdateCbk(&updateCbk, this);
     core->setActionCbk(&actionCbk, this);
@@ -871,7 +905,8 @@
=20
     // core
     core =3D new XPDFCore(win, panedWin, app->getPaperRGB(),
-			app->getFullScreen(), app->getReverseVideo(),
+			app->getFullScreen(), app->getLoop(), app->getSlideDelay(),
+			app->getReverseVideo(),
 			app->getInstallCmap(), app->getRGBCubeSize());
     core->setUpdateCbk(&updateCbk, this);
     core->setActionCbk(&actionCbk, this);
diff -u xpdf-3.00/debian/changelog xpdf-3.00/debian/changelog
--- xpdf-3.00/debian/changelog
+++ xpdf-3.00/debian/changelog
@@ -1,3 +1,9 @@
+xpdf (3.00-11.1) unstable; urgency=3Dlow
+
+  * Patch for -slidedelay, -loop, -prev, and -next options.
+
+ -- Christoph Berg <cb@df7cb.de>  Mon, 10 Jan 2005 03:22:00 +0100
+
 xpdf (3.00-11) unstable; urgency=3Dhigh
=20
   * SECURITY UPDATE: fix potential buffer overflow
only in patch2:
unchanged:
--- xpdf-3.00.orig/xpdf/XPDFApp.cc
+++ xpdf-3.00/xpdf/XPDFApp.cc
@@ -331,6 +331,18 @@
   XFlush(display);
 }
=20
+void XPDFApp::remoteNext() {
+  XChangeProperty(display, remoteXWin, remoteAtom, remoteAtom, 8,
+		  PropModeReplace, (Guchar *)"n", 2);
+  XFlush(display);
+}
+
+void XPDFApp::remotePrev() {
+  XChangeProperty(display, remoteXWin, remoteAtom, remoteAtom, 8,
+		  PropModeReplace, (Guchar *)"p", 2);
+  XFlush(display);
+}
+
 void XPDFApp::remoteQuit() {
   XChangeProperty(display, remoteXWin, remoteAtom, remoteAtom, 8,
 		  PropModeReplace, (Guchar *)"q", 2);
@@ -395,6 +407,14 @@
   } else if (cmd[0] =3D=3D 'l' || cmd[0] =3D=3D 'L') {
     app->remoteViewer->reloadFile();
=20
+  // next
+  } else if (cmd[0] =3D=3D 'n') {
+    app->remoteViewer->next();
+
+  // prev
+  } else if (cmd[0] =3D=3D 'p') {
+    app->remoteViewer->prev();
+
   // quit
   } else if (cmd[0] =3D=3D 'q') {
     app->quit();
only in patch2:
unchanged:
--- xpdf-3.00.orig/xpdf/XPDFApp.h
+++ xpdf-3.00/xpdf/XPDFApp.h
@@ -57,6 +57,8 @@
   void remoteOpenAtDest(GString *fileName, GString *dest, GBool raise);
   void remoteReload(GBool raise);
   void remoteRaise();
+  void remoteNext();
+  void remotePrev();
   void remoteQuit();
=20
   //----- resource/option values
@@ -71,6 +73,10 @@
   GBool getViKeys() { return viKeys; }
   void setFullScreen(GBool fullScreenA) { fullScreen =3D fullScreenA; }
   GBool getFullScreen() { return fullScreen; }
+  void setSlideDelay(int slideDelayA) { slideDelay =3D slideDelayA; }
+  GBool getSlideDelay() { return slideDelay; }
+  void setLoop(GBool loopA) { loop =3D loopA; }
+  GBool getLoop() { return loop; }
=20
   XtAppContext getAppContext() { return appContext; }
   Widget getAppShell() { return appShell; }
@@ -103,6 +109,8 @@
   GString *initialZoom;
   GBool viKeys;
   GBool fullScreen;
+  int slideDelay;
+  GBool loop;
 };
=20
 #endif
only in patch2:
unchanged:
--- xpdf-3.00.orig/xpdf/XPDFCore.h
+++ xpdf-3.00/xpdf/XPDFCore.h
@@ -88,6 +88,7 @@
   // Create viewer core inside <parentWidgetA>.
   XPDFCore(Widget shellA, Widget parentWidgetA,
 	   SplashRGB8 paperColorA, GBool fullScreenA,
+	   GBool loopA, int slideDelayA,
 	   GBool reverseVideo, GBool installCmap, int rgbCubeSize);
=20
   ~XPDFCore();
@@ -231,6 +232,8 @@
=20
   SplashRGB8 paperColor;
   GBool fullScreen;
+  GBool loop;
+  int slideDelay;
=20
   Display *display;
   int screenNum;
only in patch2:
unchanged:
--- xpdf-3.00.orig/xpdf/XPDFViewer.h
+++ xpdf-3.00/xpdf/XPDFViewer.h
@@ -58,6 +58,8 @@
   void open(GString *fileName, int pageA, GString *destName);
   void clear();
   void reloadFile();
+  void next();
+  void prev();
=20
   Widget getWindow() { return win; }
=20
only in patch2:
unchanged:
--- xpdf-3.00.orig/xpdf/xpdf.cc
+++ xpdf-3.00/xpdf/xpdf.cc
@@ -36,8 +36,12 @@
 static GBool fullScreen =3D gFalse;
 static char remoteName[100] =3D "xpdf_";
 static GBool doRemoteReload =3D gFalse;
+static GBool doRemoteNext =3D gFalse;
+static GBool doRemotePrev =3D gFalse;
 static GBool doRemoteRaise =3D gFalse;
 static GBool doRemoteQuit =3D gFalse;
+static GBool loop =3D gFalse;
+static int slidedelay =3D 0;
 static GBool printCommands =3D gFalse;
 static GBool quiet =3D gFalse;
 static char cfgFileName[256] =3D "";
@@ -95,10 +99,18 @@
    "start/contact xpdf remote server with specified name"},
   {"-reload",     argFlag,        &doRemoteReload, 0,
    "reload xpdf remove server window (with -remote only)"},
+  {"-next",       argFlag,        &doRemoteNext,  0,
+   "display next page in xpdf remote server window (with -remote only)"},
+  {"-prev",       argFlag,        &doRemotePrev,  0,
+   "display previous page in xpdf remote server window (with -remote only)=
"},
   {"-raise",      argFlag,        &doRemoteRaise, 0,
    "raise xpdf remote server window (with -remote only)"},
   {"-quit",       argFlag,        &doRemoteQuit,  0,
    "kill xpdf remote server (with -remote only)"},
+  {"-loop",       argFlag,        &loop,          0,
+   "delay in second for slideshow in -fullscreen mode"},
+  {"-slidedelay", argInt,         &slidedelay,    0,
+   "delay in second for slideshow in -fullscreen mode"},
   {"-cmd",        argFlag,        &printCommands, 0,
    "print commands as they're executed"},
   {"-q",          argFlag,        &quiet,         0,
@@ -209,6 +221,12 @@
   if (doRemoteReload) {
     ok =3D ok && remoteName[5] && !doRemoteQuit && argc =3D=3D 1;
   }
+  if (doRemoteNext) {
+    ok =3D ok && remoteName[5] && !doRemoteQuit && !doRemotePrev;
+  }
+  if (doRemotePrev) {
+    ok =3D ok && remoteName[5] && !doRemoteQuit && !doRemoteNext;
+  }
   if (doRemoteRaise) {
     ok =3D ok && remoteName[5] && !doRemoteQuit;
   }
@@ -251,6 +269,10 @@
 	}
       } else if (doRemoteReload) {
 	app->remoteReload(doRemoteRaise);
+      } else if (doRemoteNext) {
+	app->remoteNext();
+      } else if (doRemotePrev) {
+	app->remotePrev();
       } else if (doRemoteRaise) {
 	app->remoteRaise();
       } else if (doRemoteQuit) {
@@ -265,6 +287,8 @@
=20
   // set options
   app->setFullScreen(fullScreen);
+  app->setLoop(loop);
+  app->setSlideDelay(slidedelay);
=20
   // check for password string(s)
   ownerPasswordStr =3D ownerPassword[0] !=3D '\001' ? new GString(ownerPas=
sword)

--Tu8ztk+XgTAiG9Id--

--DozTQjXnjm3C9Xhk
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iQCVAwUBQeHp8bRrkjttir5xAQFsdwP/VMvgoMWixdh2/TUUyb+c3Q1fJNU8WGm8
B5RdLDW8h8vIwtq9ml13H+Uh+3a+TPOMR14CSgDRUmJSIbFzsrRSAR7Y8XCAMWss
PitUKxulTrYwpoU2W7dBC2Z50KdVB2OmTuBr2Uav5DZkBjKSMuVSKhbQDp8l2HKF
dGi5GVgZTDU=
=2xvC
-----END PGP SIGNATURE-----

--DozTQjXnjm3C9Xhk--