summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-10-08 23:26:35 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-10-08 23:26:35 -0700
commit71365724dd22b932bea4af3fb6bcc3ff53eb1910 (patch)
tree3eca670e861a86ddd6c1ab36ac47bb63e5f30778
parent6ddcbb17b46452ee6e8d7cd541d89edf1687147b (diff)
Remove Xprint support.
Double buffered printing? Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--xdbedizzy.c277
-rw-r--r--xdbedizzy.man39
-rw-r--r--xdbedizzy.sgml100
3 files changed, 10 insertions, 406 deletions
diff --git a/xdbedizzy.c b/xdbedizzy.c
index 93766dd..aadcf82 100644
--- a/xdbedizzy.c
+++ b/xdbedizzy.c
@@ -33,7 +33,6 @@
* Original dizzy program written by Mark Kilgard.
*
* Adapted to use DBE for double buffering by Allen Leinwand, 2/24/1995 .
- * Print support added by Roland Mainz, 10/18/2004
*
*/
@@ -44,9 +43,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xdbe.h>
-#ifdef USE_XPRINT
-#include <X11/XprintUtil/xprintutil.h>
-#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -65,9 +61,6 @@ static char *ProgramName = NULL;
static Display *dpy = NULL;
static Screen *screen = NULL;
static int screennum = -1;
-#ifdef USE_XPRINT
-static XPContext pcontext = None; /* Xprint context */
-#endif
static XRectangle winrect = { 0 };
static unsigned long c_black, c_pink, c_green, c_orange, c_blue;
static Window win = None;
@@ -79,15 +72,6 @@ static float delta = 0.05;
static float speed = 20.0;
static Bool paused = False;
static Bool manual_paused = False;
-#ifdef USE_XPRINT
-static int xp_event_base, /* XpExtension even base */
- xp_error_base; /* XpExtension error base */
-static long dpi_x = 0L, /* Current page resolution */
- dpi_y = 0L;
-static int numPages = 5, /* Numer of pages to print */
- currNumPages = 0; /* Current page number */
-static Bool doPrint = False; /* Print to printer ? */
-#endif
/* Default values for unspecified command line arguments */
static char *display_name = NULL;
@@ -103,12 +87,6 @@ static VisualID visid = 0;
static const char *help_message[] = {
" where options include:",
" -display host:dpy X server connection to use.",
-#ifdef USE_XPRINT
-" -print Use printer instead of video card for output.",
-" -printer printername Name of printer to use.",
-" -printfile printername Output file for print job.",
-" -numpages count Number of pages to print.",
-#endif
" -delta dlt Rotate <dlt> per frame (video) or page (printer).",
" -class classname Class of visual to use.",
" -depth n Depth of visual to use.",
@@ -318,11 +296,7 @@ void main_loop(void)
/* When we print we only render on Expose events and bump
* |rotation| when the page number changes */
- if (!paused && !manual_paused
-#ifdef USE_XPRINT
- && !doPrint
-#endif
- ) {
+ if (!paused && !manual_paused) {
pending = XEventsQueued(dpy, QueuedAfterFlush);
if (pending == 0) {
do {
@@ -345,60 +319,7 @@ void main_loop(void)
XNextEvent(dpy, &event);
-#ifdef USE_XPRINT
- /* XpExtension event ? */
- if( doPrint &&
- (event.type == xp_event_base+XPPrintNotify) )
- {
- XPPrintEvent *pev = (XPPrintEvent *)&event;
-
- switch( pev->detail ) {
- case XPStartJobNotify:
- Log(("XPStartJobNotify: Starting first page...\n"));
- XpStartPage(dpy, win);
- break;
- case XPEndJobNotify:
- Log(("XPEndJobNotify: Job done..."));
- /* Job done... */
- done = True;
- break;
- case XPStartDocNotify:
- Log(("XPStartJobNotify: Nop\n"));
- break;
- case XPEndDocNotify:
- Log(("XPEndDocNotify: Nop\n"));
- break;
- case XPStartPageNotify:
- /* XpStartPage() will automatically trigger an Expose event */
-
- Log(("XPStartPageNotify: Page end reached.\n"));
- XpEndPage(dpy);
- break;
- case XPEndPageNotify:
- /* next page or exit */
- currNumPages++;
-
- rotation = rotation + delta;
-
- if( currNumPages < numPages ) {
- Log(("Starting next page (%d)...\n", currNumPages));
- XpStartPage(dpy, win);
- }
- else
- {
- Log(("XPEndPageNotify: Finishing job...\n"));
- XpEndJob(dpy);
- }
- break;
- default:
- Log(("--> other XPPrintEvent event, detail=%x\n", (int)pev->detail));
- break;
- }
- }
- else
-#endif
- {
- switch (event.type) {
+ switch (event.type) {
case MapNotify:
Log(("MapNotify: resuming...\n"));
paused = False;
@@ -426,14 +347,8 @@ void main_loop(void)
case Expose:
Log(("Expose: rendering.\n"));
- /* Swallow any extra Expose events (only needed for video
- * display, the Xprint server is non-interactive and
- * therefore cannot create extra Expose events caused
- * by user input) */
-#ifdef USE_XPRINT
- if (!doPrint)
-#endif
- while (XCheckTypedEvent(dpy, Expose, &event))
+ /* Swallow any extra Expose events */
+ while (XCheckTypedEvent(dpy, Expose, &event))
;
redraw();
@@ -467,7 +382,6 @@ void main_loop(void)
winrect.width = event.xconfigure.width;
winrect.height = event.xconfigure.height;
break;
- }
}
}
}
@@ -480,14 +394,6 @@ int main(int argc, char *argv[])
Visual *visual;
Colormap cmap;
XGCValues gcvals;
-#ifdef USE_XPRINT
- void *printtofile_handle = NULL; /* "context" when printing to file */
- const char *printername = NULL; /* printer to query */
- const char *toFile = NULL; /* output file (instead of printer) */
- XPPrinterList plist = NULL; /* list of printers */
- int plist_count; /* number of entries in |plist|-array */
- unsigned short dummy;
-#endif
Bool use_threadsafe_api = True;
ProgramName = argv[0];
@@ -503,32 +409,6 @@ int main(int argc, char *argv[])
}
display_name = argv[i];
}
-#ifdef USE_XPRINT
- else if (!strcmp(arg, "-print")) {
- doPrint = True;
- }
- else if (!strcmp(arg, "-printer")) {
- if (++i >= argc)
- usage();
- printername = argv[i];
- doPrint = True;
- }
- else if (!strcmp(arg, "-printfile")) {
- if (++i >= argc)
- usage();
- toFile = argv[i];
- doPrint = True;
- }
- else if (!strcmp(arg, "-numpages")) {
- if (++i >= argc)
- usage();
- errno = 0; /* reset errno to catch |atoi()|-errors */
- numPages = atoi(argv[i]);
- if ((numPages <= 0) || (errno != 0))
- usage();
- doPrint = True;
- }
-#endif
else if (!strcmp(arg, "-delta")) {
if (++i >= argc)
usage();
@@ -613,13 +493,6 @@ int main(int argc, char *argv[])
}
}
-#ifdef USE_XPRINT
- /* Display and printing at the same time not implemented */
- if (doPrint && display_name) {
- usage();
- }
-#endif
-
if (use_threadsafe_api) {
if (!XInitThreads()) {
fprintf(stderr, "%s: XInitThreads() failure.\n", ProgramName);
@@ -627,86 +500,6 @@ int main(int argc, char *argv[])
}
}
-#ifdef USE_XPRINT
- if (doPrint) {
- plist = XpuGetPrinterList(printername, &plist_count);
-
- if (!plist) {
- fprintf(stderr, "%s: no printers found for printer spec \"%s\".\n",
- ProgramName, NULLSTR(printername));
- return EXIT_FAILURE;
- }
-
- printername = plist[0].name;
-
- Log(("Using printer '%s'\n", printername));
-
- if (XpuGetPrinter(printername, &dpy, &pcontext) != 1) {
- fprintf(stderr, "%s: Cannot open printer '%s'\n", ProgramName, printername);
- return EXIT_FAILURE;
- }
-
- if (synchronous) {
- Log(("Running in synchronous X mode.\n"));
- XSynchronize(dpy, True);
- }
-
- if (XpQueryExtension(dpy, &xp_event_base, &xp_error_base) == False) {
- fprintf(stderr, "%s: XpQueryExtension() failed.\n", ProgramName);
- XpuClosePrinterDisplay(dpy, pcontext);
- return EXIT_FAILURE;
- }
-
- /* Listen to XP(Start|End)(Job|Doc|Page)Notify events).
- * This is mandatory as Xp(Start|End)(Job|Doc|Page) functions are _not_
- * syncronous !!
- * Not waiting for such events may cause that subsequent data may be
- * destroyed/corrupted!!
- */
- XpSelectInput(dpy, pcontext, XPPrintMask);
-
- /* Set job title */
- XpuSetJobTitle(dpy, pcontext, "xdbedizzy for Xprint");
-
- /* Set print context
- * Note that this modifies the available fonts, including builtin printer prints.
- * All XListFonts()/XLoadFont() stuff should be done _after_ setting the print
- * context to obtain the proper fonts.
- */
- XpSetContext(dpy, pcontext);
-
- /* Get default printer reolution */
- if (XpuGetResolution(dpy, pcontext, &dpi_x, &dpi_y) != 1) {
- fprintf(stderr, "%s: No default resolution for printer '%s'.\n",
- ProgramName, printername);
- XpuClosePrinterDisplay(dpy, pcontext);
- return EXIT_FAILURE;
- }
-
- if (toFile) {
- Log(("starting job (to file '%s').\n", toFile));
- printtofile_handle = XpuStartJobToFile(dpy, pcontext, toFile);
- if( !printtofile_handle ) {
- fprintf(stderr, "%s: Error: %s while trying to print to file.\n",
- ProgramName, strerror(errno));
- XpuClosePrinterDisplay(dpy, pcontext);
- return EXIT_FAILURE;
- }
- }
- else
- {
- Log(("starting job.\n"));
- XpuStartJobToSpooler(dpy);
- }
-
- screen = XpGetScreenOfContext(dpy, pcontext);
- screennum = XScreenNumberOfScreen(screen);
-
- /* Obtain some info about page geometry */
- XpGetPageDimensions(dpy, pcontext, &dummy, &dummy, &winrect);
- }
- else
-#endif
{
dpy = XOpenDisplay(display_name);
if (dpy == NULL) {
@@ -722,18 +515,11 @@ int main(int argc, char *argv[])
screen = XDefaultScreenOfDisplay(dpy);
screennum = XScreenNumberOfScreen(screen);
-#ifdef USE_XPRINT
- pcontext = None;
-#endif
winrect.x = 10;
winrect.y = 10;
winrect.width = 400;
winrect.height = 400;
-
-#ifdef USE_XPRINT
- dpi_x = dpi_y = 100L; /* hack-style - but enougth for our needs */
-#endif
}
if (do_db) {
@@ -798,11 +584,7 @@ int main(int argc, char *argv[])
/* Create GCs, one per color (to avoid pipeline flushing
* when the GC is changed) */
-#ifdef USE_XPRINT
- gcvals.line_width = (8L * ((dpi_x+dpi_y)/2L)) / 100L; /* scale line with DPI */
-#else
gcvals.line_width = 8L;
-#endif
gcvals.cap_style = CapRound;
#define CREATECOLORGC(cl) (gcvals.foreground = (cl), \
@@ -818,55 +600,8 @@ int main(int argc, char *argv[])
main_loop();
-#ifdef USE_XPRINT
- if (doPrint) {
- char *scr;
-
- /* End the print job - the final results are sent by the X print
- * server to the spooler sub system.
- */
- Log(("finishing print job.\n"));
-
- /* Job completed, check if there are any messages from the spooler command */
- scr = XpGetOneAttribute(dpy, pcontext, XPJobAttr, "xp-spooler-command-results");
- if( scr )
- {
- if( strlen(scr) > 0 )
- {
- const char *msg = XpuCompoundTextToXmb(dpy, scr);
- if( msg )
- {
- Msg(("Spooler command returned:\n%s", msg));
- XpuFreeXmbString(msg);
- }
- else
- {
- Msg(("Spooler command returned (unconverted):\n%s", scr));
- }
- }
-
- XFree((void *)scr);
- }
-
- if (toFile) {
- if (XpuWaitForPrintFileChild(printtofile_handle) != XPGetDocFinished) {
- fprintf(stderr, "%s: Error while printing to file.\n", ProgramName);
- XpuClosePrinterDisplay(dpy, pcontext);
- return EXIT_FAILURE;
- }
- }
-
- XDestroyWindow(dpy, win);
- XpuClosePrinterDisplay(dpy, pcontext);
-
- XpuFreePrinterList(plist);
- }
- else
-#endif
- {
- XDestroyWindow(dpy, win);
- XCloseDisplay(dpy);
- }
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
Log(("Done."));
diff --git a/xdbedizzy.man b/xdbedizzy.man
index 7303fa7..3a1d5ae 100644
--- a/xdbedizzy.man
+++ b/xdbedizzy.man
@@ -1,5 +1,5 @@
.\" -*- coding: us-ascii -*-
-.TH xdbedizzy __appmansuffix__ "20 October 2004"
+.TH xdbedizzy __appmansuffix__ __xorgversion__
.SH NAME
xdbedizzy \- demo of DBE creating a double buffered spinning scene
.SH SYNOPSIS
@@ -10,14 +10,6 @@ xdbedizzy \- demo of DBE creating a double buffered spinning scene
[\fB\-display \fBhost:dpy\fR\fR] [\fB\-delta \fBdlt\fR\fR] [\fB\-class \fBvisclass\fR\fR] [\fB\-depth \fBvisdepth\fR\fR] [\fB\-visid \fBvisualid\fR\fR] [\fB\-list\fR] [\fB\-nodb\fR] [\fB\-help\fR] [\fB\-speed \fBnumber\fR\fR] [\fB\-sync\fR] [\fB\-spokes \fBn\fR\fR] [\fB\-verbose\fR]
'in \n(.iu-\nxu
.ad b
-.PP
-.ad l
-\fBxdbedizzy\fR \kx
-.if (\nxu > (\n(.lu / 2)) .nr x (\n(.lu / 5)
-'in \n(.iu+\nxu
-[\fB\-print\fR] [\fB\-printer \fBprintername\fR\fR] [\fB\-printfile \fBfile\fR\fR] [\fB\-delta \fBdlt\fR\fR] [\fB\-class \fBvisclass\fR\fR] [\fB\-depth \fBvisdepth\fR\fR] [\fB\-visid \fBvisualid\fR\fR] [\fB\-list\fR] [\fB\-nodb\fR] [\fB\-help\fR] [\fB\-sync\fR] [\fB\-spokes \fBn\fR\fR] [\fB\-verbose\fR]
-'in \n(.iu-\nxu
-.ad b
.SH DESCRIPTION
xdbedizzy is a demo of DBE creating a double
buffered spinning scene.
@@ -26,25 +18,6 @@ buffered spinning scene.
\fB\-display \fIhost:dpy\fB\fR
This option specifies the X server to contact.
.TP
-\fB\-print\fR
-Switches to printer output (default is video output).
-If no other printer arguments are given the default printer
-is being used.
-.TP
-\fB\-printer \fIprintername\fB\fR
-This option specifies the Xprint printer to contact.
-.TP
-\fB\-printfile \fIfilename\fB\fR
-Redirects the PDL (Printer Desktoption Language, usually
-Postscript, PDF, PCL, etc.) stream to the specified file.
-.TP
-\fB\-numpages \fIcount\fB\fR
-Number of pages to print. Default is 5.
-.TP
-\fB\-delta \fIdlt\fB\fR
-Delta value used to rotate the scene for each frame (video output)
-or page (printer output).
-.TP
\fB\-class \fIvisclass\fB\fR
Name of visual to choose. Valid values are
TrueColor, DirectColor, PseudoColor, StaticColor, Grayscale, StaticGray
@@ -68,7 +41,7 @@ Prints usage and exists.
.TP
\fB\-speed \fIvalue\fB\fR
Defines the time to delay between frames as delay=2sec/speed.
-Default value is 20. This option is ignored in print mode.
+Default value is 20.
.TP
\fB\-sync\fR
Use synchronous X connection.
@@ -79,17 +52,11 @@ Specify number of spokes to draw. The default value is 12.
\fB\-verbose\fR
Print verbose output.
.SH "SEE ALSO"
-\fBDBE\fR(__libmansuffix__), \fBXdbeSwapBuffers\fR(__libmansuffix__), \fBXdbeGetVisualInfo\fR(__libmansuffix__), \fBXdbeAllocateBackBufferName\fR(__libmansuffix__), \fBX\fR(__miscmansuffix__), \fBXprint\fR(__miscmansuffix__), \fBXserver\fR(__appmansuffix__)
+\fBDBE\fR(__libmansuffix__), \fBXdbeSwapBuffers\fR(__libmansuffix__), \fBXdbeGetVisualInfo\fR(__libmansuffix__), \fBXdbeAllocateBackBufferName\fR(__libmansuffix__), \fBX\fR(__miscmansuffix__), \fBXserver\fR(__appmansuffix__)
.SH ENVIRONMENT
.TP
\fBDISPLAY\fR
\fBDISPLAY\fR must be set to get the default host and display to use.
-.TP
-\fBXPSERVERLIST\fR
-\fBXPSERVERLIST\fR must be set for the \fB\-printer\fR option
-identifying the available Xprint servers.
-See \fBXprint\fR(__miscmansuffix__)
-for more details.
.SH AUTHOR
Mark Kilgard
diff --git a/xdbedizzy.sgml b/xdbedizzy.sgml
index 587aadc..98a5363 100644
--- a/xdbedizzy.sgml
+++ b/xdbedizzy.sgml
@@ -54,37 +54,6 @@ manual volume numbers.
</cmdsynopsis>
- <!-- printer mode -->
- <cmdsynopsis>
- <command>xdbedizzy</command>
-
- <arg><option>-print</option></arg>
-
- <arg><option>-printer <replaceable>printername</replaceable></option></arg>
-
- <arg><option>-printfile <replaceable>file</replaceable></option></arg>
-
- <arg><option>-delta <replaceable>dlt</replaceable></option></arg>
-
- <arg><option>-class <replaceable>visclass</replaceable></option></arg>
-
- <arg><option>-depth <replaceable>visdepth</replaceable></option></arg>
-
- <arg><option>-visid <replaceable>visualid</replaceable></option></arg>
-
- <arg><option>-list</option></arg>
-
- <arg><option>-nodb</option></arg>
-
- <arg><option>-help</option></arg>
-
- <arg><option>-sync</option></arg>
-
- <arg><option>-spokes <replaceable>n</replaceable></option></arg>
-
- <arg><option>-verbose</option></arg>
-
- </cmdsynopsis>
</refsynopsisdiv>
<refsect1>
@@ -111,60 +80,6 @@ manual volume numbers.
</varlistentry>
<varlistentry>
- <term><option>-print</option>
- </term>
- <listitem>
- <para>
- Switches to printer output (default is video output).
- If no other printer arguments are given the default printer
- is being used.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-printer <replaceable>printername</replaceable></option>
- </term>
- <listitem>
- <para>
- This option specifies the Xprint printer to contact.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-printfile <replaceable>filename</replaceable></option>
- </term>
- <listitem>
- <para>
- Redirects the PDL (Printer Desktoption Language, usually
- Postscript, PDF, PCL, etc.) stream to the specified file.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-numpages <replaceable>count</replaceable></option>
- </term>
- <listitem>
- <para>
- Number of pages to print. Default is 5.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-delta <replaceable>dlt</replaceable></option>
- </term>
- <listitem>
- <para>
- Delta value used to rotate the scene for each frame (video output)
- or page (printer output).
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>-class <replaceable>visclass</replaceable></option>
</term>
<listitem>
@@ -240,7 +155,7 @@ manual volume numbers.
<listitem>
<para>
Defines the time to delay between frames as delay=2sec/speed.
- Default value is 20. This option is ignored in print mode.
+ Default value is 20.
</para>
</listitem>
</varlistentry>
@@ -286,7 +201,6 @@ manual volume numbers.
<member><citerefentry><refentrytitle>XdbeGetVisualInfo</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>XdbeAllocateBackBufferName</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>X</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
- <member><citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member>
<member><citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member>
</simplelist>
</para>
@@ -304,18 +218,6 @@ manual volume numbers.
</para>
</listitem>
</varlistentry>
-
- <varlistentry>
- <term><envar>XPSERVERLIST</envar>
- </term>
- <listitem>
- <para><envar>XPSERVERLIST</envar> must be set for the <option>-printer</option> option
- identifying the available Xprint servers.
- See <citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry>
- for more details.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
</refsect1>