XMPRINTSETUP(3)

πŸ“¦
version 2.3.8 Β· 3 versions
, in arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– XmPrintSetup πŸ’–

okay bestie, gather round, because this one is a library call from the Xm family and it's literally the glow-up your app needs to go from screen-only to printing queen. no cap. 🌸


✨ NAME ✨

XmPrintSetup β€” setup and create a Print Shell widget πŸŽ€


✨ SYNOPSIS ✨

#include <Xm/Print.h>
Widget XmPrintSetup(
Widget video_widget,
Screen *print_screen,
String print_shell_name,
ArgList args,
Cardinal num_args);

✨ DESCRIPTION ✨

so basically, this function does the appropriate setting and creates a realized XmPrintShell that it hands right back to you. it's giving personal assistant energy. πŸ’… It hides all the fiddly Xt details of setting up a valid print shell hierarchy for your app, and honestly? It's also meant to encourage consistency in the way applications root their print widget hierarchy β€” like, everyone matching outfits. iconic. πŸ‘‘

print_screen must belong to a Display connection that has already been initialized with Xt. no skipping steps bestie, that's non-negotiable. 🚫

The video_widget is used to get at the application context, application name and class, and argc/argv stored on the applicationShell that roots this widget. and if no applicationShell is found? no drama, NULL argv/argc are used. 🫢

Then XmPrintSetup creates an unrealized ApplicationShell with the same name and class as the one given by the video display, on the print display and on the print screen specified. matchy-matchy. ✨

An XmPrintShell is then created as a child of this toplevel shell, using XtCreatePopupShell, with the name print_shell_name, and using the args provided. Then it realizes and maps the print shell, using XtPopup with XtGrabNone. boom, it's alive. πŸ”₯

This way, application resource files and users can specify print specific attributes using the following syntax (if print_shell_name is "Print"):

Dtpad.Print*textFontList: somefont
*Print*background:white
*Print*highlightThickness:0

πŸ¦‹ the arguments, bestie πŸ¦‹

  • video_widget β€” a video widget to fetch app video data from. your source of truth, lowkey. πŸ“Ή
  • print_screen β€” a print screen on the print display β€” it specifies the screen onto which the new shell is created. this is the where. πŸ–¨οΈ
  • print_shell_name β€” specifies the name of the XmPrintShell created on the X Print server. name her! πŸ’–
  • args β€” specifies the argument list from which to get the resources for the XmPrintShell. all the little settings. πŸŽ€
  • num_args β€” specifies the number of arguments in the argument list. yes, you gotta count them. 🌸

✨ RETURN VALUE ✨

The id of the XmPrintShell widget created on the X Print Server connection πŸ’… β€” or NULL if an error has occured. (their spelling, not mine, we don't gatekeep πŸ™ˆ)


✨ ERRORS/WARNINGS ✨

None. 😌 clean. pristine. no notes. ✨


✨ EXAMPLES ✨

From the OK callback and the SetUp callback of the primary print dialog widget:

static void
printOKCB(Widget, XtPointer call_data, XtPointer client_data)
{
  AppPrint *p = (AppPrint *) client_data;
  DtPrintSetupCallbackStruct *pbs =
                         (XmPrintCallbackStruct *) call_data;

  /* connect if not already done.
     the print dialog callback always provides valid
             printer name, print display and screen
             already initialized: XpInitContext called */
 */
  p->print_shell = XmPrintSetup (widget, pbs->print_screen,
                                              "Print", NULL, 0);

  ...
}

✨ SEE ALSO ✨

XmPrintShell(3), XmRedisplayWidget(3), XmPrintToFile(3), XmPrintPopupPDM(3)

go read those too bestie, they're all part of the same friend group 🫢

and that's the whole page fr fr πŸ’œ this was XmPrintSetup from the library call manual, brought to you by the source/version and date sitting pretty down at the bottom of the original page β€” mwah, stan. πŸŽ€πŸŒˆπŸ’