]> git.sesse.net Git - rdpsrv/blob - Xserver/include/extensions/Print.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / include / extensions / Print.h
1 /* $XConsortium: Print.h /main/3 1996/12/10 14:59:02 rws $ */
2 /******************************************************************************
3  ******************************************************************************
4  **
5  ** File:         Print.h
6  **
7  ** Description:  Definitions needed by the server, library, and
8  **               clients.  Subportion restricted to library and
9  **               clients.
10  **
11  **               Server, Library, Client portion has:
12  **                  o All sz_* defines
13  **                  o Revision and Name defines
14  **                  o Common defines and constants (e.g. Keywords, Masks)
15  **                  o Extension version structure
16  **               
17  **               Library and client subportion has:
18  **                  o Convience Marcos
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
23  **
24  **               Printstr.h for server and library, but NOT clients.
25  **
26  ******************************************************************************
27  **
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.
35  ** 
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:
42  **
43  ** The above copyright notice and this permission notice shall be included in
44  ** all copies or substantial portions of the Software.
45  **
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.
52  **
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
56  ** copyright holders.
57  **
58  ******************************************************************************
59  *****************************************************************************/
60
61 #ifndef _XpPrint_H_
62 #define _XpPrint_H_
63
64 #ifndef _XP_PRINT_SERVER_
65 #include <X11/Xlib.h>
66 #include <X11/Xresource.h>
67 #include <X11/Xauth.h>
68 #endif /* _XP_PRINT_SERVER_ */
69
70 #include <X11/Xfuncproto.h>
71
72 _XFUNCPROTOBEGIN
73
74 /******************************************************************************
75  *
76  * Definitions used by the server, library and client.
77  */
78
79 /********************************************************************
80  *
81  * Naming and versioning information.
82  */
83 #define XP_PRINTNAME  "XpExtension"
84
85 /*
86  * Add a define below for each major extension release.
87  */
88 #define XP_DONT_CHECK           0
89 #define XP_INITIAL_RELEASE      1
90
91 /*
92  * For each single entry above, create one major/minor pair.
93  */
94 #define XP_PROTO_MAJOR          1
95 #define XP_PROTO_MINOR          0
96
97 /*
98  * Identify current version.
99  */
100 #define XP_MAJOR_VERSION        XP_PROTO_MAJOR
101 #define XP_MINOR_VERSION        XP_PROTO_MINOR
102
103 /*
104  * Misc version defines.
105  */
106 #define XP_ABSENT               0       /* Prior to XP Print support */
107 #define XP_PRESENT              1       /* With XP Print support */
108
109 /********************************************************************
110  *
111  * Xp Print Error codes.
112  */
113 #define XP_ERRORS               3       /* number of error types */
114
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 */
118
119 /********************************************************************
120  *
121  * Xp Print Event masks and codes.
122  *
123  */
124 #define XP_EVENTS               2       /* number of event types */
125
126 #define XPNoEventMask           0       /* not an event - just a null mask */
127 #define XPPrintMask             (1L<<0)
128 #define XPAttributeMask         (1L<<1)
129
130 #define XPPrintNotify           0       /* contains "detail" - see below */
131 #define XPAttributeNotify       1       /* contains "detail" - see below */
132
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
139
140 /********************************************************************
141  *
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.
145  *
146  * note: the codes are also used as "detail" for XPAttributeNotify
147  *
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.
150  */
151 typedef unsigned char XPAttributes;     /* type of Xp*Attr codes */
152
153 #define XP_ATTRIBUTES           5       /* those attrs currently supported */
154
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
160                                            context needed */
161
162 /*
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
165  *       subset.
166  */
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 */
181
182
183 /*
184  * Replacement rules for XpSetAttributes
185  */
186 typedef unsigned char XPAttrReplacement;
187 #define XPAttrReplace           1
188 #define XPAttrMerge             2
189
190
191 /*
192  * Return codes for XpGetDocumentData
193  */
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 */
198
199
200 /*
201  * Save data types for XpStartJob.
202  */
203 typedef unsigned char XPSaveData;
204 #define XPSpool                 1       /* Job data sent to spooler */
205 #define XPGetData               2       /* Job data via XpGetDocumentData */
206
207
208 /*
209  * Document types for XpStartDoc.
210  */
211 typedef unsigned char XPDocumentType;
212 #define XPDocNormal             1       /* Doc data handled by Xserver */
213 #define XPDocRaw                2       /* Doc data passed through Xserver */
214
215
216 /********************************************************************
217  *
218  * Xp Print Property Names
219  */
220
221
222 #ifndef _XP_PRINT_SERVER_
223
224 /******************************************************************************
225  *
226  * Definitions used by the library and clients only.
227  */
228
229 /*******************************************************************
230  *
231  * General API defines and such.
232  */
233
234 /*
235  * Print Context for XpInitContext and related calls.
236  */
237 typedef XID XPContext;
238
239 /*
240  * Struct for XpGetPrinterList.
241  */
242 typedef struct {
243     char        *name;          /* name */
244     char        *desc;          /* localized description */
245 } XPPrinterRec, *XPPrinterList;
246
247 /*
248  * Typedefs for XpGetDocumentData
249  */
250 typedef void (*XPSaveProc)( Display *display,
251                             XPContext context,
252                             unsigned char *data,
253                             unsigned int data_len,
254                             XPointer client_data);
255
256 typedef void (*XPFinishProc)( Display *display,
257                               XPContext context,
258                               XPGetDocStatus status,
259                               XPointer client_data);
260
261 /*
262  * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter
263  */
264 typedef char * (*XPHinterProc)();
265
266 /*******************************************************************
267  *
268  * Extension version structures.
269  *
270  */
271 typedef struct {
272         int     present;
273         short   major_version;
274         short   minor_version;
275 } XExtensionVersion;
276
277 /********************************************************************
278  *
279  * Event structs for clients.
280  *
281  * note: these events are relative to a print context, and
282  * not to a window as in core X.
283  */
284 typedef struct {
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 */
294 } XPPrintEvent;
295
296 typedef struct {
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 */
305 } XPAttributeEvent;
306
307 typedef struct {
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 */
314 } XPDataReadyEvent;
315
316
317 /**********************************************************
318  *
319  * Function prototypes for library side.
320  */
321
322 #if NeedFunctionPrototypes
323
324 extern XPContext XpCreateContext (
325     Display             *display,
326     char                *printer_name
327 );
328
329 extern void XpSetContext (
330     Display             *display,
331     XPContext           print_context
332 );
333
334 extern XPContext XpGetContext (
335     Display             *display
336 );
337
338 extern void XpDestroyContext (
339     Display             *display,
340     XPContext           print_context
341 );
342
343 extern Screen *XpGetScreenOfContext (
344     Display             *display,
345     XPContext           print_context
346 );
347
348 extern Status XpGetPageDimensions (
349     Display             *display,
350     XPContext           print_context,
351     unsigned short      *width,                 /* return value */
352     unsigned short      *height,                /* return value */
353     XRectangle          *reproducible_area      /* return value */
354 );
355
356 extern void XpStartJob (
357     Display             *display,
358     XPSaveData          save_data
359 );
360
361 extern void XpEndJob (
362     Display             *display
363 );
364
365 extern void XpCancelJob (
366     Display             *display,
367     Bool                discard
368 );
369
370 extern void XpStartDoc (
371     Display             *display,
372     XPDocumentType      type
373 );
374
375 extern void XpEndDoc (
376     Display             *display
377 );
378
379 extern void XpCancelDoc (
380     Display             *display,
381     Bool                discard
382 );
383
384 extern void XpPutDocumentData (
385     Display             *display,
386     Drawable            drawable,
387     unsigned char       *data,
388     int                 data_len,
389     char                *doc_fmt,
390     char                *options
391 );
392
393 extern Status XpGetDocumentData (
394     Display             *display,
395     XPContext           context,
396     XPSaveProc          save_proc,
397     XPFinishProc        finish_proc,
398     XPointer            client_data
399 );
400
401 extern void XpStartPage (
402     Display             *display,
403     Window              window
404 );
405
406 extern void XpEndPage (
407     Display             *display
408 );
409
410 extern void XpCancelPage (
411     Display             *display,
412     Bool                discard
413 );
414
415 extern void XpSelectInput (
416     Display             *display,
417     XPContext           print_context,
418     unsigned long       event_mask
419 );
420
421 extern unsigned long XpInputSelected (
422     Display             *display,
423     XPContext           print_context,
424     unsigned long       *all_events_mask
425 );
426
427 extern Bool XpSetImageResolution (
428     Display             *display,
429     XPContext           print_context,
430     int                 image_res,
431     int                 *prev_res
432 );
433
434 extern int XpGetImageResolution (
435     Display             *display,
436     XPContext           print_context
437 );
438
439 extern char *XpGetAttributes (
440     Display             *display,
441     XPContext           print_context,
442     XPAttributes        type
443 );
444
445 extern void XpSetAttributes (
446     Display             *display,
447     XPContext           print_context,
448     XPAttributes        type,
449     char                *pool,
450     XPAttrReplacement   replacement_rule
451 );
452
453 extern char *XpGetOneAttribute (
454     Display             *display,
455     XPContext           print_context,
456     XPAttributes        type,
457     char                *attribute_name
458 );
459
460 extern XPPrinterList XpGetPrinterList (
461     Display             *display,
462     char                *printer_name,
463     int                 *list_count             /* return value */
464 );
465
466 extern void XpFreePrinterList (
467     XPPrinterList       printer_list
468 );
469
470 extern void XpRehashPrinterList (
471     Display             *display
472 );
473
474 extern Status XpQueryVersion (
475     Display             *display,
476     short               *major_version,         /* return value */
477     short               *minor_version          /* return value */
478 );
479
480 extern Bool XpQueryExtension (
481     Display             *display,
482     int                 *event_base_return,     /* return value */
483     int                 *error_base_return      /* return value */
484 );
485
486 extern Screen **XpQueryScreens (
487     Display             *display,
488     int                 *list_count             /* return value */
489 );
490
491 extern Status XpGetPdmStartParams (
492     Display             *print_display,
493     Window              print_window,
494     XPContext           print_context,
495     Display             *video_display,
496     Window              video_window,
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 */
503 );
504
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 */
511 );
512
513 extern Status XpSendAuth (
514     Display             *display,
515     Window              window
516 );
517
518 extern Status XpSendOneTicket (
519     Display             *display,
520     Window              window,
521     Xauth               *ticket,
522     Bool                more
523 );
524
525 extern void XpSetLocaleHinter (
526     XPHinterProc hinter_proc,
527     char         *hinter_desc
528 );
529
530 extern char *XpGetLocaleHinter (
531     XPHinterProc *hinter_proc
532 );
533
534
535
536
537 extern char *XpGetLocaleNetString();
538
539 extern char *XpNotifyPdm (
540     Display             *print_display,
541     Window              print_window,
542     XPContext           print_context,
543     Display             *video_display,
544     Window              video_window,
545     Bool                auth_flag
546 );
547
548 #else
549
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 ();
586
587 extern char *XpGetLocaleNetString ();
588 extern char *XpNotifyPdm ();
589
590 #endif /* NeedFunctionPrototypes */
591
592 #endif /* _XP_PRINT_SERVER_ */
593
594 _XFUNCPROTOEND
595
596 #endif /* _XpPrint_H_ */