summaryrefslogtreecommitdiff
path: root/Print.h
blob: 2d45082c5b7c862571a2f01c480b8c753175fefe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
/* $Xorg: Print.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */
/******************************************************************************
 ******************************************************************************
 **
 ** File:         Print.h
 **
 ** Description:  Definitions needed by the server, library, and
 **               clients.  Subportion restricted to library and
 **               clients.
 **
 **               Server, Library, Client portion has:
 **                  o All sz_* defines
 **                  o Revision and Name defines
 **                  o Common defines and constants (e.g. Keywords, Masks)
 **                  o Extension version structure
 **               
 **               Library and client subportion has:
 **                  o Convience Marcos
 **                  o Client side data structures
 **                  o Client side event structures (non wire)
 **                  o Library function prototypes
 **                  o some private stuff denoted with _whatever
 **
 **               Printstr.h for server and library, but NOT clients.
 **
 ******************************************************************************
 **
 ** (c) Copyright 1996 Hewlett-Packard Company
 ** (c) Copyright 1996 International Business Machines Corp.
 ** (c) Copyright 1996 Sun Microsystems, Inc.
 ** (c) Copyright 1996 Novell, Inc.
 ** (c) Copyright 1996 Digital Equipment Corp.
 ** (c) Copyright 1996 Fujitsu Limited
 ** (c) Copyright 1996 Hitachi, Ltd.
 ** 
 ** Permission is hereby granted, free of charge, to any person obtaining a copy
 ** of this software and associated documentation files (the "Software"), to deal
 ** in the Software without restriction, including without limitation the rights
 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 ** copies of the Software, and to permit persons to whom the Software is
 ** furnished to do so, subject to the following conditions:
 **
 ** The above copyright notice and this permission notice shall be included in
 ** all copies or substantial portions of the Software.
 **
 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 **
 ** Except as contained in this notice, the names of the copyright holders shall
 ** not be used in advertising or otherwise to promote the sale, use or other
 ** dealings in this Software without prior written authorization from said
 ** copyright holders.
 **
 ******************************************************************************
 *****************************************************************************/
/* $XFree86: xc/include/extensions/Print.h,v 1.4 2000/01/25 18:37:31 dawes Exp $ */

#ifndef _XpPrint_H_
#define _XpPrint_H_

#ifndef _XP_PRINT_SERVER_
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xauth.h>
#endif /* _XP_PRINT_SERVER_ */

#include <X11/Xfuncproto.h>

_XFUNCPROTOBEGIN

/******************************************************************************
 *
 * Definitions used by the server, library and client.
 */

/********************************************************************
 *
 * Naming and versioning information.
 */
#define XP_PRINTNAME  "XpExtension"

/*
 * Add a define below for each major extension release.
 */
#define XP_DONT_CHECK		0
#define XP_INITIAL_RELEASE	1

/*
 * For each single entry above, create one major/minor pair.
 */
#define XP_PROTO_MAJOR		1
#define XP_PROTO_MINOR		0

/*
 * Identify current version.
 */
#define XP_MAJOR_VERSION	XP_PROTO_MAJOR
#define XP_MINOR_VERSION	XP_PROTO_MINOR

/*
 * Misc version defines.
 */
#define XP_ABSENT		0	/* Prior to XP Print support */
#define XP_PRESENT		1	/* With XP Print support */

/********************************************************************
 *
 * Xp Print Error codes.
 */
#define XP_ERRORS		3	/* number of error types */

#define XPBadContext		0	/* Print Context invalid or missing */
#define XPBadSequence		1	/* Illegal sequence of XP operations */
#define XPBadResourceID		2	/* X-resource not valid */

/********************************************************************
 *
 * Xp Print Event masks and codes.
 *
 */
#define XP_EVENTS		2	/* number of event types */

#define XPNoEventMask		0	/* not an event - just a null mask */
#define XPPrintMask		(1L<<0)
#define XPAttributeMask		(1L<<1)

#define XPPrintNotify		0	/* contains "detail" - see below */
#define XPAttributeNotify	1	/* contains "detail" - see below */

#define XPStartJobNotify	0	/* value for "detail" in XPPrintNotify*/
#define XPEndJobNotify		1
#define XPStartDocNotify	2
#define XPEndDocNotify		3
#define XPStartPageNotify	4
#define XPEndPageNotify		5

/********************************************************************
 *
 * Xp Print Attribute Object codes (subset of ISO DPA 10175).  The
 * Xp Server can get and set any of the values, while the Xp Library
 * may only be able to set a subset of the attribute objects.
 *
 * note: the codes are also used as "detail" for XPAttributeNotify
 *
 * note: XPPageAttr is not defined in ISO DPA 10175.  It is unique
 * to Xp, and its attributes are a proper subset of XPDocAttr.
 */
typedef unsigned char XPAttributes;	/* type of Xp*Attr codes */

#define XP_ATTRIBUTES		5	/* those attrs currently supported */

#define XPJobAttr		1	/* get/set */
#define XPDocAttr		2	/* get/set */
#define XPPageAttr		3	/* get/set - subset of XPDocAttr */
#define XPPrinterAttr		4	/* get only (library) */
#define XPServerAttr		5	/* get only (library), no
					   context needed */

/*
 * note: ISO DPA 10175 defines a number of "attribute objects", of
 *       which POSIX 1387.4 and the SI Xp will only support a
 *       subset.
 */
#define XPMediumAttr		6	/* DPA-Object Medium */
#define XPFontAttr		7	/* DPA-Object Font */
#define XPResAttr		8	/* DPA-Object Resource */
#define XPTransAttr		9	/* DPA-Object Transfer method */
#define XPDelAttr		10	/* DPA-Object Delivery method */
#define XPAuxSPkg		11	/* DPA-Object Auxiliary sheet package */
#define XPAuxS			12	/* DPA-Object Auxiliary sheet */
#define XPFinishAttr		13	/* DPA-Object Finishing */
#define XPOutputAttr		14	/* DPA-Object Output method */
#define XPImpAttr		15	/* DPA-Object Imposition */
#define XPSchedAttr		16	/* DPA-Object Scheduler */
#define XPIntJobAttr		17	/* DPA-Object Initial value job */
#define XPIntDocAttr		18	/* DPA-Object Initial value document */
#define XPResConAttr		19	/* DPA-Object Resource context */


/*
 * Replacement rules for XpSetAttributes
 */
typedef unsigned char XPAttrReplacement;
#define	XPAttrReplace		1
#define XPAttrMerge		2


/*
 * Return codes for XpGetDocumentData
 */
typedef unsigned char XPGetDocStatus;
#define XPGetDocFinished	0	/* normal termination */
#define XPGetDocSecondConsumer	1	/* setup error */
#define XPGetDocError		2	/* runtime error, see generated error */


/*
 * Save data types for XpStartJob.
 */
typedef unsigned char XPSaveData;
#define XPSpool			1	/* Job data sent to spooler */
#define XPGetData		2	/* Job data via XpGetDocumentData */


/*
 * Document types for XpStartDoc.
 */
typedef unsigned char XPDocumentType;
#define	XPDocNormal		1	/* Doc data handled by Xserver */
#define	XPDocRaw		2	/* Doc data passed through Xserver */


/********************************************************************
 *
 * Xp Print Property Names
 */


#ifndef _XP_PRINT_SERVER_

/******************************************************************************
 *
 * Definitions used by the library and clients only.
 */

/*******************************************************************
 *
 * General API defines and such.
 */

/*
 * Print Context for XpInitContext and related calls.
 */
typedef XID XPContext;

/*
 * Struct for XpGetPrinterList.
 */
typedef struct {
    char	*name;		/* name */
    char	*desc;		/* localized description */
} XPPrinterRec, *XPPrinterList;

/*
 * Typedefs for XpGetDocumentData
 */
typedef void (*XPSaveProc)( Display *display,
                            XPContext context,
                            unsigned char *data,
                            unsigned int data_len,
                            XPointer client_data);

typedef void (*XPFinishProc)( Display *display,
                              XPContext context,
                              XPGetDocStatus status,
                              XPointer client_data);

/*
 * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter
 */
typedef char * (*XPHinterProc)(void);

#if 0
/*******************************************************************
 *
 * Extension version structures.
 *
 **** this structure is now defined localy in the one file that uses it
 **** in order to avoid clashes with its definition in XI.h
 */
typedef struct {
        int     present;
        short   major_version;
        short   minor_version;
} XExtensionVersion;
#endif

/********************************************************************
 *
 * Event structs for clients.
 *
 * note: these events are relative to a print context, and
 * not to a window as in core X.
 */
typedef struct {
    int            type;       /* base + XPPrintNotify */
    unsigned long  serial;     /* # of last request processed by server */
    Bool           send_event; /* true if from a SendEvent request */
    Display        *display;   /* Display the event was read from */
    XPContext      context;    /* print context where operation was requested */
    Bool           cancel;     /* was detailed event canceled */
    int            detail;     /* XPStartJobNotify, XPEndJobNotify,
                                  XPStartDocNotify, XPEndDocNotify,
                                  XPStartPageNotify, XPEndPageNotify */
} XPPrintEvent;

typedef struct {
    int            type;       /* base + XPAttributeNotify */
    unsigned long  serial;     /* # of last request processed by server */
    Bool           send_event; /* true if from a SendEvent request */
    Display        *display;   /* Display the event was read from */
    XPContext      context;    /* print context where operation was requested */
    int            detail;     /* XPJobAttr, XPDocAttr, XPPageAttr,
                                  XPPrinterAttr, XPSpoolerAttr,
                                  XPMediumAttr, XPServerAttr */
} XPAttributeEvent;

typedef struct {
    int            type;       /* base + XPDataReadyNotify */
    unsigned long  serial;     /* # of last request processed by server */
    Bool           send_event; /* true if from a SendEvent request */
    Display        *display;   /* Display the event was read from */
    XPContext      context;    /* print context where operation was requested */
    unsigned long  available;  /* bytes available for retrieval */
} XPDataReadyEvent;


/**********************************************************
 *
 * Function prototypes for library side.
 */

extern XPContext XpCreateContext (
    Display		*display,
    char		*printer_name
);

extern void XpSetContext (
    Display		*display,
    XPContext     	print_context
);

extern XPContext XpGetContext (
    Display		*display
);

extern void XpDestroyContext (
    Display		*display,
    XPContext     	print_context
);

extern Screen *XpGetScreenOfContext (
    Display		*display,
    XPContext     	print_context
);

extern Status XpGetPageDimensions (
    Display		*display,
    XPContext     	print_context,
    unsigned short	*width,			/* return value */
    unsigned short	*height,		/* return value */
    XRectangle		*reproducible_area	/* return value */
);

extern void XpStartJob (
    Display		*display,
    XPSaveData		save_data
);

extern void XpEndJob (
    Display		*display
);

extern void XpCancelJob (
    Display		*display,
    Bool		discard
);

extern void XpStartDoc (
    Display		*display,
    XPDocumentType	type
);

extern void XpEndDoc (
    Display		*display
);

extern void XpCancelDoc (
    Display		*display,
    Bool		discard
);

extern void XpPutDocumentData (
    Display		*display,
    Drawable		drawable,
    unsigned char	*data,
    int			data_len,
    char		*doc_fmt,
    char		*options
);

extern Status XpGetDocumentData (
    Display		*display,
    XPContext		context,
    XPSaveProc		save_proc,
    XPFinishProc	finish_proc,
    XPointer		client_data
);

extern void XpStartPage (
    Display		*display,
    Window		window
);

extern void XpEndPage (
    Display		*display
);

extern void XpCancelPage (
    Display		*display,
    Bool		discard
);

extern void XpSelectInput (
    Display		*display,
    XPContext     	print_context,
    unsigned long	event_mask
);

extern unsigned long XpInputSelected (
    Display		*display,
    XPContext     	print_context,
    unsigned long	*all_events_mask
);

extern Bool XpSetImageResolution (
    Display		*display,
    XPContext     	print_context,
    int			image_res,
    int			*prev_res
);

extern int XpGetImageResolution (
    Display		*display,
    XPContext     	print_context
);

extern char *XpGetAttributes (
    Display		*display,
    XPContext     	print_context,
    XPAttributes	type
);

extern void XpSetAttributes (
    Display		*display,
    XPContext     	print_context,
    XPAttributes	type,
    char		*pool,
    XPAttrReplacement	replacement_rule
);

extern char *XpGetOneAttribute (
    Display		*display,
    XPContext     	print_context,
    XPAttributes	type,
    char		*attribute_name
);

extern XPPrinterList XpGetPrinterList (
    Display		*display,
    char		*printer_name,
    int			*list_count		/* return value */
);

extern void XpFreePrinterList (
    XPPrinterList	printer_list
);

extern void XpRehashPrinterList (
    Display		*display
);

extern Status XpQueryVersion (
    Display		*display,
    short		*major_version,		/* return value */
    short		*minor_version		/* return value */
);

extern Bool XpQueryExtension (
    Display		*display,
    int			*event_base_return,	/* return value */
    int			*error_base_return	/* return value */
);

extern Screen **XpQueryScreens (
    Display		*display,
    int			*list_count		/* return value */
);

extern Status XpGetPdmStartParams (
    Display		*print_display,
    Window		print_window,
    XPContext		print_context,
    Display		*video_display,
    Window		video_window,
    Display		**selection_display,	/* return value */
    Atom		*selection,		/* return value */
    Atom		*type,			/* return value */
    int			*format,		/* return value */
    unsigned char	**data,			/* return value */
    int			*nelements		/* return value */
);

extern Status XpGetAuthParams (
    Display		*print_display,
    Display		*video_display,
    Display		**selection_display,	/* return value */
    Atom		*selection,		/* return value */
    Atom		*target			/* return value */
);

extern Status XpSendAuth (
    Display		*display,
    Window		window
);

extern Status XpSendOneTicket (
    Display		*display,
    Window		window,
    Xauth		*ticket,
    Bool		more
);

extern void XpSetLocaleHinter (
    XPHinterProc hinter_proc,
    char         *hinter_desc
);

extern char *XpGetLocaleHinter (
    XPHinterProc *hinter_proc
);

extern char *XpGetLocaleNetString(void);

extern char *XpNotifyPdm (
    Display		*print_display,
    Window		print_window,
    XPContext     	print_context,
    Display		*video_display,
    Window		video_window,
    Bool		auth_flag
);

#endif /* _XP_PRINT_SERVER_ */

_XFUNCPROTOEND

#endif /* _XpPrint_H_ */