XpCreateContext(3Xp)
πΈ NAME πΈ
Bestie, this is the manual page for XpCreateContext(3Xp), from the XPRINT FUNCTIONS crew. It does one iconic thing: XpCreateContext β creates and initializes a new print context. Periodt. π
β¨ SYNOPSIS β¨
cc [ flag... ] file... -lXp [ library... ]
#include <X11/extensions/Print.h>
XPContext XpCreateContext ( display, printer_name )
Display *display;
char *printer_name;
π ARGUMENTS π
displayβ a pointer to theDisplaystructure, returned fromXOpenDisplay.printer_nameβ the name of a printer ondisplay. The string is encoded asCOMPOUND_TEXT.
π¦ DESCRIPTION π¦
Okay so XpCreateContext creates a new print context that's initialized with the default printer attributes and other information available for printer_name on display. A print context keeps track of the printer name, print attributes, font capabilities, print (rendering) state and results, and it's the object that Xp calls act on. Main character object energy, honestly. π
If the library fails to generate a new print context-id, a value of None is returned; otherwise a print context-id is always returned. If printer_name is invalid, a BadMatch is generated later by the X Print Server.
A call to XpGetPrinterList will return a valid list of values for printer_name. All printer name values in the X Print Service are encoded as COMPOUND_TEXT (of which the ISO-8859-1 code-set is a proper subset). iykyk π
As soon as a print context is created, the print attributes in it can be accessed and modified by calling XpGetAttributes and XpSetAttributes, and the event selections in it can be modified by calling XpSelectInput and XpInputSelected. Other Xp calls that explicitly take a print context-id as a parameter will operate directly on that print context. All Xp and X calls without a print context-id parameter (for example, all rendering oriented calls like XpStartJob and XDrawLine) require that a print context be set on the display connection (see XpSetContext). Failure to set a print context prior to calling a print-context-dependent call will result in the generation of an XPBadContext error. Not the vibe check you wanna fail, bestie. π
The XPContext returned by XpCreateContext is an XID, and can be used to set the print context on display connections by calling XpSetContext. The XPContext id can be shared between processes and display connections. It is the responsibility of the clients sharing a print context to coordinate their usage of the context; for example they must ensure that in-use print contexts are not prematurely destroyed. sharing is caring but coordinate first π«Ά
The context_id remains valid for all clients until 1) the client creating the print context closes its display connection, or 2) any client calls XpDestroyContext. The context_id can be kept valid after the creating client's display connection closes if XSetCloseDownMode is called on display with RetainPermanent or RetainTemporary.
After creating a print context, and possibly modifying the XPDocAttr attribute document-format using a value from the list of available formats shown in the XPPrinterAttr attribute document-formats-supported, the application must query the X Print Server via XpGetScreenOfContext for the screen that has been associated with the print context, and then create all server resources that will be used in the print job on that screen. Failure to do so will result in undefined behavior. ma'am, please do not skip this step π
When XpCreateContext is called, the client's locale (see XpSetLocaleHinter) is included in the request as a "hint" to the X Print Server. If supported by the implementation, the X Print Server will use the hint to initialize the attribute pools with any localized attribute values (for example, the human readable XPPrinterAttr attribute "descriptor" may be available in several different languages, and the hint will be used to select one). If the X Print Server cannot understand the hint, the X Print Server chooses a default value. localization slay β¨
This function can generate a BadMatch error if the specified printer_name does not exist on display, or if the print server could not interpret the code set specified in printer_name.
π©Ί DIAGNOSTICS π©Ί
BadMatchβ The value specified fordoc_fmtis not valid for the current document type or the value specified fordrawableis not valid for the print context and print screen.
π SEE ALSO π
XpDestroyContext(3Xp)XpGetAttributes(3Xp)XpGetPrinterList(3Xp)XpGetScreenOfContext(3Xp)XpInputSelected(3Xp)XpSelectInput(3Xp)XpSetAttributes(3Xp)XpSetContext(3Xp)XpSetLocaleHinter(3Xp)XpStartJob(3Xp)
Peace out, bestie π«Ά β X Version 11, libXp 1.0.4. go create those contexts and slay π
π¦ where this page comes from
- arch rolling: libxp 1.0.4-3 Β· X11 AND X11-distribute-modifications-variant
- nixos 26.05: libxp 1.0.4
- nixpkgs unstable: libxp 1.0.4
- opensuse-leap 16.0: libXp-devel 1.0.4-bp160.1.12 Β· MIT
- opensuse-leap 16.0: libXp-devel 1.0.4-bp160.1.12 Β· MIT
- opensuse-leap 16.0: libXp-devel 1.0.4-bp160.1.12 Β· MIT
- opensuse-leap 16.0: libXp-devel 1.0.4-bp160.1.12 Β· MIT
- Copyright 1996 Hewlett-Packard Company
- Copyright 1996 International Business Machines Corp
- Copyright 1996, 1999, 2004, Oracle and/or its affiliates. All rights reserved
- Copyright 1996 Novell, Inc
- Copyright 1996 Digital Equipment Corp
- Copyright 1996 Fujitsu Limited
- Copyright 1996 Hitachi, Ltd
- Copyright 1996 X Consortium, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms