--- pspresent-1.3.orig/pspresent.1 +++ pspresent-1.3/pspresent.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH PSPRESENT 1 "June 2, 2003" +.TH PSPRESENT 1 "January 24, 2005" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -46,6 +46,22 @@ .TP .BI "\-O " Portrait | Landscape | Upside-Down | Seascape Override orientation. +.TP +.B \-l +Loop mode; go to start of document when at end, and vice versa. +.TP +.BI "\-t"[delay] +Automatic slideshow mode. The +.I delay +is optional, the default value is 20 seconds. +.TP +.BI "\-T"file +Automatic slideshow mode. The +.I file +contains one integer value per line, corresponding to the delay +between the current slide and the next one. You must put a value for +each page of your document (count overlays, too). A value of 0 will +disable the timer for the current slide. .SH COMMANDS The following keys can be used from within .B pspresent --- pspresent-1.3.orig/pspresent.h +++ pspresent-1.3/pspresent.h @@ -26,6 +26,7 @@ struct pspage { char *data; + int delay; /* delay before going to next slide */ int is_last; /* Last in a series of overlays */ }; --- pspresent-1.3.orig/Makefile +++ pspresent-1.3/Makefile @@ -9,7 +9,7 @@ # Remove the following two lines to disable XINERAMA support XINERAMA_CFLAGS=-DHAVE_LIBXINERAMA -XINERAMA_LDLIBS=-lXext -lXinerama +XINERAMA_LDLIBS=-lXinerama CC = gcc CFLAGS = -Wall -O2 $(X11_CFLAGS) $(XINERAMA_CFLAGS) @@ -22,7 +22,7 @@ $(CC) -o $(TARGET) $(OBJS) $(LDLIBS) clean: - rm $(TARGET) $(OBJS) + rm -f $(TARGET) $(OBJS) .SUFFIXES: .SUFFIXES: .c .o --- pspresent-1.3.orig/pspresent.c +++ pspresent-1.3/pspresent.c @@ -18,7 +18,10 @@ */ #include "pspresent.h" +#include #include +#include +#include #include #include #include @@ -50,6 +53,9 @@ static int gs_page = 0; /* page being rendered by gs */ static int requested_page = 0; /* page that user wants displayed */ static int warp_page; +static Bool loop = False; /* loop when at end of document */ +static Bool timedshow = False; /* automatic/timed slideshow mode */ + static void UpdateWindow(void) { @@ -75,14 +81,32 @@ do { new_page += current_dir; if ((new_page >= num_pages) || (new_page < 0)) - return -1; + { + /* loop if in loop mode */ + if (!loop) + return -1; + + if (new_page >= num_pages) + new_page = 0; + else + new_page = num_pages - 1; + } } while (!pages[new_page].is_last); } else { new_page = current_page + current_dir; if ((new_page >= num_pages) || (new_page < 0)) - return -1; + { + /* loop if in loop mode */ + if (!loop) + return -1; + + if (new_page >= num_pages) + new_page = 0; + else + new_page = num_pages - 1; + } } return new_page; @@ -110,6 +134,10 @@ else { RenderPage(page); + + if (timedshow) + alarm(pages[page].delay); + return; } @@ -125,12 +153,19 @@ next_page = GetNextPage(); if (next_page != -1) RenderPage(next_page); + + if (timedshow) + alarm(pages[page].delay); } static void NextPage(int dir, Bool skip_overlays) { int next_page; + /* cancel alarm */ + if (timedshow) + alarm(0); + /* Assume user will keep going in that direction */ current_dir = dir; skip_overlays_mode = skip_overlays; @@ -138,6 +173,8 @@ next_page = GetNextPage(); if (next_page != -1) GotoPage(next_page); + + /* GotoPage() will set the alarm for the new page */ } static void WarpPage(int page) @@ -263,6 +300,7 @@ fd_set writeset; int x_fd = ConnectionNumber(display); int max_fd = (gs_fd > x_fd) ? gs_fd : x_fd; + int ret; FD_ZERO(&readset); FD_ZERO(&writeset); @@ -277,11 +315,19 @@ else FD_SET(gs_fd, &writeset); - if (select(max_fd+1, &readset, &writeset, NULL, NULL) == -1) - { - perror("select"); - return; - } + do { + if ((ret = select(max_fd+1, &readset, &writeset, NULL, NULL)) == -1) + { + if (errno != EINTR) + { + perror("select"); + return; + } + } + + if (ret != -1) + break; + } while (1); if (FD_ISSET(gs_fd, &writeset)) page_start = GSWrite(gs_fd, page_start, page_end); @@ -343,24 +389,72 @@ #endif " -O: Override orientation (Portrait|Landscape|Upside-Down|Seascape)\n" , program); + fprintf(stderr, " -l: Loop when at end of document\n"); + fprintf(stderr, " -t[delay]: automatic/timed slideshow mode (default: 20s)\n"); + fprintf(stderr, " -Tfile : same, file contains the delay for each slide or overlay\n"); + fprintf(stderr, " 1 value per line, 0 to disable the timer for the slide\n"); +} + +static void SetDelay(int delay) +{ + int i; + + for (i = 0; i < num_pages; i++) + pages[i].delay = delay; +} + +static int SetDelayFromFile(FILE *fp) +{ + char *buf; + size_t len = 16; + int i; + + buf = malloc(16); + + for (i = 0; i < num_pages; i++) + { + if (getline(&buf, &len, fp) < 0) + { + fprintf(stderr, "ERROR: not enough data in file ! You have %d pages.\n", num_pages); + return -1; + } + + pages[i].delay = atoi(buf); + } + + free(buf); + + return 0; } +void hdlalrm(int signum) +{ + if (signum != SIGALRM) + return; + + /* go to next page */ + NextPage(+1, skip_overlays_mode); +} + + int main(int argc, char *argv[]) { XSetWindowAttributes attribs; Bool override_redirect = True, force_orientation = False; - char *filename, *document; + char *filename, *wm_name, *document; int gs_fd, depth, c; int orientation, arg_orientation; int bounds[4]; size_t size; int x, y, head = -1; + int delay = 0; + FILE *fdelay = NULL; #ifdef HAVE_LIBXINERAMA XineramaScreenInfo *head_info; int heads; #endif - while ((c = getopt(argc, argv, "os:O:hv?")) != -1) + while ((c = getopt(argc, argv, "os:O:hvlt::T:?")) != -1) { switch (c) { @@ -378,6 +472,36 @@ } force_orientation = True; break; + case 'l': + loop = True; + break; + case 't': + timedshow = True; + if (optarg != NULL) + delay = atoi(optarg); + else + delay = 20; + + if (delay < 1) + { + fprintf(stderr, "ERROR: please use a non-zero delay.\n"); + return EXIT_FAILURE; + } + + signal(SIGALRM, hdlalrm); + break; + case 'T': + timedshow = True; + fdelay = fopen(optarg, "r"); + + if (fdelay == NULL) + { + fprintf(stderr, "ERROR: Cannot open %s: %s\n", optarg, strerror(errno)); + return EXIT_FAILURE; + } + + signal(SIGALRM, hdlalrm); + break; default: usage(argv[0]); return EXIT_FAILURE; @@ -405,6 +529,20 @@ return EXIT_FAILURE; } + if (timedshow) + { + if (fdelay != NULL) + { + if (SetDelayFromFile(fdelay) != 0) + return EXIT_FAILURE; + + fclose(fdelay); + } + /* Set to 20 by default in PSScanDocument() */ + else if (delay != 20) + SetDelay(delay); + } + if (force_orientation) orientation = arg_orientation; @@ -475,7 +613,17 @@ gc = XCreateGC(display, display_wnd, 0, NULL); HideDecorations(display_wnd); - XStoreName(display, display_wnd, filename); + + wm_name = malloc(strlen(filename) + 12); + if (wm_name == NULL) + { + fprintf(stderr, "ERROR: not enough memory\n"); + return EXIT_FAILURE; + } + strcpy(wm_name, "pspresent: "); + strcat(wm_name, filename); + XStoreName(display, display_wnd, wm_name); + XMapWindow(display, display_wnd); XSelectInput(display, display_wnd, KeyPressMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); --- pspresent-1.3.orig/ps.c +++ pspresent-1.3/ps.c @@ -161,6 +161,8 @@ } last_page = this_page; pages[page].data = line; + /* Set the delay to the default delay, even if not in timedshow mode */ + pages[page].delay = 20; pages[page].is_last = 0; if (++page == pages_size) { --- pspresent-1.3.orig/debian/watch +++ pspresent-1.3/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://www.cse.unsw.edu.au/~matthewc/pspresent/pspresent-([\d\.]+)\.tar\.gz --- pspresent-1.3.orig/debian/dirs +++ pspresent-1.3/debian/dirs @@ -0,0 +1 @@ +usr/bin --- pspresent-1.3.orig/debian/compat +++ pspresent-1.3/debian/compat @@ -0,0 +1 @@ +7 --- pspresent-1.3.orig/debian/copyright +++ pspresent-1.3/debian/copyright @@ -0,0 +1,30 @@ +This package was debianized by Jamie Wilkinson on +Tue, 11 Feb 2003 18:54:02 +1100. + +It was downloaded from http://www.cse.unsw.edu.au/~matthewc/pspresent/ + +Upstream Author: Matt Chapman + +Copyright: + + Copyright (C) Matthew Chapman 2001-2003 + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, + USA. + +On Debian systems, the full text of the GPL can be found in +/usr/share/common-licenses/GPL-2. --- pspresent-1.3.orig/debian/changelog +++ pspresent-1.3/debian/changelog @@ -0,0 +1,88 @@ +pspresent (1.3-4) unstable; urgency=low + + * Bug fix: "obsolete build-dep on x-dev", thanks to + jcristau@debian.org. (Closes: #515501) + * Bug fix: "depends on obsolete gs package", thanks to Julien BLACHE. + (Closes: #532066) + * Update debhelper compat to 7. + - Update build dependency to 7. + - Replace dh_clean -k with dh_prep. + * Update standards-version to 3.8.3. + * Fix copyright and path to GPLv2. + * Remove libXext from the linked libraries as its symbols are unused. + * Right injustices. (Closes: #543441) + + -- Jamie Wilkinson Sun, 01 Nov 2009 18:01:40 +1100 + +pspresent (1.3-3) unstable; urgency=low + + * Updated watch file to format version 3. + + -- Jamie Wilkinson Sun, 11 Nov 2007 18:27:20 +1100 + +pspresent (1.3-2) unstable; urgency=low + + * Update standards version. + * Make lintian clean. + * Bug fix: "pspresent: [PATCH] Automatic (timed) slideshow mode", thanks + to Julien BLACHE (Closes: #291982). + * Bug fix: "pspresent -o: please define a meaningful class and/or + resource", thanks to Vincent Lefevre (Closes: #303532). + + -- Jamie Wilkinson Sun, 11 Nov 2007 18:17:18 +1100 + +pspresent (1.3-1) unstable; urgency=low + + * New upstream release. (Closes: #358084) + * Acknowlegde NMU. Thanks Steinar. (Closes: #347020, 349179) + * Bumped standards version to 3.6.2 (no other changes required). + * Updated FSF address to appease lintian. + + -- Jamie Wilkinson Tue, 4 Apr 2006 09:31:42 +1000 + +pspresent (1.2-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Replace build-dependency on xlibs-dev with an explicit build-dependency + on each required package. (Closes: #347020) + + -- Steinar H. Gunderson Sat, 21 Jan 2006 14:01:14 +0100 + +pspresent (1.2-1) unstable; urgency=low + + * New upstream release. (Closes: #290436) + + -- Jamie Wilkinson Sun, 24 Apr 2005 01:17:32 +1000 + +pspresent (1.1-1) unstable; urgency=low + + * New upstream release. + * Bumped standards version. No package changes. + + -- Jamie Wilkinson Mon, 26 Jul 2004 22:48:14 +1000 + +pspresent (1.0-2) unstable; urgency=low + + * Fix duplicated manpage, thanks Ian (Closes: #204404) + * Updated to Standards Version 3.6.1.0. + + -- Jamie Wilkinson Wed, 27 Aug 2003 10:04:04 +1000 + +pspresent (1.0-1) unstable; urgency=low + + * New upstream release + - command line options to control orientation (Closes: #182508) + - ability to jump to a given slide (Closes: #182844) + - no longer pastes clipboard text when exiting with middle mouse + button (Closes: #182842) + * Manual page now included in upstream. + + -- Jamie Wilkinson Thu, 3 Jul 2003 19:03:24 +1000 + +pspresent (0.9-1) unstable; urgency=low + + * Initial Release. (Closes: #181049) + * Wrote manual page. + + -- Jamie Wilkinson Sat, 15 Feb 2003 11:34:29 +1100 + --- pspresent-1.3.orig/debian/rules +++ pspresent-1.3/debian/rules @@ -0,0 +1,82 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + $(MAKE) clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + install -m 755 pspresent $(CURDIR)/debian/pspresent/usr/bin + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit + dh_installcron + dh_installman pspresent.1 +# dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- pspresent-1.3.orig/debian/control +++ pspresent-1.3/debian/control @@ -0,0 +1,18 @@ +Source: pspresent +Section: x11 +Priority: optional +Maintainer: Jamie Wilkinson +Build-Depends: debhelper (>= 7), x11proto-core-dev, libxinerama-dev +Standards-Version: 3.8.3 + +Package: pspresent +Architecture: any +Depends: ${shlibs:Depends}, ghostscript-x +Suggests: chaksem | prosper | foiltex +Description: fullscreen PostScript presentation tool + pspresent is a tool that displays PostScript slides in fullscreen, for + giving presentations. Navigation is simple: spacebar goes forward one + slide, backspace takes you back one slide. The escape key quits. The + display itself is double-buffered giving seamless transitions between + slides. +