diff options
author | Roland Mainz <roland.mainz@nrubsig.org> | 2005-04-11 01:06:15 +0000 |
---|---|---|
committer | Roland Mainz <roland.mainz@nrubsig.org> | 2005-04-11 01:06:15 +0000 |
commit | 33c2d047571cd4ebce2eb630515fc33aa3f05b98 (patch) | |
tree | db36f40f732f2075f70f35983ca8603c88736368 /print.c | |
parent | bd31ddba0725738848be8298a7b1dd691c103fa3 (diff) |
xc/programs/Xserver/Xprint/attributes.cXORG-6_8_99_3
xc/programs/glxgears/glxgears.c
xc/programs/xdbedizzy/xdbedizzy.c
xc/programs/xedit/Imakefile
xc/programs/xedit/Xedit-xprint.ad
xc/programs/xedit/util.c
xc/programs/xedit/xedit.h
xc/programs/xlogo/print.c
xc/programs/xlogo/xlogo.c
xc/programs/xlogo/xlogo.h
xc/programs/xman/Imakefile
xc/programs/xman/print.h
xc/programs/xmore/Imakefile
xc/programs/xmore/print.c
xc/programs/xmore/print.h
xc/programs/xmore/printdialog.c
xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c
xc/programs/xphelloworld/xphelloworld/xphelloworld.c
xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c
xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c
//bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379
(https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support
client+Xserver support for passing output (stdout+stderr) of the
spooler command started by the Xprint server back to the application
using the "xp-spooler-command-results" XPJobAttr attribute
(applications can fetch the attribute value after the XPEndJobNotify
event was received; more details can be found in
http://xprint.mozdev.org/docs/dtprint_fspec.ps).
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 39 |
1 files changed, 33 insertions, 6 deletions
@@ -32,6 +32,9 @@ in this Software without prior written authorization from The Open Group. #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #define Log(x) { if(True) printf x; } +#ifdef XEDIT +#include "xedit.h" +#endif /* XEDIT */ #include "print.h" #include <X11/Xaw/Form.h> #include <X11/Xaw/Label.h> @@ -181,13 +184,36 @@ PageSetupCB(Widget widget, XtPointer client_data, XtPointer call_data) static void FinishPrinting(AppPrintData *p) { + char *scr; + if (p->printtofile_handle) { if (XpuWaitForPrintFileChild(p->printtofile_handle) != XPGetDocFinished) { - fprintf(stderr, "%s: Error while printing to file.\n", apd->programname); + PrintMsg(("Error while printing to file.\n")); } p->printtofile_handle = NULL; - } + } + + /* Job completed, check if there are any messages from the spooler command */ + scr = XpGetOneAttribute(p->pdpy, p->pcontext, XPJobAttr, "xp-spooler-command-results"); + if( scr ) + { + if( strlen(scr) > 0 ) + { + const char *msg = XpuCompoundTextToXmb(p->pdpy, scr); + if( msg ) + { + PrintMsg(("Spooler command returned:\n%s", msg)); + XpuFreeXmbString(msg); + } + else + { + PrintMsg(("Spooler command returned (unconverted):\n%s", scr)); + } + } + XFree((void *)scr); + } + if (p->printshell) { XtDestroyWidget(p->printshell); p->printshell = NULL; @@ -288,7 +314,7 @@ void DoPrintTextSource(const char *programname, apd->pdpyDestroyCallback = pdpyDestroyCB; if (apd->isPrinting) { - fprintf(stderr, "%s: Already busy with printing.\n", apd->programname); + PrintMsg(("Already busy with printing.\n")); return; } @@ -303,7 +329,7 @@ void DoPrintTextSource(const char *programname, /* Get default printer resolution */ if (XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1) { - fprintf(stderr, "%s: No default resolution for printer.\n", apd->programname); + PrintMsg(("No default resolution for printer.\n")); XpuClosePrinterDisplay(pdpy, pcontext); return; } @@ -390,17 +416,18 @@ void DoPrintTextSource(const char *programname, apd->isPrinting = True; if (toFile) { - printf("%s: Printing to file '%s'...\n", apd->programname, toFile); + PrintMsg(("Printing to file '%s'...\n", toFile)); apd->printtofile_handle = XpuStartJobToFile(pdpy, pcontext, toFile); if (!apd->printtofile_handle) { perror("XpuStartJobToFile failure"); + PrintMsg(("Printing failed: XpuStartJobToFile\n")); apd->isPrinting = False; return; } } else { - printf("%s: Printing to printer...\n", apd->programname); + PrintMsg(("Printing to printer...\n")); XpuStartJobToSpooler(pdpy); } } |