1 /* $XConsortium: Printstr.h /main/2 1996/11/16 15:20:15 rws $ */
2 /******************************************************************************
3 ******************************************************************************
7 ** Description: Definitions needed by the server and library, but
10 ** Print.h for server, library and clients.
12 ******************************************************************************
14 ** (c) Copyright 1996 Hewlett-Packard Company
15 ** (c) Copyright 1996 International Business Machines Corp.
16 ** (c) Copyright 1996 Sun Microsystems, Inc.
17 ** (c) Copyright 1996 Novell, Inc.
18 ** (c) Copyright 1996 Digital Equipment Corp.
19 ** (c) Copyright 1996 Fujitsu Limited
20 ** (c) Copyright 1996 Hitachi, Ltd.
22 ** Permission is hereby granted, free of charge, to any person obtaining a copy
23 ** of this software and associated documentation files (the "Software"), to deal
24 ** in the Software without restriction, including without limitation the rights
25 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26 ** copies of the Software, and to permit persons to whom the Software is
27 ** furnished to do so, subject to the following conditions:
29 ** The above copyright notice and this permission notice shall be included in
30 ** all copies or substantial portions of the Software.
32 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
36 ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37 ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 ** Except as contained in this notice, the names of the copyright holders shall
40 ** not be used in advertising or otherwise to promote the sale, use or other
41 ** dealings in this Software without prior written authorization from said
44 ******************************************************************************
45 *****************************************************************************/
48 #ifndef _XpPrintstr_H_
49 #define _XpPrintstr_H_
52 * NEED_EVENTS and NEED_REPLIES are hacks to limit the linker symbol-table
53 * size. When function prototypes are needed from Print.h, this sets up
54 * a cascading dependency on Printstr.h and eventually Xproto.h to provide
55 * the event and reply struct definitions.
59 #endif /* NEED_EVENTS */
63 #include <X11/Xproto.h>
64 #ifndef _XP_PRINT_SERVER_
66 #endif /* _XP_PRINT_SERVER_ */
69 * Pull in other definitions. Print.h will hide some things if we're
70 * doing server side work.
72 #include <X11/extensions/Print.h>
74 #include <X11/Xfuncproto.h>
78 /******************************************************************************
80 * Protocol requests constants and alignment values
82 * Note: Xlib macro's expect X_ABC where ABC is the name of the
85 #define X_PrintQueryVersion 0
86 #define X_PrintGetPrinterList 1
87 #define X_PrintCreateContext 2
88 #define X_PrintSetContext 3
89 #define X_PrintGetContext 4
90 #define X_PrintDestroyContext 5
91 #define X_PrintGetContextScreen 6
92 #define X_PrintStartJob 7
93 #define X_PrintEndJob 8
94 #define X_PrintStartDoc 9
95 #define X_PrintEndDoc 10
96 #define X_PrintPutDocumentData 11
97 #define X_PrintGetDocumentData 12
98 #define X_PrintStartPage 13
99 #define X_PrintEndPage 14
100 #define X_PrintSelectInput 15
101 #define X_PrintInputSelected 16
102 #define X_PrintGetAttributes 17
103 #define X_PrintSetAttributes 18
104 #define X_PrintGetOneAttribute 19
105 #define X_PrintRehashPrinterList 20
106 #define X_PrintGetPageDimensions 21
107 #define X_PrintQueryScreens 22
108 #define X_PrintSetImageResolution 23
109 #define X_PrintGetImageResolution 24
111 /********************************************************************
113 * Protocol data types
115 #define PCONTEXT CARD32
116 #define WINDOW CARD32
117 #define DRAWABLE CARD32
118 #define BITMASK CARD32
120 /******************************************************************************
122 * Event wire struct definitions
124 * Note: Xlib macro's expect xABC struct names and sz_xABC size
125 * constants where ABC is the name of the protocol request.
129 /*********************************************************************
133 * See Print.h for the protocol "type" values.
135 typedef struct _xPrintPrintEvent {
136 BYTE type; /* XPPrintNotify + extEntry->eventBase */
137 BYTE detail; /* XPStartJobNotify, XPEndJobNotify,
138 XPStartDocNotify, XPEndDocNotify,
139 XPStartPageNotify, XPEndPageNotify */
140 CARD16 sequenceNumber B16;
141 PCONTEXT printContext B32; /* print context */
142 BOOL cancel; /* canceled flag */
143 CARD8 pad1; /* rest is unused */
151 #define sz_xPrintPrintEvent 32;
153 typedef struct _xPrintAttributeEvent {
154 BYTE type; /* XPAttributeNotify + extEntry->eventBase */
155 BYTE detail; /* XPJobAttr, XPDocAttr, XPPageAttr,
156 XPPrinterAttr, XPSpoolerAttr,
157 XPMediumAttr, XPServerAttr */
158 CARD16 sequenceNumber B16;
159 PCONTEXT printContext B32; /* print context */
166 } xPrintAttributeEvent;
167 #define sz_xPrintAttributeEvent 32;
170 /*********************************************************************
174 typedef struct _PrintQueryVersion {
175 CARD8 reqType; /* always PrintReqCode */
176 CARD8 printReqType; /* always X_PrintQueryVersion */
178 } xPrintQueryVersionReq;
179 #define sz_xPrintQueryVersionReq 4
182 BYTE type; /* X_Reply */
183 CARD8 unused; /* not used */
184 CARD16 sequenceNumber B16;
186 CARD16 majorVersion B16; /* major version of Xp protocol */
187 CARD16 minorVersion B16; /* minor version of Xp protocol */
193 } xPrintQueryVersionReply;
194 #define sz_xPrintQueryVersionReply 32
197 typedef struct _PrintGetPrinterList {
198 CARD8 reqType; /* always PrintReqCode */
199 CARD8 printReqType; /* always X_PrintGetPrinterList */
201 CARD32 printerNameLen B32; /* length of printer name */
202 CARD32 localeLen B32; /* length of locale string */
204 /* variable portion *****************************************
205 STRING8 printerName; * printer name *
206 BYTE pad(printerNameLen) * unused *
207 STRING8 locale; * locale *
208 BYTE pad(localeLen) * unused *
209 ************************************************************/
210 } xPrintGetPrinterListReq;
211 #define sz_xPrintGetPrinterListReq 12
214 BYTE type; /* X_Reply */
215 CARD8 unused; /* not used */
216 CARD16 sequenceNumber B16;
218 CARD32 listCount B32; /* of PRINTER recs below */
225 /* variable portion *****************************************
226 CARD32 nameLen B32; * length of name in bytes *
227 STRING8 name; * name *
228 BYTE pad(nameLen) * unused *
230 CARD32 descLen B32; * length of desc in bytes *
231 STRING8 desc; * localized description *
232 BYTE pad(descLen) * unused *
233 ************************************************************/
234 } xPrintGetPrinterListReply;
235 #define sz_xPrintGetPrinterListReply 32
238 typedef struct _PrintRehashPrinterList {
239 CARD8 reqType; /* always PrintReqCode */
240 CARD8 printReqType; /* always X_PrintRehashPrinterList */
242 } xPrintRehashPrinterListReq;
243 #define sz_xPrintRehashPrinterListReq 4
246 typedef struct _PrintCreateContext {
247 CARD8 reqType; /* always PrintReqCode */
248 CARD8 printReqType; /* always X_PrintInitSetContext */
250 CARD32 contextID B32; /* ID for context */
251 CARD32 printerNameLen B32; /* length of printerName in bytes */
252 CARD32 localeLen B32; /* length of locale in bytes */
254 /* variable portion *****************************************
255 STRING8 printerName * printer name *
256 BYTE pad(printerNameLen) * unused *
257 STRING8 locale * locale *
258 BYTE pad(locale) * unused *
259 ************************************************************/
260 } xPrintCreateContextReq;
261 #define sz_xPrintCreateContextReq 16
264 typedef struct _PrintSetContext {
265 CARD8 reqType; /* always PrintReqCode */
266 CARD8 printReqType; /* always X_PrintSetContext */
268 PCONTEXT printContext B32; /* print context */
269 } xPrintSetContextReq;
270 #define sz_xPrintSetContextReq 8
273 typedef struct _PrintGetContext {
274 CARD8 reqType; /* always PrintReqCode */
275 CARD8 printReqType; /* always X_PrintGetContext */
277 } xPrintGetContextReq;
278 #define sz_xPrintGetContextReq 4
281 BYTE type; /* X_Reply */
282 CARD8 unused; /* not used */
283 CARD16 sequenceNumber B16;
285 PCONTEXT printContext B32; /* print context */
291 } xPrintGetContextReply;
292 #define sz_xPrintGetContextReply 32
295 typedef struct _PrintDestroyContext {
296 CARD8 reqType; /* always PrintReqCode */
297 CARD8 printReqType; /* always X_PrintDestroyContext */
299 PCONTEXT printContext B32; /* print context */
300 } xPrintDestroyContextReq;
301 #define sz_xPrintDestroyContextReq 8
304 typedef struct _PrintGetContextScreen {
305 CARD8 reqType; /* always PrintReqCode */
306 CARD8 printReqType; /* always X_PrintGetContextScreen */
308 PCONTEXT printContext B32; /* print context */
309 } xPrintGetContextScreenReq;
310 #define sz_xPrintGetContextScreenReq 8
313 BYTE type; /* X_Reply */
314 CARD8 unused; /* not used */
315 CARD16 sequenceNumber B16;
317 WINDOW rootWindow; /* screenPtr represented as rootWin */
323 } xPrintGetContextScreenReply;
324 #define sz_xPrintGetContextScreenReply 32
327 typedef struct _PrintStartJob {
328 CARD8 reqType; /* always PrintReqCode */
329 CARD8 printReqType; /* always X_PrintStartJob */
331 CARD8 saveData; /* save data boolean */
335 #define sz_xPrintStartJobReq 8
337 typedef struct _PrintEndJob {
338 CARD8 reqType; /* always PrintReqCode */
339 CARD8 printReqType; /* always X_PrintEndJob */
341 BOOL cancel; /* cancel boolean */
345 #define sz_xPrintEndJobReq 8
348 typedef struct _PrintStartDoc {
349 CARD8 reqType; /* always PrintReqCode */
350 CARD8 printReqType; /* always X_PrintStartDoc */
352 CARD8 type; /* type for document */
356 #define sz_xPrintStartDocReq 8
358 typedef struct _PrintEndDoc {
359 CARD8 reqType; /* always PrintReqCode */
360 CARD8 printReqType; /* always X_PrintEndDoc */
362 BOOL cancel; /* cancel boolean */
366 #define sz_xPrintEndDocReq 8
369 typedef struct _PrintPutDocumentData {
370 CARD8 reqType; /* always PrintReqCode */
371 CARD8 printReqType; /* always X_PrintPutDocumentData */
373 DRAWABLE drawable B32; /* target drawable */
374 CARD32 len_data B32; /* big len in bytes */
375 CARD16 len_fmt; /* len in bytes */
376 CARD16 len_options; /* len in bytes */
378 /* variable portion *****************************************
379 LISTofBYTE data; * data *
380 BYTE pad(len_data) * unused *
381 STRING8 doc_fmt; * ISO compliant desc of data type *
382 BYTE pad(len_fmt) * unused *
383 STRING8 options; * additional device-dependent desc *
384 BYTE pad(len_options) * unused *
385 ************************************************************/
386 } xPrintPutDocumentDataReq;
387 #define sz_xPrintPutDocumentDataReq 16
390 typedef struct _PrintGetDocumentData {
391 CARD8 reqType; /* always PrintReqCode */
392 CARD8 printReqType; /* always X_PrintGetDocumentData */
394 PCONTEXT printContext B32; /* print context */
395 CARD32 maxBufferSize B32; /* maximum buffer size requested */
396 } xPrintGetDocumentDataReq;
397 #define sz_xPrintGetDocumentDataReq 12
400 BYTE type; /* X_Reply */
401 CARD8 unused; /* not used */
402 CARD16 sequenceNumber B16;
404 CARD32 statusCode B32; /* status code for reply */
405 CARD32 finishedFlag B32; /* is this the last reply */
406 CARD32 dataLen B32; /* data length */
411 /* variable portion *****************************************
412 LISTofBYTE data; * data *
413 BYTE pad(count) * unused *
414 ************************************************************/
415 } xPrintGetDocumentDataReply;
416 #define sz_xPrintGetDocumentDataReply 32
419 typedef struct _PrintStartPage {
420 CARD8 reqType; /* always PrintReqCode */
421 CARD8 printReqType; /* always X_PrintStartPage */
423 WINDOW window B32; /* window */
424 } xPrintStartPageReq;
425 #define sz_xPrintStartPageReq 8
427 typedef struct _PrintEndPage {
428 CARD8 reqType; /* always PrintReqCode */
429 CARD8 printReqType; /* always X_PrintEndPage */
431 BOOL cancel; /* cancel boolean */
435 #define sz_xPrintEndPageReq 8
438 typedef struct _PrintSelectInput {
439 CARD8 reqType; /* always PrintReqCode */
440 CARD8 printReqType; /* always X_PrintSelectInput */
442 PCONTEXT printContext B32; /* print context */
443 BITMASK eventMask B32;
444 } xPrintSelectInputReq;
445 #define sz_xPrintSelectInputReq 12
448 typedef struct _PrintInputSelected {
449 CARD8 reqType; /* always PrintReqCode */
450 CARD8 printReqType; /* always X_PrintInputSelected */
452 PCONTEXT printContext B32; /* print context */
453 } xPrintInputSelectedReq;
454 #define sz_xPrintInputSelectedReq 8
457 BYTE type; /* X_Reply */
458 CARD8 unused; /* not used */
459 CARD16 sequenceNumber B16;
461 BITMASK eventMask B32; /* your event mask */
462 BITMASK allEventsMask B32; /* all event mask */
467 } xPrintInputSelectedReply;
468 #define sz_xPrintInputSelectedReply 32
470 typedef struct _PrintGetAttributes {
471 CARD8 reqType; /* always PrintReqCode */
472 CARD8 printReqType; /* always X_PrintGetAttributes */
474 PCONTEXT printContext B32; /* print context */
475 CARD8 type; /* type */
476 CARD8 pad1; /* unused */
477 CARD16 pad2 B16; /* unused */
478 } xPrintGetAttributesReq;
479 #define sz_xPrintGetAttributesReq 12
482 BYTE type; /* X_Reply */
483 CARD8 unused; /* not used */
484 CARD16 sequenceNumber B16;
486 CARD32 stringLen B32; /* length of xrm db string */
493 /* variable portion *****************************************
494 STRING8 string; * xrm db as a string *
495 BYTE pad(stringLen) * unused *
496 ************************************************************/
497 } xPrintGetAttributesReply;
498 #define sz_xPrintGetAttributesReply 32
501 typedef struct _PrintSetAttributes {
502 CARD8 reqType; /* always PrintReqCode */
503 CARD8 printReqType; /* always X_PrintSetAttributes */
505 PCONTEXT printContext B32; /* print context */
506 CARD32 stringLen B32; /* length of xrm db string */
507 CARD8 type; /* type */
508 CARD8 rule; /* replacement rule */
509 CARD16 pad1 B16; /* unused */
511 /* variable portion *****************************************
512 STRING8 string; * xrm db as a string *
513 BYTE pad(stringLen) * unused *
514 ************************************************************/
515 } xPrintSetAttributesReq;
516 #define sz_xPrintSetAttributesReq 16
519 typedef struct _PrintGetOneAttribute {
520 CARD8 reqType; /* always PrintReqCode */
521 CARD8 printReqType; /* always X_PrintGetOneAttribute */
523 PCONTEXT printContext B32; /* print context */
524 CARD32 nameLen; /* length of name string */
525 CARD8 type; /* type */
526 CARD8 pad1; /* unused */
527 CARD16 pad2 B16; /* unused */
529 /* variable portion *****************************************
530 STRING8 name; * name as a string *
531 BYTE pad(name) * unused *
532 ************************************************************/
533 } xPrintGetOneAttributeReq;
534 #define sz_xPrintGetOneAttributeReq 16
537 BYTE type; /* X_Reply */
538 CARD8 unused; /* not used */
539 CARD16 sequenceNumber B16;
541 CARD32 valueLen B32; /* length of value string */
548 /* variable portion *****************************************
549 STRING8 value; * value as a string *
550 BYTE pad(value) * unused *
551 ************************************************************/
552 } xPrintGetOneAttributeReply;
553 #define sz_xPrintGetOneAttributeReply 32
556 typedef struct _PrintGetPageDimensions {
557 CARD8 reqType; /* always PrintReqCode */
558 CARD8 printReqType; /* always X_PrintGetPageDimensions */
560 PCONTEXT printContext B32; /* print context */
561 } xPrintGetPageDimensionsReq;
562 #define sz_xPrintGetPageDimensionsReq 8
565 BYTE type; /* X_Reply */
566 CARD8 unused; /* not used */
567 CARD16 sequenceNumber B16;
569 CARD16 width; /* total pixel width */
570 CARD16 height; /* total pixel height */
571 CARD16 rx; /* reproducable x pixel offset */
572 CARD16 ry; /* reproducable y pixel offset */
573 CARD16 rwidth; /* reproducable x pixel width */
574 CARD16 rheight; /* reproducable y pixel width */
578 } xPrintGetPageDimensionsReply;
579 #define sz_xPrintGetPageDimensionsReply 32
582 typedef struct _PrintQueryScreens {
583 CARD8 reqType; /* always PrintReqCode */
584 CARD8 printReqType; /* always X_PrintQueryScreens */
586 } xPrintQueryScreensReq;
587 #define sz_xPrintQueryScreensReq 4
590 BYTE type; /* X_Reply */
591 CARD8 unused; /* not used */
592 CARD16 sequenceNumber B16;
594 CARD32 listCount; /* number of screens following */
601 /* variable portion *****************************************
602 WINDOW rootWindow; * root window of screen *
603 ************************************************************/
604 } xPrintQueryScreensReply;
605 #define sz_xPrintQueryScreensReply 32
607 typedef struct _PrintSetImageResolution {
608 CARD8 reqType; /* always PrintReqCode */
609 CARD8 printReqType; /* always X_PrintSetImageResolution */
611 PCONTEXT printContext B32; /* print context */
612 CARD16 imageRes B16; /* image resolution */
614 } xPrintSetImageResolutionReq;
615 #define sz_xPrintSetImageResolutionReq 12
618 BYTE type; /* X_Reply */
619 BOOL status; /* accepted or not */
620 CARD16 sequenceNumber B16;
622 CARD16 prevRes B16; /* previous resolution */
629 } xPrintSetImageResolutionReply;
630 #define sz_xPrintSetImageResolutionReply 32
632 typedef struct _PrintGetImageResolution {
633 CARD8 reqType; /* always PrintReqCode */
634 CARD8 printReqType; /* always X_PrintGetImageResolution */
636 PCONTEXT printContext B32; /* print context */
637 } xPrintGetImageResolutionReq;
638 #define sz_xPrintGetImageResolutionReq 8
641 BYTE type; /* X_Reply */
643 CARD16 sequenceNumber B16;
645 CARD16 imageRes B16; /* image resolution */
652 } xPrintGetImageResolutionReply;
653 #define sz_xPrintGetImageResolutionReply 32
655 #ifndef _XP_PRINT_SERVER_
656 /***********************************************************************
658 * Library-only definitions.
660 extern XPHinterProc _xp_hinter_proc;
661 extern char *_xp_hinter_desc;
662 extern int _xp_hinter_init;
664 #endif /* _XP_PRINT_SERVER_ */
666 #ifdef _XP_PRINT_SERVER_
667 /***********************************************************************
669 * Server-only definitions shared between the extension and DDX layers.
674 * Internal return code used to indicate that the requesting
675 * client has been suspended.
679 extern void XpRegisterPrinterScreen(
681 int (*CreateContext)());
683 typedef struct _xpprintFuncs {
684 int (*StartJob)(); /* pContext, client */
685 int (*EndJob)(); /* pContext, client */
686 int (*StartDoc)(); /* pContext, client */
687 int (*EndDoc)(); /* pContext, client */
688 int (*StartPage)(); /* pContext, pWin, client, exposures */
689 int (*EndPage)(); /* pContext, client */
690 int (*PutDocumentData)(); /* pContext,pDraw,pData,len_data,pFmt,len_fmt,pOpt,len_opt, client */
691 int (*GetDocumentData)(); /* pContext,pData,len_data,pFmt,len_fmt,pOpt,len_opt, client */
692 int (*DestroyContext)(); /* pContext, client */
693 char *(*GetAttributes)(); /* pContext, pool */
694 char *(*GetOneAttribute)(); /* pContext, pool, attr */
695 int (*SetAttributes)(); /* pContext, pool, attrs */
696 int (*AugmentAttributes)(); /* pContext, pool, attrs */
697 int (*GetMediumDimensions)(); /* pPrintContext, pWidth, pHeight */
698 int (*GetReproducibleArea)(); /* pPrintContext, pRect */
699 int (*SetImageResolution)(); /* pPrintContext, imageRes, pStatus */
700 } XpDriverFuncs, *XpDriverFuncsPtr;
703 * Each print context is represented by one of the following structs
704 * associated with a resource ID of type RTcontext . A pointer to
705 * the context is placed in the Xp extension's devPrivates
706 * element in each client * which establishes a context via
707 * either initContext or setContext.
708 * The context pointer is also placed in the struct indicated by the
709 * RTpage resource associated with each StartPage'd window.
711 typedef struct _XpContext {
714 int screenNum; /* screen containing the printer */
715 struct _XpClient *clientHead; /* list of clients */
718 DevUnion *devPrivates;
720 ClientPtr clientSlept;
722 } XpContextRec, *XpContextPtr;
724 extern XpContextPtr XpGetPrintContext(
727 #endif /* _XP_PRINT_SERVER_ */
731 #endif /* _XpPrintstr_H_ */