1 /* $XConsortium: Print.h /main/3 1996/12/10 14:59:02 rws $ */
2 /******************************************************************************
3 ******************************************************************************
7 ** Description: Definitions needed by the server, library, and
8 ** clients. Subportion restricted to library and
11 ** Server, Library, Client portion has:
13 ** o Revision and Name defines
14 ** o Common defines and constants (e.g. Keywords, Masks)
15 ** o Extension version structure
17 ** Library and client subportion has:
19 ** o Client side data structures
20 ** o Client side event structures (non wire)
21 ** o Library function prototypes
22 ** o some private stuff denoted with _whatever
24 ** Printstr.h for server and library, but NOT clients.
26 ******************************************************************************
28 ** (c) Copyright 1996 Hewlett-Packard Company
29 ** (c) Copyright 1996 International Business Machines Corp.
30 ** (c) Copyright 1996 Sun Microsystems, Inc.
31 ** (c) Copyright 1996 Novell, Inc.
32 ** (c) Copyright 1996 Digital Equipment Corp.
33 ** (c) Copyright 1996 Fujitsu Limited
34 ** (c) Copyright 1996 Hitachi, Ltd.
36 ** Permission is hereby granted, free of charge, to any person obtaining a copy
37 ** of this software and associated documentation files (the "Software"), to deal
38 ** in the Software without restriction, including without limitation the rights
39 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40 ** copies of the Software, and to permit persons to whom the Software is
41 ** furnished to do so, subject to the following conditions:
43 ** The above copyright notice and this permission notice shall be included in
44 ** all copies or substantial portions of the Software.
46 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
50 ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
51 ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
53 ** Except as contained in this notice, the names of the copyright holders shall
54 ** not be used in advertising or otherwise to promote the sale, use or other
55 ** dealings in this Software without prior written authorization from said
58 ******************************************************************************
59 *****************************************************************************/
64 #ifndef _XP_PRINT_SERVER_
66 #include <X11/Xresource.h>
67 #include <X11/Xauth.h>
68 #endif /* _XP_PRINT_SERVER_ */
70 #include <X11/Xfuncproto.h>
74 /******************************************************************************
76 * Definitions used by the server, library and client.
79 /********************************************************************
81 * Naming and versioning information.
83 #define XP_PRINTNAME "XpExtension"
86 * Add a define below for each major extension release.
88 #define XP_DONT_CHECK 0
89 #define XP_INITIAL_RELEASE 1
92 * For each single entry above, create one major/minor pair.
94 #define XP_PROTO_MAJOR 1
95 #define XP_PROTO_MINOR 0
98 * Identify current version.
100 #define XP_MAJOR_VERSION XP_PROTO_MAJOR
101 #define XP_MINOR_VERSION XP_PROTO_MINOR
104 * Misc version defines.
106 #define XP_ABSENT 0 /* Prior to XP Print support */
107 #define XP_PRESENT 1 /* With XP Print support */
109 /********************************************************************
111 * Xp Print Error codes.
113 #define XP_ERRORS 3 /* number of error types */
115 #define XPBadContext 0 /* Print Context invalid or missing */
116 #define XPBadSequence 1 /* Illegal sequence of XP operations */
117 #define XPBadResourceID 2 /* X-resource not valid */
119 /********************************************************************
121 * Xp Print Event masks and codes.
124 #define XP_EVENTS 2 /* number of event types */
126 #define XPNoEventMask 0 /* not an event - just a null mask */
127 #define XPPrintMask (1L<<0)
128 #define XPAttributeMask (1L<<1)
130 #define XPPrintNotify 0 /* contains "detail" - see below */
131 #define XPAttributeNotify 1 /* contains "detail" - see below */
133 #define XPStartJobNotify 0 /* value for "detail" in XPPrintNotify*/
134 #define XPEndJobNotify 1
135 #define XPStartDocNotify 2
136 #define XPEndDocNotify 3
137 #define XPStartPageNotify 4
138 #define XPEndPageNotify 5
140 /********************************************************************
142 * Xp Print Attribute Object codes (subset of ISO DPA 10175). The
143 * Xp Server can get and set any of the values, while the Xp Library
144 * may only be able to set a subset of the attribute objects.
146 * note: the codes are also used as "detail" for XPAttributeNotify
148 * note: XPPageAttr is not defined in ISO DPA 10175. It is unique
149 * to Xp, and its attributes are a proper subset of XPDocAttr.
151 typedef unsigned char XPAttributes; /* type of Xp*Attr codes */
153 #define XP_ATTRIBUTES 5 /* those attrs currently supported */
155 #define XPJobAttr 1 /* get/set */
156 #define XPDocAttr 2 /* get/set */
157 #define XPPageAttr 3 /* get/set - subset of XPDocAttr */
158 #define XPPrinterAttr 4 /* get only (library) */
159 #define XPServerAttr 5 /* get only (library), no
163 * note: ISO DPA 10175 defines a number of "attribute objects", of
164 * which POSIX 1387.4 and the SI Xp will only support a
167 #define XPMediumAttr 6 /* DPA-Object Medium */
168 #define XPFontAttr 7 /* DPA-Object Font */
169 #define XPResAttr 8 /* DPA-Object Resource */
170 #define XPTransAttr 9 /* DPA-Object Transfer method */
171 #define XPDelAttr 10 /* DPA-Object Delivery method */
172 #define XPAuxSPkg 11 /* DPA-Object Auxiliary sheet package */
173 #define XPAuxS 12 /* DPA-Object Auxiliary sheet */
174 #define XPFinishAttr 13 /* DPA-Object Finishing */
175 #define XPOutputAttr 14 /* DPA-Object Output method */
176 #define XPImpAttr 15 /* DPA-Object Imposition */
177 #define XPSchedAttr 16 /* DPA-Object Scheduler */
178 #define XPIntJobAttr 17 /* DPA-Object Initial value job */
179 #define XPIntDocAttr 18 /* DPA-Object Initial value document */
180 #define XPResConAttr 19 /* DPA-Object Resource context */
184 * Replacement rules for XpSetAttributes
186 typedef unsigned char XPAttrReplacement;
187 #define XPAttrReplace 1
188 #define XPAttrMerge 2
192 * Return codes for XpGetDocumentData
194 typedef unsigned char XPGetDocStatus;
195 #define XPGetDocFinished 0 /* normal termination */
196 #define XPGetDocSecondConsumer 1 /* setup error */
197 #define XPGetDocError 2 /* runtime error, see generated error */
201 * Save data types for XpStartJob.
203 typedef unsigned char XPSaveData;
204 #define XPSpool 1 /* Job data sent to spooler */
205 #define XPGetData 2 /* Job data via XpGetDocumentData */
209 * Document types for XpStartDoc.
211 typedef unsigned char XPDocumentType;
212 #define XPDocNormal 1 /* Doc data handled by Xserver */
213 #define XPDocRaw 2 /* Doc data passed through Xserver */
216 /********************************************************************
218 * Xp Print Property Names
222 #ifndef _XP_PRINT_SERVER_
224 /******************************************************************************
226 * Definitions used by the library and clients only.
229 /*******************************************************************
231 * General API defines and such.
235 * Print Context for XpInitContext and related calls.
237 typedef XID XPContext;
240 * Struct for XpGetPrinterList.
243 char *name; /* name */
244 char *desc; /* localized description */
245 } XPPrinterRec, *XPPrinterList;
248 * Typedefs for XpGetDocumentData
250 typedef void (*XPSaveProc)( Display *display,
253 unsigned int data_len,
254 XPointer client_data);
256 typedef void (*XPFinishProc)( Display *display,
258 XPGetDocStatus status,
259 XPointer client_data);
262 * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter
264 typedef char * (*XPHinterProc)();
266 /*******************************************************************
268 * Extension version structures.
277 /********************************************************************
279 * Event structs for clients.
281 * note: these events are relative to a print context, and
282 * not to a window as in core X.
285 int type; /* base + XPPrintNotify */
286 unsigned long serial; /* # of last request processed by server */
287 Bool send_event; /* true if from a SendEvent request */
288 Display *display; /* Display the event was read from */
289 XPContext context; /* print context where operation was requested */
290 Bool cancel; /* was detailed event canceled */
291 int detail; /* XPStartJobNotify, XPEndJobNotify,
292 XPStartDocNotify, XPEndDocNotify,
293 XPStartPageNotify, XPEndPageNotify */
297 int type; /* base + XPAttributeNotify */
298 unsigned long serial; /* # of last request processed by server */
299 Bool send_event; /* true if from a SendEvent request */
300 Display *display; /* Display the event was read from */
301 XPContext context; /* print context where operation was requested */
302 int detail; /* XPJobAttr, XPDocAttr, XPPageAttr,
303 XPPrinterAttr, XPSpoolerAttr,
304 XPMediumAttr, XPServerAttr */
308 int type; /* base + XPDataReadyNotify */
309 unsigned long serial; /* # of last request processed by server */
310 Bool send_event; /* true if from a SendEvent request */
311 Display *display; /* Display the event was read from */
312 XPContext context; /* print context where operation was requested */
313 unsigned long available; /* bytes available for retrieval */
317 /**********************************************************
319 * Function prototypes for library side.
322 #if NeedFunctionPrototypes
324 extern XPContext XpCreateContext (
329 extern void XpSetContext (
331 XPContext print_context
334 extern XPContext XpGetContext (
338 extern void XpDestroyContext (
340 XPContext print_context
343 extern Screen *XpGetScreenOfContext (
345 XPContext print_context
348 extern Status XpGetPageDimensions (
350 XPContext print_context,
351 unsigned short *width, /* return value */
352 unsigned short *height, /* return value */
353 XRectangle *reproducible_area /* return value */
356 extern void XpStartJob (
361 extern void XpEndJob (
365 extern void XpCancelJob (
370 extern void XpStartDoc (
375 extern void XpEndDoc (
379 extern void XpCancelDoc (
384 extern void XpPutDocumentData (
393 extern Status XpGetDocumentData (
396 XPSaveProc save_proc,
397 XPFinishProc finish_proc,
401 extern void XpStartPage (
406 extern void XpEndPage (
410 extern void XpCancelPage (
415 extern void XpSelectInput (
417 XPContext print_context,
418 unsigned long event_mask
421 extern unsigned long XpInputSelected (
423 XPContext print_context,
424 unsigned long *all_events_mask
427 extern Bool XpSetImageResolution (
429 XPContext print_context,
434 extern int XpGetImageResolution (
436 XPContext print_context
439 extern char *XpGetAttributes (
441 XPContext print_context,
445 extern void XpSetAttributes (
447 XPContext print_context,
450 XPAttrReplacement replacement_rule
453 extern char *XpGetOneAttribute (
455 XPContext print_context,
460 extern XPPrinterList XpGetPrinterList (
463 int *list_count /* return value */
466 extern void XpFreePrinterList (
467 XPPrinterList printer_list
470 extern void XpRehashPrinterList (
474 extern Status XpQueryVersion (
476 short *major_version, /* return value */
477 short *minor_version /* return value */
480 extern Bool XpQueryExtension (
482 int *event_base_return, /* return value */
483 int *error_base_return /* return value */
486 extern Screen **XpQueryScreens (
488 int *list_count /* return value */
491 extern Status XpGetPdmStartParams (
492 Display *print_display,
494 XPContext print_context,
495 Display *video_display,
497 Display **selection_display, /* return value */
498 Atom *selection, /* return value */
499 Atom *type, /* return value */
500 int *format, /* return value */
501 unsigned char **data, /* return value */
502 int *nelements /* return value */
505 extern Status XpGetAuthParams (
506 Display *print_display,
507 Display *video_display,
508 Display **selection_display, /* return value */
509 Atom *selection, /* return value */
510 Atom *target /* return value */
513 extern Status XpSendAuth (
518 extern Status XpSendOneTicket (
525 extern void XpSetLocaleHinter (
526 XPHinterProc hinter_proc,
530 extern char *XpGetLocaleHinter (
531 XPHinterProc *hinter_proc
537 extern char *XpGetLocaleNetString();
539 extern char *XpNotifyPdm (
540 Display *print_display,
542 XPContext print_context,
543 Display *video_display,
550 extern XPContext XpCreateContext ();
551 extern void XpSetContext ();
552 extern XPContext XpGetContext ();
553 extern void XpDestroyContext ();
554 extern Screen *XpGetScreenOfContext ();
555 extern Status XpGetPageDimensions ();
556 extern void XpStartJob ();
557 extern void XpEndJob ();
558 extern void XpCancelJob ();
559 extern void XpStartDoc ();
560 extern void XpEndDoc ();
561 extern void XpCancelDoc ();
562 extern void XpPutDocumentData ();
563 extern Status XpGetDocumentData ();
564 extern void XpStartPage ();
565 extern void XpEndPage ();
566 extern void XpCancelPage ();
567 extern void XpSelectInput ();
568 extern unsigned long XpInputSelected ();
569 extern Bool XpSetImageResolution ();
570 extern int XpGetImageResolution ();
571 extern char *XpGetAttributes ();
572 extern void XpSetAttributes ();
573 extern char *XpGetOneAttribute ();
574 extern XPPrinterList XpGetPrinterList ();
575 extern void XpFreePrinterList ();
576 extern void XpRehashPrinterList ();
577 extern Status XpQueryVersion ();
578 extern Bool XpQueryExtension ();
579 extern Screen **XpQueryScreens ();
580 extern Status XpGetPdmStartParams ();
581 extern Status XpGetAuthParams ();
582 extern Status XpSendAuth ();
583 extern Status XpSendOneTicket ();
584 extern void XpSetLocaleHinter ();
585 extern char *XpGetLocaleHinter ();
587 extern char *XpGetLocaleNetString ();
588 extern char *XpNotifyPdm ();
590 #endif /* NeedFunctionPrototypes */
592 #endif /* _XP_PRINT_SERVER_ */
596 #endif /* _XpPrint_H_ */