DtPrintResetConnection(library call) DtPrintResetConnection(library call)
NAME
DtPrintResetConnection -- resets the print display connection managed by a DtPrintSetupBox
SYNOPSIS
#include <Print.h>
XtEnum DtPrintResetConnection(
Widget wid,
DtPrintResetConnectionMode mode);
DESCRIPTION
The DtPrintResetConnection function is a convenience function provided by the DtPrintSetupBox widget that allows applications to direct the
widget to stop managing the X print server connection. A mode parameter is included in order to direct the widget to close the print con-
nection by calling XpDestroyPrintContext and XCloseDisplay or to simply relinquish control of the connection without closing it.
DtPrintResetConnection is intended to be used by applications that fork a child process to perform the print rendering operation. Immedi-
ately after the fork is performed, the parent process will close its X print server connection, and retain its connection to the video X
server. The forked child on the other hand will close its video X server connection and perform the rendering operation on the X print
server connection.
ARGUMENTS
wid The DtPrintSetupBox widget ID.
mode Indicates whether DtPrintResetConnection should close the X print server connection, or simply cause the DtPrintSetupBox to cease
managing the connection.
Valid values are:
DtPRINT_CLOSE_CONNECTION
Set by the parent process when the application forks a child to perform the print rendering. This will cause the
DtNclosePrintDisplayCallback list set for the passed DtPrintSetupBox to be called.
DtPRINT_RELEASE_CONNECTION
Set when the application wishes to destroy the DtPrintSetupBox widget instance and still perform print rendering using
the X print server connection initiated by the widget. For example, the child process of an application that forks to
perform print rendering will close the video display connection (thereby destroying the DtPrintSetupBox widget) prior
to print rendering. No DtPrintSetupBox callbacks will be called as a result of this operation.
RETURN VALUE
DtPRINT_SUCCESS
DtPrintResetConnection was successful.
DtPRINT_NO_CONNECTION
An open X print server connection is not currently being managed by the DtPrintSetupBox.
DtPRINT_BAD_PARM
The value passed for wid is NULL, or an invalid mode was passed.
ENVIRONMENT VARIABLES
None.
RESOURCES
None.
ACTIONS /MESSAGES
None.
ERRORS /WARNINGS
None.
EXAMPLES
None.
FILES
None.
SEE ALSO DtPrintSetupBox(3)
DtPrintResetConnection(library call)
Check Out this Related Man Page
XmPrintToFile(library call) XmPrintToFile(library call)
NAME
XmPrintToFile -- Retrieves and saves data that would normally be printed by the X Print Server.
SYNOPSIS
#include <Xm/Print.h>
XtEnumXmPrintToFile(
Display*dpy,
Stringfilename,
XPFinishProcfinish_proc,
XtPointerclient_data);
DESCRIPTION
XmPrintToFile hides the details of X display connection and XpGetDocumentData to the Motif application programmer.
This function is a convenience routine that hides the details of the X and Xp internals to the application programmer by calling the XpGet-
DocumentData function with appropriate save and finish callbacks.
This is used in the context of X Printing when the user has specified the "print-to-file" option from a regular Print Setup Dialog box.
XmPrintToFile first tries to open the given filename for writing and returns False if it can't. Else, it uses XpGetDocumentData, giving it
a save proc that writes the data received in the file and a finish proc that closes the file or removes it on an unsuccessful termination.
It calls finish_proc at that point, passing it the argument received from the Xp layer (status == XPGetDocFinished means the file is valid
and was closed, otherwise the file was removed).
XmPrintToFile is non-blocking; if it returns successfully, it just means the file was opened successfully, not that all the data was
received.
dpy Print display connection.
filename Name of the file to put the print data in.
finish_proc
Called when all the data has been received.
client_data
Passed with the finish_proc.
RETURN VALUE
Returns False if the filename could not be created or opened for writing, True otherwise.
ERRORS /WARNINGS
Not applicable
EXAMPLES
A typical OK callback from a DtPrintSetupBox:
PrintOKCallback(widget...)
/*-------------*/
{ int save_data = XPSpool;
pshell = XmPrintSetup (widget, pbs->print_screen,
"Print", NULL, 0);
XtAddCallback(pshell, XmNstartJobCallback, startJobCB, data);
if (pbs->destination == DtPRINT_TO_FILE)
save_data = XPGetData;
/* start job must precede XpGetDocumentData in XmPrintToFile */
XpStartJob(XtDisplay(pshell), save_data);
XFlush(XtDisplay(pshell)); /* maintain the sequence
between startjob and getdocument */
/* setup print to file */
if (pbs->destination == DtPRINT_TO_FILE)
XmPrintToFile(XtDisplay(pshell),
pbs->dest_info, FinishPrintToFile, NULL);
}
}
static void
startJobCB(Widget, XtPointer call_data, XtPointer client_data)
{
print(p); /* rendering happens here */
XpEndJob(XtDisplay(p->print_shell));
/* clean up */
XtDestroyWidget(p->print_shell);
XtCloseDisplay(XtDisplay(p->print_shell));
}
SEE ALSO XmPrintSetup(3), XmPrintShell(3), XmRedisplayWidget(3), XmPrintPopupPDM(3)
XmPrintToFile(library call)