1
/* $Xorg: Printstr.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
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
*****************************************************************************/
46
/* $XFree86: xc/include/extensions/Printstr.h,v 1.6 2001/08/23 12:46:11 alanh Exp $ */
49
#ifndef _XpPrintstr_H_
50
#define _XpPrintstr_H_
53
* NEED_EVENTS and NEED_REPLIES are hacks to limit the linker symbol-table
54
* size. When function prototypes are needed from Print.h, this sets up
55
* a cascading dependency on Printstr.h and eventually Xproto.h to provide
56
* the event and reply struct definitions.
60
#endif /* NEED_EVENTS */
64
#include <X11/Xproto.h>
65
#ifndef _XP_PRINT_SERVER_
67
#endif /* _XP_PRINT_SERVER_ */
70
* Pull in other definitions. Print.h will hide some things if we're
71
* doing server side work.
73
#include <X11/extensions/Print.h>
75
#include <X11/Xfuncproto.h>
79
/******************************************************************************
81
* Protocol requests constants and alignment values
83
* Note: Xlib macro's expect X_ABC where ABC is the name of the
86
#define X_PrintQueryVersion 0
87
#define X_PrintGetPrinterList 1
88
#define X_PrintCreateContext 2
89
#define X_PrintSetContext 3
90
#define X_PrintGetContext 4
91
#define X_PrintDestroyContext 5
92
#define X_PrintGetContextScreen 6
93
#define X_PrintStartJob 7
94
#define X_PrintEndJob 8
95
#define X_PrintStartDoc 9
96
#define X_PrintEndDoc 10
97
#define X_PrintPutDocumentData 11
98
#define X_PrintGetDocumentData 12
99
#define X_PrintStartPage 13
100
#define X_PrintEndPage 14
101
#define X_PrintSelectInput 15
102
#define X_PrintInputSelected 16
103
#define X_PrintGetAttributes 17
104
#define X_PrintSetAttributes 18
105
#define X_PrintGetOneAttribute 19
106
#define X_PrintRehashPrinterList 20
107
#define X_PrintGetPageDimensions 21
108
#define X_PrintQueryScreens 22
109
#define X_PrintSetImageResolution 23
110
#define X_PrintGetImageResolution 24
112
/********************************************************************
114
* Protocol data types
116
#define PCONTEXT CARD32
117
#define WINDOW CARD32
118
#define DRAWABLE CARD32
119
#define BITMASK CARD32
121
/******************************************************************************
123
* Event wire struct definitions
125
* Note: Xlib macro's expect xABC struct names and sz_xABC size
126
* constants where ABC is the name of the protocol request.
130
/*********************************************************************
134
* See Print.h for the protocol "type" values.
136
typedef struct _xPrintPrintEvent {
137
BYTE type; /* XPPrintNotify + extEntry->eventBase */
138
BYTE detail; /* XPStartJobNotify, XPEndJobNotify,
139
XPStartDocNotify, XPEndDocNotify,
140
XPStartPageNotify, XPEndPageNotify */
141
CARD16 sequenceNumber B16;
142
PCONTEXT printContext B32; /* print context */
143
BOOL cancel; /* canceled flag */
144
CARD8 pad1; /* rest is unused */
152
#define sz_xPrintPrintEvent 32;
154
typedef struct _xPrintAttributeEvent {
155
BYTE type; /* XPAttributeNotify + extEntry->eventBase */
156
BYTE detail; /* XPJobAttr, XPDocAttr, XPPageAttr,
157
XPPrinterAttr, XPSpoolerAttr,
158
XPMediumAttr, XPServerAttr */
159
CARD16 sequenceNumber B16;
160
PCONTEXT printContext B32; /* print context */
167
} xPrintAttributeEvent;
168
#define sz_xPrintAttributeEvent 32;
171
/*********************************************************************
175
typedef struct _PrintQueryVersion {
176
CARD8 reqType; /* always PrintReqCode */
177
CARD8 printReqType; /* always X_PrintQueryVersion */
179
} xPrintQueryVersionReq;
180
#define sz_xPrintQueryVersionReq 4
183
BYTE type; /* X_Reply */
184
CARD8 unused; /* not used */
185
CARD16 sequenceNumber B16;
187
CARD16 majorVersion B16; /* major version of Xp protocol */
188
CARD16 minorVersion B16; /* minor version of Xp protocol */
194
} xPrintQueryVersionReply;
195
#define sz_xPrintQueryVersionReply 32
198
typedef struct _PrintGetPrinterList {
199
CARD8 reqType; /* always PrintReqCode */
200
CARD8 printReqType; /* always X_PrintGetPrinterList */
202
CARD32 printerNameLen B32; /* length of printer name */
203
CARD32 localeLen B32; /* length of locale string */
205
/* variable portion *****************************************
206
STRING8 printerName; * printer name *
207
BYTE pad(printerNameLen) * unused *
208
STRING8 locale; * locale *
209
BYTE pad(localeLen) * unused *
210
************************************************************/
211
} xPrintGetPrinterListReq;
212
#define sz_xPrintGetPrinterListReq 12
215
BYTE type; /* X_Reply */
216
CARD8 unused; /* not used */
217
CARD16 sequenceNumber B16;
219
CARD32 listCount B32; /* of PRINTER recs below */
226
/* variable portion *****************************************
227
CARD32 nameLen B32; * length of name in bytes *
228
STRING8 name; * name *
229
BYTE pad(nameLen) * unused *
231
CARD32 descLen B32; * length of desc in bytes *
232
STRING8 desc; * localized description *
233
BYTE pad(descLen) * unused *
234
************************************************************/
235
} xPrintGetPrinterListReply;
236
#define sz_xPrintGetPrinterListReply 32
239
typedef struct _PrintRehashPrinterList {
240
CARD8 reqType; /* always PrintReqCode */
241
CARD8 printReqType; /* always X_PrintRehashPrinterList */
243
} xPrintRehashPrinterListReq;
244
#define sz_xPrintRehashPrinterListReq 4
247
typedef struct _PrintCreateContext {
248
CARD8 reqType; /* always PrintReqCode */
249
CARD8 printReqType; /* always X_PrintInitSetContext */
251
CARD32 contextID B32; /* ID for context */
252
CARD32 printerNameLen B32; /* length of printerName in bytes */
253
CARD32 localeLen B32; /* length of locale in bytes */
255
/* variable portion *****************************************
256
STRING8 printerName * printer name *
257
BYTE pad(printerNameLen) * unused *
258
STRING8 locale * locale *
259
BYTE pad(locale) * unused *
260
************************************************************/
261
} xPrintCreateContextReq;
262
#define sz_xPrintCreateContextReq 16
265
typedef struct _PrintSetContext {
266
CARD8 reqType; /* always PrintReqCode */
267
CARD8 printReqType; /* always X_PrintSetContext */
269
PCONTEXT printContext B32; /* print context */
270
} xPrintSetContextReq;
271
#define sz_xPrintSetContextReq 8
274
typedef struct _PrintGetContext {
275
CARD8 reqType; /* always PrintReqCode */
276
CARD8 printReqType; /* always X_PrintGetContext */
278
} xPrintGetContextReq;
279
#define sz_xPrintGetContextReq 4
282
BYTE type; /* X_Reply */
283
CARD8 unused; /* not used */
284
CARD16 sequenceNumber B16;
286
PCONTEXT printContext B32; /* print context */
292
} xPrintGetContextReply;
293
#define sz_xPrintGetContextReply 32
296
typedef struct _PrintDestroyContext {
297
CARD8 reqType; /* always PrintReqCode */
298
CARD8 printReqType; /* always X_PrintDestroyContext */
300
PCONTEXT printContext B32; /* print context */
301
} xPrintDestroyContextReq;
302
#define sz_xPrintDestroyContextReq 8
305
typedef struct _PrintGetContextScreen {
306
CARD8 reqType; /* always PrintReqCode */
307
CARD8 printReqType; /* always X_PrintGetContextScreen */
309
PCONTEXT printContext B32; /* print context */
310
} xPrintGetContextScreenReq;
311
#define sz_xPrintGetContextScreenReq 8
314
BYTE type; /* X_Reply */
315
CARD8 unused; /* not used */
316
CARD16 sequenceNumber B16;
318
WINDOW rootWindow; /* screenPtr represented as rootWin */
324
} xPrintGetContextScreenReply;
325
#define sz_xPrintGetContextScreenReply 32
328
typedef struct _PrintStartJob {
329
CARD8 reqType; /* always PrintReqCode */
330
CARD8 printReqType; /* always X_PrintStartJob */
332
CARD8 saveData; /* save data boolean */
336
#define sz_xPrintStartJobReq 8
338
typedef struct _PrintEndJob {
339
CARD8 reqType; /* always PrintReqCode */
340
CARD8 printReqType; /* always X_PrintEndJob */
342
BOOL cancel; /* cancel boolean */
346
#define sz_xPrintEndJobReq 8
349
typedef struct _PrintStartDoc {
350
CARD8 reqType; /* always PrintReqCode */
351
CARD8 printReqType; /* always X_PrintStartDoc */
353
CARD8 type; /* type for document */
357
#define sz_xPrintStartDocReq 8
359
typedef struct _PrintEndDoc {
360
CARD8 reqType; /* always PrintReqCode */
361
CARD8 printReqType; /* always X_PrintEndDoc */
363
BOOL cancel; /* cancel boolean */
367
#define sz_xPrintEndDocReq 8
370
typedef struct _PrintPutDocumentData {
371
CARD8 reqType; /* always PrintReqCode */
372
CARD8 printReqType; /* always X_PrintPutDocumentData */
374
DRAWABLE drawable B32; /* target drawable */
375
CARD32 len_data B32; /* big len in bytes */
376
CARD16 len_fmt; /* len in bytes */
377
CARD16 len_options; /* len in bytes */
379
/* variable portion *****************************************
380
LISTofBYTE data; * data *
381
BYTE pad(len_data) * unused *
382
STRING8 doc_fmt; * ISO compliant desc of data type *
383
BYTE pad(len_fmt) * unused *
384
STRING8 options; * additional device-dependent desc *
385
BYTE pad(len_options) * unused *
386
************************************************************/
387
} xPrintPutDocumentDataReq;
388
#define sz_xPrintPutDocumentDataReq 16
391
typedef struct _PrintGetDocumentData {
392
CARD8 reqType; /* always PrintReqCode */
393
CARD8 printReqType; /* always X_PrintGetDocumentData */
395
PCONTEXT printContext B32; /* print context */
396
CARD32 maxBufferSize B32; /* maximum buffer size requested */
397
} xPrintGetDocumentDataReq;
398
#define sz_xPrintGetDocumentDataReq 12
401
BYTE type; /* X_Reply */
402
CARD8 unused; /* not used */
403
CARD16 sequenceNumber B16;
405
CARD32 statusCode B32; /* status code for reply */
406
CARD32 finishedFlag B32; /* is this the last reply */
407
CARD32 dataLen B32; /* data length */
412
/* variable portion *****************************************
413
LISTofBYTE data; * data *
414
BYTE pad(count) * unused *
415
************************************************************/
416
} xPrintGetDocumentDataReply;
417
#define sz_xPrintGetDocumentDataReply 32
420
typedef struct _PrintStartPage {
421
CARD8 reqType; /* always PrintReqCode */
422
CARD8 printReqType; /* always X_PrintStartPage */
424
WINDOW window B32; /* window */
425
} xPrintStartPageReq;
426
#define sz_xPrintStartPageReq 8
428
typedef struct _PrintEndPage {
429
CARD8 reqType; /* always PrintReqCode */
430
CARD8 printReqType; /* always X_PrintEndPage */
432
BOOL cancel; /* cancel boolean */
436
#define sz_xPrintEndPageReq 8
439
typedef struct _PrintSelectInput {
440
CARD8 reqType; /* always PrintReqCode */
441
CARD8 printReqType; /* always X_PrintSelectInput */
443
PCONTEXT printContext B32; /* print context */
444
BITMASK eventMask B32;
445
} xPrintSelectInputReq;
446
#define sz_xPrintSelectInputReq 12
449
typedef struct _PrintInputSelected {
450
CARD8 reqType; /* always PrintReqCode */
451
CARD8 printReqType; /* always X_PrintInputSelected */
453
PCONTEXT printContext B32; /* print context */
454
} xPrintInputSelectedReq;
455
#define sz_xPrintInputSelectedReq 8
458
BYTE type; /* X_Reply */
459
CARD8 unused; /* not used */
460
CARD16 sequenceNumber B16;
462
BITMASK eventMask B32; /* your event mask */
463
BITMASK allEventsMask B32; /* all event mask */
468
} xPrintInputSelectedReply;
469
#define sz_xPrintInputSelectedReply 32
471
typedef struct _PrintGetAttributes {
472
CARD8 reqType; /* always PrintReqCode */
473
CARD8 printReqType; /* always X_PrintGetAttributes */
475
PCONTEXT printContext B32; /* print context */
476
CARD8 type; /* type */
477
CARD8 pad1; /* unused */
478
CARD16 pad2 B16; /* unused */
479
} xPrintGetAttributesReq;
480
#define sz_xPrintGetAttributesReq 12
483
BYTE type; /* X_Reply */
484
CARD8 unused; /* not used */
485
CARD16 sequenceNumber B16;
487
CARD32 stringLen B32; /* length of xrm db string */
494
/* variable portion *****************************************
495
STRING8 string; * xrm db as a string *
496
BYTE pad(stringLen) * unused *
497
************************************************************/
498
} xPrintGetAttributesReply;
499
#define sz_xPrintGetAttributesReply 32
502
typedef struct _PrintSetAttributes {
503
CARD8 reqType; /* always PrintReqCode */
504
CARD8 printReqType; /* always X_PrintSetAttributes */
506
PCONTEXT printContext B32; /* print context */
507
CARD32 stringLen B32; /* length of xrm db string */
508
CARD8 type; /* type */
509
CARD8 rule; /* replacement rule */
510
CARD16 pad1 B16; /* unused */
512
/* variable portion *****************************************
513
STRING8 string; * xrm db as a string *
514
BYTE pad(stringLen) * unused *
515
************************************************************/
516
} xPrintSetAttributesReq;
517
#define sz_xPrintSetAttributesReq 16
520
typedef struct _PrintGetOneAttribute {
521
CARD8 reqType; /* always PrintReqCode */
522
CARD8 printReqType; /* always X_PrintGetOneAttribute */
524
PCONTEXT printContext B32; /* print context */
525
CARD32 nameLen; /* length of name string */
526
CARD8 type; /* type */
527
CARD8 pad1; /* unused */
528
CARD16 pad2 B16; /* unused */
530
/* variable portion *****************************************
531
STRING8 name; * name as a string *
532
BYTE pad(name) * unused *
533
************************************************************/
534
} xPrintGetOneAttributeReq;
535
#define sz_xPrintGetOneAttributeReq 16
538
BYTE type; /* X_Reply */
539
CARD8 unused; /* not used */
540
CARD16 sequenceNumber B16;
542
CARD32 valueLen B32; /* length of value string */
549
/* variable portion *****************************************
550
STRING8 value; * value as a string *
551
BYTE pad(value) * unused *
552
************************************************************/
553
} xPrintGetOneAttributeReply;
554
#define sz_xPrintGetOneAttributeReply 32
557
typedef struct _PrintGetPageDimensions {
558
CARD8 reqType; /* always PrintReqCode */
559
CARD8 printReqType; /* always X_PrintGetPageDimensions */
561
PCONTEXT printContext B32; /* print context */
562
} xPrintGetPageDimensionsReq;
563
#define sz_xPrintGetPageDimensionsReq 8
566
BYTE type; /* X_Reply */
567
CARD8 unused; /* not used */
568
CARD16 sequenceNumber B16;
570
CARD16 width; /* total pixel width */
571
CARD16 height; /* total pixel height */
572
CARD16 rx; /* reproducable x pixel offset */
573
CARD16 ry; /* reproducable y pixel offset */
574
CARD16 rwidth; /* reproducable x pixel width */
575
CARD16 rheight; /* reproducable y pixel width */
579
} xPrintGetPageDimensionsReply;
580
#define sz_xPrintGetPageDimensionsReply 32
583
typedef struct _PrintQueryScreens {
584
CARD8 reqType; /* always PrintReqCode */
585
CARD8 printReqType; /* always X_PrintQueryScreens */
587
} xPrintQueryScreensReq;
588
#define sz_xPrintQueryScreensReq 4
591
BYTE type; /* X_Reply */
592
CARD8 unused; /* not used */
593
CARD16 sequenceNumber B16;
595
CARD32 listCount; /* number of screens following */
602
/* variable portion *****************************************
603
WINDOW rootWindow; * root window of screen *
604
************************************************************/
605
} xPrintQueryScreensReply;
606
#define sz_xPrintQueryScreensReply 32
608
typedef struct _PrintSetImageResolution {
609
CARD8 reqType; /* always PrintReqCode */
610
CARD8 printReqType; /* always X_PrintSetImageResolution */
612
PCONTEXT printContext B32; /* print context */
613
CARD16 imageRes B16; /* image resolution */
615
} xPrintSetImageResolutionReq;
616
#define sz_xPrintSetImageResolutionReq 12
619
BYTE type; /* X_Reply */
620
BOOL status; /* accepted or not */
621
CARD16 sequenceNumber B16;
623
CARD16 prevRes B16; /* previous resolution */
630
} xPrintSetImageResolutionReply;
631
#define sz_xPrintSetImageResolutionReply 32
633
typedef struct _PrintGetImageResolution {
634
CARD8 reqType; /* always PrintReqCode */
635
CARD8 printReqType; /* always X_PrintGetImageResolution */
637
PCONTEXT printContext B32; /* print context */
638
} xPrintGetImageResolutionReq;
639
#define sz_xPrintGetImageResolutionReq 8
642
BYTE type; /* X_Reply */
644
CARD16 sequenceNumber B16;
646
CARD16 imageRes B16; /* image resolution */
653
} xPrintGetImageResolutionReply;
654
#define sz_xPrintGetImageResolutionReply 32
656
#ifndef _XP_PRINT_SERVER_
657
/***********************************************************************
659
* Library-only definitions.
661
extern XPHinterProc _xp_hinter_proc;
662
extern char *_xp_hinter_desc;
663
extern int _xp_hinter_init;
665
#else /* _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.
681
extern void XpRegisterPrinterScreen(
683
int (*CreateContext)(struct _XpContext *));
685
typedef struct _xpprintFuncs {
687
struct _XpContext * /* pContext */,
688
Bool /* sendClientData */,
689
ClientPtr /* client */);
690
int (*EndJob)(struct _XpContext *, int);
692
struct _XpContext * /* pContext */,
693
XPDocumentType /* type */);
694
int (*EndDoc)(struct _XpContext *, int);
696
struct _XpContext * /* pContext */,
697
WindowPtr /* pWin */);
699
struct _XpContext * /* pContext */,
700
WindowPtr /* pWin */);
701
int (*PutDocumentData)(
702
struct _XpContext * /* pContext */,
703
DrawablePtr /* pDraw */,
706
char * /* pDoc_fmt */,
708
char * /* pOptions */,
709
int /* len_options */,
710
ClientPtr /* client */);
711
int (*GetDocumentData)(
712
struct _XpContext * /* pContext */,
713
ClientPtr /* client */,
714
int /* maxBufferSize */);
715
int (*DestroyContext)(
716
struct _XpContext *); /* pContext */
717
char *(*GetAttributes)(
719
XPAttributes /* pool */);
720
char *(*GetOneAttribute)(
721
struct _XpContext * /* pContext */,
722
XPAttributes /* pool */,
724
int (*SetAttributes)(
725
struct _XpContext * /* pContext */,
726
XPAttributes /* pool */,
728
int (*AugmentAttributes)(
729
struct _XpContext * /* pContext */,
730
XPAttributes /* pool */,
732
int (*GetMediumDimensions)(
733
struct _XpContext * /* pPrintContext */,
734
CARD16 * /* pWidth */,
735
CARD16 * /* pHeight */);
736
int (*GetReproducibleArea)(
737
struct _XpContext * /* pPrintContext */,
738
xRectangle * /* pRect */);
739
int (*SetImageResolution)(
740
struct _XpContext * /* pPrintContext */,
742
Bool * /* pStatus */);
743
} XpDriverFuncs, *XpDriverFuncsPtr;
746
* Each print context is represented by one of the following structs
747
* associated with a resource ID of type RTcontext . A pointer to
748
* the context is placed in the Xp extension's devPrivates
749
* element in each client * which establishes a context via
750
* either initContext or setContext.
751
* The context pointer is also placed in the struct indicated by the
752
* RTpage resource associated with each StartPage'd window.
754
typedef struct _XpContext {
757
int screenNum; /* screen containing the printer */
758
struct _XpClient *clientHead; /* list of clients */
761
DevUnion *devPrivates;
763
ClientPtr clientSlept;
765
} XpContextRec, *XpContextPtr;
767
#include "fontstruct.h" /* FontResolutionPtr */
769
extern Bool XpAllocateContextPrivate(int, unsigned);
770
extern FontResolutionPtr XpGetClientResolutions(ClientPtr, int *);
771
extern XpContextPtr XpContextOfClient(ClientPtr);
772
extern XpContextPtr XpGetPrintContext(ClientPtr);
773
extern int XpAllocateContextPrivateIndex(void);
774
extern int XpRehashPrinterList(void);
775
extern void XpSetFontResFunc(ClientPtr);
776
extern void XpUnsetFontResFunc(ClientPtr);
777
extern void XpRegisterInitFunc(ScreenPtr, char *, int (*)(struct _XpContext *));
779
#endif /* _XP_PRINT_SERVER_ */
783
#endif /* _XpPrintstr_H_ */