summaryrefslogtreecommitdiff
path: root/print.c
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2005-01-03 01:06:36 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2005-01-03 01:06:36 +0000
commitdfb0b2dac20f575a7be260895f2847daeeacb819 (patch)
treeb9c17ac887e3d989386545886b4e022609dbceb0 /print.c
parent5581ed55c6918f69786d63e9a401f9d8b33a66d2 (diff)
xc/lib/XprintAppUtil/xpapputil.cXORG-6_8_99_1
xc/lib/XprintAppUtil/xpapputil.h xc/lib/XprintUtil/xprintutil.c xc/lib/XprintUtil/xprintutil.h xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/commands.c xc/programs/xlogo/print.c xc/programs/xlsfonts/xlsfonts.c xc/programs/xlsfonts/xlsfonts.man xc/programs/xlsfonts/xlsfonts.sgml xc/programs/xman/Xman-xprint.ad xc/programs/xman/handler.c xc/programs/xman/print.c xc/programs/xman/print.h xc/programs/xmore/XMore.ad xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xmore/printdialog.h xc/programs/xmore/printdialogprivates.h xc/programs/xmore/xmore.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c xc/programs/xphelloworld/xpxthelloworld/xpxthelloworld.c xc/programs/xplsprinters/xplsprinters.c //bugs.freedesktop.org/show_bug.cgi?id=1706) attachment #1615 (https://bugs.freedesktop.org/attachment.cgi?id=1615): XprintUtils 2004/Q3 update. This adds various new features to the XprintUtils library including support for page resolutions where X_resolution!=Y_resolution, listfonts-mode control and initial framework for the COLORSPACE extension. Patch by Roland Mainz <roland.mainz@nrubsig.org> and Julien Lafon <julien.lafon@gmail.com>.
Diffstat (limited to 'print.c')
-rw-r--r--print.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/print.c b/print.c
index 54f5a29..dad23e5 100644
--- a/print.c
+++ b/print.c
@@ -41,7 +41,8 @@ in this Software without prior written authorization from The Open Group.
static Widget
CreatePrintShell(Widget videoshell,
- Screen *pscreen,
+ Screen *pscreen,
+ Visual *pvisual,
String printshell_name,
ArgList args,
Cardinal numargs)
@@ -53,6 +54,9 @@ CreatePrintShell(Widget videoshell,
Display *pdpy = XDisplayOfScreen(pscreen);
int dummyc = 0;
String dummys = "";
+ Cardinal shell_n;
+ Arg shell_args[5];
+
XtGetApplicationNameAndClass(XtDisplay(videoshell),
&videoname, &videoclass);
@@ -62,11 +66,15 @@ CreatePrintShell(Widget videoshell,
NULL, 0,
&dummyc, &dummys);
- pappshell = XtVaAppCreateShell(videoname, videoclass,
+ shell_n = 0;
+ XtSetArg(shell_args[shell_n], XtNscreen, pscreen); shell_n++;
+ if (pvisual) {
+ XtSetArg(shell_args[shell_n], XtNvisual, pvisual); shell_n++;
+ }
+ pappshell = XtAppCreateShell(videoname, videoclass,
applicationShellWidgetClass,
pdpy,
- XtNscreen, pscreen,
- NULL);
+ shell_args, shell_n);
printshell = XtCreatePopupShell(printshell_name,
xawPrintShellWidgetClass,
pappshell, args, numargs);
@@ -224,7 +232,7 @@ void PrintEndJobCB(Widget pshell, XtPointer client_data, XtPointer call_data)
}
static
-XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi)
+XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi_x, long dpi_y)
{
XFontSet fontset;
char fontname[1024];
@@ -242,11 +250,11 @@ XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi)
"-wadalab-gothic-medium-r-normal--*-120-%ld-%ld-*-*,"
/* Fallback */
"-*-*-*-*-*--*-120-%ld-%ld-*-*",
- dpi, dpi,
- dpi, dpi,
- dpi, dpi,
- dpi, dpi,
- dpi, dpi);
+ dpi_x, dpi_y,
+ dpi_x, dpi_y,
+ dpi_x, dpi_y,
+ dpi_x, dpi_y,
+ dpi_x, dpi_y);
fontset = XCreateFontSet(pdpy, fontname,
&missing_charset_list_return,
&missing_charset_count_return,
@@ -265,10 +273,12 @@ XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi)
void DoPrintTextSource(const char *programname,
Widget textsource, Widget toplevel,
Display *pdpy, XPContext pcontext,
+ XpuColorspaceRec *colorspace,
XtCallbackProc pdpyDestroyCB,
const char *jobtitle, const char *toFile)
{
- long dpi = 0;
+ long dpi_x = 0L,
+ dpi_y = 0L;
int n;
Arg args[20];
XFontSet textfontset = NULL;
@@ -292,7 +302,7 @@ void DoPrintTextSource(const char *programname,
XpSetContext(pdpy, pcontext);
/* Get default printer resolution */
- if (XpuGetResolution(pdpy, pcontext, &dpi) != 1) {
+ if (XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1) {
fprintf(stderr, "%s: No default resolution for printer.\n", apd->programname);
XpuClosePrinterDisplay(pdpy, pcontext);
return;
@@ -310,14 +320,18 @@ void DoPrintTextSource(const char *programname,
* |XawPrintLAYOUTMODE_PAGESIZE| are used. */
XtSetArg(args[n], XtNgeometry, "+0+0"); n++;
XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++;
- apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "printshell", args, n);
-
+ if (colorspace) {
+ printf("Setting visual to id=0x%lx.\n", colorspace->visualinfo.visualid);
+ }
+ apd->printshell = CreatePrintShell(toplevel, apd->pscreen,
+ (colorspace?(colorspace->visualinfo.visual):(NULL)),
+ "printshell", args, n);
n = 0;
XtSetArg(args[n], XtNresizable, True); n++;
XtSetArg(args[n], XtNright, XtChainRight); n++;
apd->content.form = XtCreateManagedWidget("form", formWidgetClass, apd->printshell, args, n);
- textfontset = GetPrintTextFontSet(apd->programname, pdpy, dpi);
+ textfontset = GetPrintTextFontSet(apd->programname, pdpy, dpi_x, dpi_y);
n = 0;
XtSetArg(args[n], XtNinternational, True); n++;