1/* $Xorg: Print.h,v 1.3 2000/08/18 04:05:44 coskrey Exp $ */ 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 Convenience Macros 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, Oracle and/or its affiliates. 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/* $XFree86: xc/include/extensions/Print.h,v 1.4 2000/01/25 18:37:31 dawes Exp $ */ 61 62#ifndef _XpPrint_H_ 63#define _XpPrint_H_ 64 65#ifndef _XP_PRINT_SERVER_ 66#include <X11/Xlib.h> 67#include <X11/Xresource.h> 68#include <X11/Xauth.h> 69#endif /* _XP_PRINT_SERVER_ */ 70 71#include <X11/Xfuncproto.h> 72 73_XFUNCPROTOBEGIN 74 75/****************************************************************************** 76 * 77 * Definitions used by the server, library and client. 78 */ 79 80/******************************************************************** 81 * 82 * Naming and versioning information. 83 */ 84#define XP_PRINTNAME "XpExtension" 85 86/* 87 * Add a define below for each major extension release. 88 */ 89#define XP_DONT_CHECK 0 90#define XP_INITIAL_RELEASE 1 91 92/* 93 * For each single entry above, create one major/minor pair. 94 */ 95#define XP_PROTO_MAJOR 1 96#define XP_PROTO_MINOR 0 97 98/* 99 * Identify current version. 100 */ 101#define XP_MAJOR_VERSION XP_PROTO_MAJOR 102#define XP_MINOR_VERSION XP_PROTO_MINOR 103 104/* 105 * Misc version defines. 106 */ 107#define XP_ABSENT 0 /* Prior to XP Print support */ 108#define XP_PRESENT 1 /* With XP Print support */ 109 110/******************************************************************** 111 * 112 * Xp Print Error codes. 113 */ 114#define XP_ERRORS 3 /* number of error types */ 115 116#define XPBadContext 0 /* Print Context invalid or missing */ 117#define XPBadSequence 1 /* Illegal sequence of XP operations */ 118#define XPBadResourceID 2 /* X-resource not valid */ 119 120/******************************************************************** 121 * 122 * Xp Print Event masks and codes. 123 * 124 */ 125#define XP_EVENTS 2 /* number of event types */ 126 127#define XPNoEventMask 0 /* not an event - just a null mask */ 128#define XPPrintMask (1L<<0) 129#define XPAttributeMask (1L<<1) 130 131#define XPPrintNotify 0 /* contains "detail" - see below */ 132#define XPAttributeNotify 1 /* contains "detail" - see below */ 133 134#define XPStartJobNotify 0 /* value for "detail" in XPPrintNotify*/ 135#define XPEndJobNotify 1 136#define XPStartDocNotify 2 137#define XPEndDocNotify 3 138#define XPStartPageNotify 4 139#define XPEndPageNotify 5 140 141/******************************************************************** 142 * 143 * Xp Print Attribute Object codes (subset of ISO DPA 10175). The 144 * Xp Server can get and set any of the values, while the Xp Library 145 * may only be able to set a subset of the attribute objects. 146 * 147 * note: the codes are also used as "detail" for XPAttributeNotify 148 * 149 * note: XPPageAttr is not defined in ISO DPA 10175. It is unique 150 * to Xp, and its attributes are a proper subset of XPDocAttr. 151 */ 152typedef unsigned char XPAttributes; /* type of Xp*Attr codes */ 153 154#define XP_ATTRIBUTES 5 /* those attrs currently supported */ 155 156#define XPJobAttr 1 /* get/set */ 157#define XPDocAttr 2 /* get/set */ 158#define XPPageAttr 3 /* get/set - subset of XPDocAttr */ 159#define XPPrinterAttr 4 /* get only (library) */ 160#define XPServerAttr 5 /* get only (library), no 161 context needed */ 162 163/* 164 * note: ISO DPA 10175 defines a number of "attribute objects", of 165 * which POSIX 1387.4 and the SI Xp will only support a 166 * subset. 167 */ 168#define XPMediumAttr 6 /* DPA-Object Medium */ 169#define XPFontAttr 7 /* DPA-Object Font */ 170#define XPResAttr 8 /* DPA-Object Resource */ 171#define XPTransAttr 9 /* DPA-Object Transfer method */ 172#define XPDelAttr 10 /* DPA-Object Delivery method */ 173#define XPAuxSPkg 11 /* DPA-Object Auxiliary sheet package */ 174#define XPAuxS 12 /* DPA-Object Auxiliary sheet */ 175#define XPFinishAttr 13 /* DPA-Object Finishing */ 176#define XPOutputAttr 14 /* DPA-Object Output method */ 177#define XPImpAttr 15 /* DPA-Object Imposition */ 178#define XPSchedAttr 16 /* DPA-Object Scheduler */ 179#define XPIntJobAttr 17 /* DPA-Object Initial value job */ 180#define XPIntDocAttr 18 /* DPA-Object Initial value document */ 181#define XPResConAttr 19 /* DPA-Object Resource context */ 182 183 184/* 185 * Replacement rules for XpSetAttributes 186 */ 187typedef unsigned char XPAttrReplacement; 188#define XPAttrReplace 1 189#define XPAttrMerge 2 190 191 192/* 193 * Return codes for XpGetDocumentData 194 */ 195typedef unsigned char XPGetDocStatus; 196#define XPGetDocFinished 0 /* normal termination */ 197#define XPGetDocSecondConsumer 1 /* setup error */ 198#define XPGetDocError 2 /* runtime error, see generated error */ 199 200 201/* 202 * Save data types for XpStartJob. 203 */ 204typedef unsigned char XPSaveData; 205#define XPSpool 1 /* Job data sent to spooler */ 206#define XPGetData 2 /* Job data via XpGetDocumentData */ 207 208 209/* 210 * Document types for XpStartDoc. 211 */ 212typedef unsigned char XPDocumentType; 213#define XPDocNormal 1 /* Doc data handled by Xserver */ 214#define XPDocRaw 2 /* Doc data passed through Xserver */ 215 216 217/******************************************************************** 218 * 219 * Xp Print Property Names 220 */ 221 222 223#ifndef _XP_PRINT_SERVER_ 224 225/****************************************************************************** 226 * 227 * Definitions used by the library and clients only. 228 */ 229 230/******************************************************************* 231 * 232 * General API defines and such. 233 */ 234 235/* 236 * Print Context for XpInitContext and related calls. 237 */ 238typedef XID XPContext; 239 240/* 241 * Struct for XpGetPrinterList. 242 */ 243typedef struct { 244 char *name; /* name */ 245 char *desc; /* localized description */ 246} XPPrinterRec, *XPPrinterList; 247 248/* 249 * Typedefs for XpGetDocumentData 250 */ 251typedef void (*XPSaveProc)( Display *display, 252 XPContext context, 253 unsigned char *data, 254 unsigned int data_len, 255 XPointer client_data); 256 257typedef void (*XPFinishProc)( Display *display, 258 XPContext context, 259 XPGetDocStatus status, 260 XPointer client_data); 261 262/* 263 * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter 264 */ 265typedef char * (*XPHinterProc)(void); 266 267#if 0 268/******************************************************************* 269 * 270 * Extension version structures. 271 * 272 **** this structure is now defined locally in the one file that uses it 273 **** in order to avoid clashes with its definition in XI.h 274 */ 275typedef struct { 276 int present; 277 short major_version; 278 short minor_version; 279} XExtensionVersion; 280#endif 281 282/******************************************************************** 283 * 284 * Event structs for clients. 285 * 286 * note: these events are relative to a print context, and 287 * not to a window as in core X. 288 */ 289typedef struct { 290 int type; /* base + XPPrintNotify */ 291 unsigned long serial; /* # of last request processed by server */ 292 Bool send_event; /* true if from a SendEvent request */ 293 Display *display; /* Display the event was read from */ 294 XPContext context; /* print context where operation was requested */ 295 Bool cancel; /* was detailed event canceled */ 296 int detail; /* XPStartJobNotify, XPEndJobNotify, 297 XPStartDocNotify, XPEndDocNotify, 298 XPStartPageNotify, XPEndPageNotify */ 299} XPPrintEvent; 300 301typedef struct { 302 int type; /* base + XPAttributeNotify */ 303 unsigned long serial; /* # of last request processed by server */ 304 Bool send_event; /* true if from a SendEvent request */ 305 Display *display; /* Display the event was read from */ 306 XPContext context; /* print context where operation was requested */ 307 int detail; /* XPJobAttr, XPDocAttr, XPPageAttr, 308 XPPrinterAttr, XPSpoolerAttr, 309 XPMediumAttr, XPServerAttr */ 310} XPAttributeEvent; 311 312typedef struct { 313 int type; /* base + XPDataReadyNotify */ 314 unsigned long serial; /* # of last request processed by server */ 315 Bool send_event; /* true if from a SendEvent request */ 316 Display *display; /* Display the event was read from */ 317 XPContext context; /* print context where operation was requested */ 318 unsigned long available; /* bytes available for retrieval */ 319} XPDataReadyEvent; 320 321 322/********************************************************** 323 * 324 * Function prototypes for library side. 325 */ 326 327extern XPContext XpCreateContext ( 328 Display *display, 329 char *printer_name 330); 331 332extern void XpSetContext ( 333 Display *display, 334 XPContext print_context 335); 336 337extern XPContext XpGetContext ( 338 Display *display 339); 340 341extern void XpDestroyContext ( 342 Display *display, 343 XPContext print_context 344); 345 346extern Screen *XpGetScreenOfContext ( 347 Display *display, 348 XPContext print_context 349); 350 351extern Status XpGetPageDimensions ( 352 Display *display, 353 XPContext print_context, 354 unsigned short *width, /* return value */ 355 unsigned short *height, /* return value */ 356 XRectangle *reproducible_area /* return value */ 357); 358 359extern void XpStartJob ( 360 Display *display, 361 XPSaveData save_data 362); 363 364extern void XpEndJob ( 365 Display *display 366); 367 368extern void XpCancelJob ( 369 Display *display, 370 Bool discard 371); 372 373extern void XpStartDoc ( 374 Display *display, 375 XPDocumentType type 376); 377 378extern void XpEndDoc ( 379 Display *display 380); 381 382extern void XpCancelDoc ( 383 Display *display, 384 Bool discard 385); 386 387extern void XpPutDocumentData ( 388 Display *display, 389 Drawable drawable, 390 unsigned char *data, 391 int data_len, 392 char *doc_fmt, 393 char *options 394); 395 396extern Status XpGetDocumentData ( 397 Display *display, 398 XPContext context, 399 XPSaveProc save_proc, 400 XPFinishProc finish_proc, 401 XPointer client_data 402); 403 404extern void XpStartPage ( 405 Display *display, 406 Window window 407); 408 409extern void XpEndPage ( 410 Display *display 411); 412 413extern void XpCancelPage ( 414 Display *display, 415 Bool discard 416); 417 418extern void XpSelectInput ( 419 Display *display, 420 XPContext print_context, 421 unsigned long event_mask 422); 423 424extern unsigned long XpInputSelected ( 425 Display *display, 426 XPContext print_context, 427 unsigned long *all_events_mask 428); 429 430extern Bool XpSetImageResolution ( 431 Display *display, 432 XPContext print_context, 433 int image_res, 434 int *prev_res 435); 436 437extern int XpGetImageResolution ( 438 Display *display, 439 XPContext print_context 440); 441 442extern char *XpGetAttributes ( 443 Display *display, 444 XPContext print_context, 445 XPAttributes type 446); 447 448extern void XpSetAttributes ( 449 Display *display, 450 XPContext print_context, 451 XPAttributes type, 452 char *pool, 453 XPAttrReplacement replacement_rule 454); 455 456extern char *XpGetOneAttribute ( 457 Display *display, 458 XPContext print_context, 459 XPAttributes type, 460 char *attribute_name 461); 462 463extern XPPrinterList XpGetPrinterList ( 464 Display *display, 465 char *printer_name, 466 int *list_count /* return value */ 467); 468 469extern void XpFreePrinterList ( 470 XPPrinterList printer_list 471); 472 473extern void XpRehashPrinterList ( 474 Display *display 475); 476 477extern Status XpQueryVersion ( 478 Display *display, 479 short *major_version, /* return value */ 480 short *minor_version /* return value */ 481); 482 483extern Bool XpQueryExtension ( 484 Display *display, 485 int *event_base_return, /* return value */ 486 int *error_base_return /* return value */ 487); 488 489extern Screen **XpQueryScreens ( 490 Display *display, 491 int *list_count /* return value */ 492); 493 494extern Status XpGetPdmStartParams ( 495 Display *print_display, 496 Window print_window, 497 XPContext print_context, 498 Display *video_display, 499 Window video_window, 500 Display **selection_display, /* return value */ 501 Atom *selection, /* return value */ 502 Atom *type, /* return value */ 503 int *format, /* return value */ 504 unsigned char **data, /* return value */ 505 int *nelements /* return value */ 506); 507 508extern Status XpGetAuthParams ( 509 Display *print_display, 510 Display *video_display, 511 Display **selection_display, /* return value */ 512 Atom *selection, /* return value */ 513 Atom *target /* return value */ 514); 515 516extern Status XpSendAuth ( 517 Display *display, 518 Window window 519); 520 521extern Status XpSendOneTicket ( 522 Display *display, 523 Window window, 524 Xauth *ticket, 525 Bool more 526); 527 528extern void XpSetLocaleHinter ( 529 XPHinterProc hinter_proc, 530 char *hinter_desc 531); 532 533extern char *XpGetLocaleHinter ( 534 XPHinterProc *hinter_proc 535); 536 537extern char *XpGetLocaleNetString(void); 538 539extern 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#endif /* _XP_PRINT_SERVER_ */ 549 550_XFUNCPROTOEND 551 552#endif /* _XpPrint_H_ */ 553