Index: xc/config/cf/WinLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/WinLib.tmpl,v retrieving revision 1.1.4.2.6.1 diff -u -r1.1.4.2.6.1 WinLib.tmpl --- xc/config/cf/WinLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.2.6.1 +++ xc/config/cf/WinLib.tmpl 13 Apr 2004 23:27:05 -0000 @@ -6,7 +6,7 @@ #define SharedOldXReqs $(LDPRELIBS) $(XONLYLIB) #define SharedXtReqs $(LDPRELIBS) $(XONLYLIB) -#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIBS) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIBS) $(XONLYLIB) #define SharedXiReqs $(LDPRELIBS) $(XLIB) Index: xc/config/cf/X11.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/X11.tmpl,v retrieving revision 1.1.4.7.2.7.4.2 diff -u -r1.1.4.7.2.7.4.2 X11.tmpl --- xc/config/cf/X11.tmpl 12 Apr 2004 12:20:41 -0000 1.1.4.7.2.7.4.2 +++ xc/config/cf/X11.tmpl 13 Apr 2004 23:27:06 -0000 @@ -3610,10 +3610,10 @@ #endif #ifndef XawClientDepLibs -#define XawClientDepLibs $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXPMLIB) $(DEPXLIB) +#define XawClientDepLibs $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXPMLIB) $(DEPXPLIB) $(DEPXLIB) #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #ifndef SharedLibXTrap Index: xc/config/cf/bsdLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/bsdLib.tmpl,v retrieving revision 1.1.4.2.6.1 diff -u -r1.1.4.2.6.1 bsdLib.tmpl --- xc/config/cf/bsdLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.2.6.1 +++ xc/config/cf/bsdLib.tmpl 13 Apr 2004 23:27:06 -0000 @@ -43,7 +43,7 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif /* Allow for libpthread, as overridden by OS definitions */ @@ -56,8 +56,8 @@ #ifndef SharedXtReqs #define SharedXtReqs $(LDPRELIBS) $(XONLYLIB) $(SMLIB) $(ICELIB) #endif -#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIBS) $(XTOOLLIB) $(XLIB) #define SharedXmuuReqs $(LDPRELIB) $(XONLYLIB) #define SharedXextReqs $(LDPRELIBS) $(XONLYLIB) Index: xc/config/cf/bsdiLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/bsdiLib.tmpl,v retrieving revision 1.1.4.1.6.1 diff -u -r1.1.4.1.6.1 bsdiLib.tmpl --- xc/config/cf/bsdiLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.1.6.1 +++ xc/config/cf/bsdiLib.tmpl 13 Apr 2004 23:27:06 -0000 @@ -16,7 +16,7 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #define FrescoSysLibs CplusplusLibC MathLibrary @@ -25,8 +25,8 @@ #define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) #define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) #define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) #define SharedXiReqs $(LDPRELIB) $(XLIB) Index: xc/config/cf/cygwin.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/cygwin.tmpl,v retrieving revision 1.1.4.3.2.1 diff -u -r1.1.4.3.2.1 cygwin.tmpl --- xc/config/cf/cygwin.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.3.2.1 +++ xc/config/cf/cygwin.tmpl 13 Apr 2004 23:27:07 -0000 @@ -9,8 +9,8 @@ #define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) #define SharedXReqs $(XTOOLLIB) $(XPLIB) $(XLIB) $(LDPOSTLIBS) #define SharedXtReqs $(LDPRELIB) $(SMLIB) $(ICELIB) $(XONLYLIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) #define SharedXiReqs $(LDPRELIB) $(XLIB) @@ -57,7 +57,7 @@ #endif #ifndef XawClientLibs -# define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +# define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif Index: xc/config/cf/darwinLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/darwinLib.tmpl,v retrieving revision 1.1.4.1.6.1 diff -u -r1.1.4.1.6.1 darwinLib.tmpl --- xc/config/cf/darwinLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.1.6.1 +++ xc/config/cf/darwinLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -10,7 +10,7 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif /* Allow for libpthread, as overridden by OS definitions */ @@ -27,8 +27,8 @@ #define SharedGLUReqs $(LDPRELIB) $(XLIB) $(GLXLIB) #define SharedOSMesaReqs $(LDPRELIB) $(XLIB) $(GLXLIB) #define SharedSMReqs $(LDPRELIB) $(ICELIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXcursorReqs $(LDPRELIB) $(XRENDERLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) #define SharedXiReqs $(LDPRELIB) $(XLIB) Index: xc/config/cf/gnuLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/gnuLib.tmpl,v retrieving revision 1.1.4.1.6.1 diff -u -r1.1.4.1.6.1 gnuLib.tmpl --- xc/config/cf/gnuLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.1.6.1 +++ xc/config/cf/gnuLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -11,15 +11,15 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #define SharedX11Reqs #define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) #define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) #define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) #define SharedXiReqs $(LDPRELIB) $(XLIB) Index: xc/config/cf/hpLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/hpLib.tmpl,v retrieving revision 1.1.4.1.6.1 diff -u -r1.1.4.1.6.1 hpLib.tmpl --- xc/config/cf/hpLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.1.6.1 +++ xc/config/cf/hpLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -12,7 +12,7 @@ #define SharedOldXReqs $(XONLYLIB) #define SharedX11Reqs SharedThreadReqs #define SharedXtReqs $(XONLYLIB) $(SMLIB) $(ICELIB) SharedThreadReqs -#define SharedXawReqs $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(XONLYLIB) #define SharedXiReqs $(XLIB) Index: xc/config/cf/ibmLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/ibmLib.tmpl,v retrieving revision 1.1.4.4.4.1 diff -u -r1.1.4.4.4.1 ibmLib.tmpl --- xc/config/cf/ibmLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.4.4.1 +++ xc/config/cf/ibmLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -35,8 +35,8 @@ #define SharedXmuuReqs $(XLIBONLY) #define SharedOldXReqs $(XLIBONLY) #define SharedXtReqs $(XLIBONLY) $(SMLIB) $(ICELIB) SharedThreadReqs -#define SharedXawReqs $(XMULIB) $(XTOOLLIB) $(XLIB) $(XPMLIB) -#define SharedXaw6Reqs $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) $(XPMLIB) +#define SharedXaw6Reqs $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXiReqs $(XLIB) #define SharedXtstReqs $(XLIB) #define SharedPexReqs $(XONLYLIB) Index: xc/config/cf/lnxLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/lnxLib.tmpl,v retrieving revision 1.1.4.4.4.1 diff -u -r1.1.4.4.4.1 lnxLib.tmpl --- xc/config/cf/lnxLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.4.4.1 +++ xc/config/cf/lnxLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -14,15 +14,15 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #define SharedX11Reqs #define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) #define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) #define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXmuuReqs $(LDPRELIB) $(XONLYLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) Index: xc/config/cf/os2Lib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/os2Lib.tmpl,v retrieving revision 1.1.4.3.4.1 diff -u -r1.1.4.3.4.1 os2Lib.tmpl --- xc/config/cf/os2Lib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.3.4.1 +++ xc/config/cf/os2Lib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -17,8 +17,8 @@ #define SharedX11Reqs $(LDPRELIB) -lshm #define SharedOldXReqs $(LDPRELIB) $(XONLYLIB) #define SharedXtReqs $(LDPRELIB) $(XONLYLIB) $(SMLIB) $(ICELIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #define SharedXmuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXmuuReqs $(LDPRELIB) $(XTOOLLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) @@ -151,7 +151,7 @@ DEPXMULIB = XMULIB = _Use(SDlibXmu,-L$(XMUSRC) SDlibXmu) $(XLIB) #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #endif #if SharedOldX Index: xc/config/cf/osfLib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/osfLib.tmpl,v retrieving revision 1.1.4.2.6.1 diff -u -r1.1.4.2.6.1 osfLib.tmpl --- xc/config/cf/osfLib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.2.6.1 +++ xc/config/cf/osfLib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -20,7 +20,7 @@ #endif #define SharedXtReqs $(LDPRELIBS) $(XONLYLIB) $(SMLIB) $(ICELIB) SharedThreadReqs #if ModernOSF1 -#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #else #define SharedXawReqs $(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB) -init _XawFixupVendorShell #endif Index: xc/config/cf/sco5.cf =================================================================== RCS file: /cvs/xorg/xc/config/cf/sco5.cf,v retrieving revision 1.1.4.3.2.1.6.2 diff -u -r1.1.4.3.2.1.6.2 sco5.cf --- xc/config/cf/sco5.cf 12 Apr 2004 12:20:41 -0000 1.1.4.3.2.1.6.2 +++ xc/config/cf/sco5.cf 13 Apr 2004 23:27:07 -0000 @@ -212,7 +212,7 @@ #endif #ifndef XawClientLibs -#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +#define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #define SharedXlibi18nReqs $(LDPRELIB) $(XLIBONLY) @@ -225,8 +225,8 @@ #define SharedPexReqs $(LDPRELIB) $(XONLYLIB) MathLibrary #define SharedSMReqs $(LDPRELIB) $(ICELIB) #define SharedX11Reqs $(LDPRELIB) -lsocket -#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XLIB) -#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XLIB) +#define SharedXawReqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) +#define SharedXaw6Reqs $(LDPRELIB) $(XMULIB) $(XTOOLLIB) $(XPLIB) $(XLIB) #define SharedXcursorReqs $(LDPRELIB) $(XRENDERLIB) $(XLIB) #define SharedXextReqs $(LDPRELIB) $(XONLYLIB) #define SharedXiReqs $(LDPRELIB) $(XLIB) Index: xc/config/cf/sv4Lib.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/sv4Lib.tmpl,v retrieving revision 1.1.4.2.6.1 diff -u -r1.1.4.2.6.1 sv4Lib.tmpl --- xc/config/cf/sv4Lib.tmpl 4 Mar 2004 17:45:37 -0000 1.1.4.2.6.1 +++ xc/config/cf/sv4Lib.tmpl 13 Apr 2004 23:27:07 -0000 @@ -13,7 +13,7 @@ XMULIB = $(XMULIBONLY) -z nodefs #endif #ifndef XawClientLibs -# define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XLIB) +# define XawClientLibs $(XAWLIB) $(XMULIBONLY) $(XTOOLLIB) $(XPMLIB) $(XPLIB) $(XLIB) #endif #if 0 Index: xc/config/cf/xprint_site.def =================================================================== RCS file: /cvs/xorg/xc/config/cf/Attic/xprint_site.def,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 xprint_site.def --- xc/config/cf/xprint_site.def 13 Apr 2004 05:07:46 -0000 1.1.2.2 +++ xc/config/cf/xprint_site.def 13 Apr 2004 23:27:07 -0000 @@ -120,6 +120,9 @@ #define BuildFontCache NO #define BuildRender NO #define BuildRenderLibrary NO +#define BuildRandRLibrary NO +#define BuildXcursorLibrary NO +#define BuildXcursorgen NO /* CAUTION: The XF86 "smart" scheduler breaks Xprt */ #define UseSmartScheduler NO @@ -134,7 +137,7 @@ #define XVendorRelease 100000 #define UseHackLinkAgainstInstalledX11Libs YES -#ifdef UseHackLinkAgainstInstalledX11Libs +#if UseHackLinkAgainstInstalledX11Libs /* "Hack" to reuse an already installed X11 distribution when linking our * programs (this assumes that the installed X version is at least X11R6.4) */ # ifndef IBMArchitecture Index: xc/lib/Imakefile =================================================================== RCS file: /cvs/xorg/xc/lib/Imakefile,v retrieving revision 1.1.4.2.6.2.6.2 diff -u -r1.1.4.2.6.2.6.2 Imakefile --- xc/lib/Imakefile 13 Apr 2004 03:16:31 -0000 1.1.4.2.6.2.6.2 +++ xc/lib/Imakefile 13 Apr 2004 23:27:10 -0000 @@ -8,7 +8,7 @@ #define IHaveSubdirs #define PassCDebugFlags -#if BuildXaw6 && BuildLibraries +#if BuildXaw6 && BuildXprintLib && BuildLibraries XAW6LIBDIR = Xaw6 #endif @@ -190,7 +190,9 @@ XMULIBDIR = Xmu XMUULIBDIR = Xmuu XPMLIBDIR = Xpm +#if BuildXprintLib XAWLIBDIR = Xaw +#endif XTSTLIBDIR = Xtst FSLIBDIR = FS #endif @@ -200,9 +202,9 @@ $(OLDXLIBDIR) $(ICELIBDIR) $(SMLIBDIR) $(XEXTLIBDIR) $(XTLIBDIR) \ $(SSLIBDIR) $(XF86MISCLIBDIR) $(XF86VMLIBDIR) $(XF86DGALIBDIR) \ $(XF86RUSHLIBDIR) $(XMULIBDIR) $(XMUULIBDIR) $(XPMLIBDIR) \ - $(XAW6LIBDIR) $(XAWLIBDIR) $(XINPUTLIBDIR) \ + $(XPRINTLIBDIRS) $(XAW6LIBDIR) $(XAWLIBDIR) $(XINPUTLIBDIR) \ $(XTSTLIBDIR) $(FSLIBDIR) $(XKBLIBDIR) \ - $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) $(XPRINTLIBDIRS) \ + $(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) \ $(XVLIBDIR) $(GLXLIBDIR) $(GLULIBDIR) $(GLWLIBDIR) \ $(DPSLIBDIR) $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \ $(ZLIBDIR) $(REGEXDIR) $(RENDERLIBDIR) $(FREETYPE2BUILDDIR) \ Index: xc/lib/Xaw/AllWidgets.c =================================================================== RCS file: /cvs/xorg/xc/lib/Xaw/AllWidgets.c,v retrieving revision 1.1.4.1.6.1 diff -u -r1.1.4.1.6.1 AllWidgets.c --- xc/lib/Xaw/AllWidgets.c 4 Mar 2004 17:46:49 -0000 1.1.4.1.6.1 +++ xc/lib/Xaw/AllWidgets.c 13 Apr 2004 23:27:11 -0000 @@ -67,6 +67,7 @@ extern WidgetClass vendorShellWidgetClass; extern WidgetClass viewportWidgetClass; extern WidgetClass wmShellWidgetClass; +extern WidgetClass xawPrintShellWidgetClass; XmuWidgetNode XawWidgetArray[] = { { "applicationShell", &applicationShellWidgetClass }, @@ -111,6 +112,7 @@ { "vendorShell", &vendorShellWidgetClass }, { "viewport", &viewportWidgetClass }, { "wmShell", &wmShellWidgetClass }, +{ "printShell", &xawPrintShellWidgetClass }, }; int XawWidgetCount = XtNumber(XawWidgetArray); Index: xc/lib/Xaw/Imakefile =================================================================== RCS file: /cvs/xorg/xc/lib/Xaw/Imakefile,v retrieving revision 1.1.4.2.6.1 diff -u -r1.1.4.2.6.1 Imakefile --- xc/lib/Xaw/Imakefile 4 Mar 2004 17:46:49 -0000 1.1.4.2.6.1 +++ xc/lib/Xaw/Imakefile 13 Apr 2004 23:27:11 -0000 @@ -94,6 +94,8 @@ VendorEP.h \ Viewport.h \ ViewportP.h \ + Print.h \ + PrintSP.h \ XawImP.h \ XawInit.h @@ -139,6 +141,7 @@ Tree.c \ Vendor.c \ Viewport.c \ + PrintShell.c \ XawIm.c \ XawInit.c \ XawI18n.c \ @@ -190,6 +193,7 @@ Tree.o \ Vendor.o \ Viewport.o \ + PrintShell.o \ XawIm.o \ XawI18n.o \ XawInit.o Index: xc/lib/Xaw/Print.h =================================================================== RCS file: xc/lib/Xaw/Print.h diff -N xc/lib/Xaw/Print.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/lib/Xaw/Print.h 13 Apr 2004 23:27:11 -0000 @@ -0,0 +1,141 @@ +/* $Xorg: Print.h,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ +/****************************************************************************** + ****************************************************************************** + ** + ** (c) Copyright 2003 Danny Backx + ** (c) Copyright 2003-2004 Roland Mainz + ** + ** 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. + ** + ****************************************************************************** + *****************************************************************************/ + + +#ifndef _XAW_PRINT_H +#define _XAW_PRINT_H 1 + +#include + +/* XawPrintConfigureLayoutMode - define how the shell resizes/moves itself + * to match the paper size + * Values: + * - XawPrintLAYOUTMODE_NONE + * do nothing + * - XawPrintLAYOUTMODE_PAGESIZE + * set width/height to page size + * (this is the default (mainly for compatibilty to XmPrintShell)) + * - XawPrintLAYOUTMODE_DRAWABLEAREA + * set x/y/width/height to drawable area of pag + */ +typedef +enum +{ + XawPrintLAYOUTMODE_NONE, + XawPrintLAYOUTMODE_PAGESIZE, + XawPrintLAYOUTMODE_DRAWABLEAREA +} XawPrintConfigureLayoutMode; + + +#define XawNstartJobCallback "XawNstartJobCallback" +#define XawNendJobCallback "XawNendJobCallback" +#define XawNdocSetupCallback "XawNdocSetupCallback" +#define XawNpageSetupCallback "XawNpageSetupCallback" +#define XawNlayoutMode "XawNlayoutMode" +#define XawCLayoutMode "XawCLayoutMode" +#define XawNminX "XawNminX" +#define XawCMinX "XawCMinX" +#define XawNminY "XawNminY" +#define XawCMinY "XawCMinY" +#define XawNmaxX "XawNmaxX" +#define XawCMaxX "XawCMaxX" +#define XawNmaxY "XawNmaxY" +#define XawCMaxY "XawCMaxY" +#define XawNcurrDocNumInJob "XawNcurrDocNumInJob" +#define XawCCurrDocNumInJob "XawCCurrDocNumInJob" +#define XawNcurrPageNumInDoc "XawNcurrPageNumInDoc" +#define XawCCurrPageNumInDoc "XawCCurrPageNumInDoc" +#define XawNcurrPageNumInJob "XawNcurrPageNumInJob" +#define XawCCurrPageNumInJob "XawCCurrPageNumInJob" +#define XawNdefaultPixmapResolution "XawNdefaultPixmapResolution" +#define XawCDefaultPixmapResolution "XawCDefaultPixmapResolution" + +#define XawCR_START_JOB 70 +#define XawCR_END_JOB 71 +#define XawCR_DOC_SETUP 72 +#define XawCR_PAGE_SETUP 73 + +typedef struct +{ + int reason; + XEvent *event; + XPContext context; + Boolean last_page_in_doc; + Boolean last_page_in_job; + XtPointer detail; +} XawPrintShellCallbackStruct; + +extern WidgetClass xawPrintShellWidgetClass; +typedef struct XawPrintShellRec *XawPrintShellWidget; + +/************************************************************ + * + * Public Functions. + * + ************************************************************/ + +_XFUNCPROTOBEGIN + +/* Returns whether the widget passed in is a print shell or "print shell"-like + * widget (e.g. print preview). + * Note that this will return |True| for more classes than |XawPrintShell| in + * the future (like for |XmPrintShell| etc.) + */ +extern Boolean XawIsPrintShell( +#if NeedFunctionPrototypes + Widget w +#endif +); + +extern void XawPrintRedisplayWidget( +#if NeedFunctionPrototypes + Widget w /* Widget */ +#endif +); + +extern Widget XawOpenApplication( +#if NeedFunctionPrototypes + XtAppContext *app_context_return, + Display *dpy, + Screen *screen, + String application_name, + String application_class, + WidgetClass widget_class, + int *argc, + String *argv +#endif +); + +_XFUNCPROTOEND + +#endif /* !_XAW_PRINT_H */ + Index: xc/lib/Xaw/PrintSP.h =================================================================== RCS file: xc/lib/Xaw/PrintSP.h diff -N xc/lib/Xaw/PrintSP.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/lib/Xaw/PrintSP.h 13 Apr 2004 23:27:11 -0000 @@ -0,0 +1,135 @@ +/* $Xorg: PrintSP.h,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ +/****************************************************************************** + ****************************************************************************** + ** + ** (c) Copyright 2003 Danny Backx + ** (c) Copyright 2003-2004 Roland Mainz + ** + ** 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. + ** + ****************************************************************************** + *****************************************************************************/ + +#ifndef _XAW_PRINTSP_H +#define _XAW_PRINTSP_H 1 + +#include +#include + +_XFUNCPROTOBEGIN + +/* New fields for the XawPrintShell widget class record */ + +typedef struct { + XtPointer extension; /* pointer to extension record */ +} XawPrintShellClassPart; + +typedef struct XawPrintShellClassRec { + CoreClassPart core_class; + CompositeClassPart composite_class; + ShellClassPart shell_class; + WMShellClassPart wm_shell_class; + VendorShellClassPart vendor_shell_class; + TopLevelShellClassPart top_level_shell_class; + ApplicationShellClassPart application_shell_class; + XawPrintShellClassPart print_shell_class; +} XawPrintShellClassRec; + +extern XawPrintShellClassRec xawPrintShellClassRec; + +/* New fields for the XawPrint shell widget */ + +typedef struct { + XtCallbackList start_job_callback, + end_job_callback, + doc_setup_callback, + page_setup_callback; + XtEnum layoutmode; /* see XawPrintConfigureLayoutMode */ + unsigned short page_width, + page_height; + Dimension min_x, + min_y, + max_x, + max_y; + unsigned int curr_doc_num_in_job, /* Current document number in job */ + curr_page_num_in_doc, /* Current page number in doc */ + curr_page_num_in_job; /* Current page number in job */ + unsigned short default_pixmap_resolution; + long print_resolution; + Boolean last_page_in_doc; + Boolean last_page_in_job; +} XawPrintShellPart; + +typedef struct XawPrintShellRec { + CorePart core; + CompositePart composite; + ShellPart shell; + WMShellPart wm; + VendorShellPart vendor; + TopLevelShellPart topLevel; + ApplicationShellPart application; + XawPrintShellPart print; +} XawPrintShellRec; +extern WidgetClass xawPrintShellWidgetClass; + +#define PS_StartJobCallback(w) \ + (((XawPrintShellWidget) (w))->print.start_job_callback) +#define PS_EndJobCallback(w) \ + (((XawPrintShellWidget) (w))->print.end_job_callback) +#define PS_DocSetupCallback(w) \ + (((XawPrintShellWidget) (w))->print.doc_setup_callback) +#define PS_PageSetupCallback(w) \ + (((XawPrintShellWidget) (w))->print.page_setup_callback) +#define PS_LayoutMode(w) \ + (((XawPrintShellWidget) (w))->print.layoutmode) +#define PS_PageWidth(w) \ + (((XawPrintShellWidget) (w))->print.page_width) +#define PS_PageHeight(w) \ + (((XawPrintShellWidget) (w))->print.page_height) +#define PS_MinX(w) \ + (((XawPrintShellWidget) (w))->print.min_x) +#define PS_MinY(w) \ + (((XawPrintShellWidget) (w))->print.min_y) +#define PS_MaxX(w) \ + (((XawPrintShellWidget) (w))->print.max_x) +#define PS_MaxY(w) \ + (((XawPrintShellWidget) (w))->print.max_y) +#define PS_CurrDocNumInJob(w) \ + (((XawPrintShellWidget) (w))->print.curr_doc_num_in_job) +#define PS_CurrPageNumInDoc(w) \ + (((XawPrintShellWidget) (w))->print.curr_page_num_in_doc) +#define PS_CurrPageNumInJob(w) \ + (((XawPrintShellWidget) (w))->print.curr_page_num_in_job) +#define PS_DefaultPixmapResolution(w) \ + (((XawPrintShellWidget) (w))->print.default_pixmap_resolution) +#define PS_PrintResolution(w) \ + (((XawPrintShellWidget) (w))->print.print_resolution) +#define PS_LastPageInDoc(w) \ + (((XawPrintShellWidget) (w))->print.last_page_in_doc) +#define PS_LastPageInJob(w) \ + (((XawPrintShellWidget) (w))->print.last_page_in_job) + +_XFUNCPROTOEND + +#endif /* !_XAW_PRINTSP_H */ + Index: xc/lib/Xaw/PrintShell.c =================================================================== RCS file: xc/lib/Xaw/PrintShell.c diff -N xc/lib/Xaw/PrintShell.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/lib/Xaw/PrintShell.c 13 Apr 2004 23:27:13 -0000 @@ -0,0 +1,786 @@ +/* $Xorg: PrintShell.c,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */ +/****************************************************************************** + ****************************************************************************** + ** + ** (c) Copyright 2003 Danny Backx + ** (c) Copyright 2003-2004 Roland Mainz + ** + ** 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. + ** + ****************************************************************************** + *****************************************************************************/ + + +#include +#include +#include + +#include +#include + +#include "Print.h" +#include "PrintSP.h" + +/* Local prototypes */ +static void class_initialize(void); +static void class_part_initialize(WidgetClass w_class); +static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args); +static void destroy(Widget w); +static Boolean set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args); +static void XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont); +static void XawAttributesNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont); +static void XawUpdateLayout(Widget w); +static void XawUpdateResources(Widget w, XPContext pcontext); + +#define Offset(field) XtOffsetOf(XawPrintShellRec, print.field) + +#ifdef XAWDEBUG +#define DEBUGOUT(x) XawDebug x ; + +static void +XawDebug(const char *fn, Widget w, const char *fmt, ...) +{ + va_list ap; + + if (w) { + fprintf(stderr, "%s %s: ", + w->core.widget_class->core_class.class_name, XtName(w)); + } else { + fprintf(stderr, "(null widget): "); + } + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} +#else +#define DEBUGOUT(x) +#endif /* XAWDEBUG */ + +/* Resources for the PrintShell class */ +static XtResource resources[] = +{ + { + XawNstartJobCallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), Offset(start_job_callback), + XtRImmediate, (XtPointer)NULL + }, + { + XawNendJobCallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), Offset(end_job_callback), + XtRImmediate, (XtPointer)NULL + }, + { + XawNdocSetupCallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), Offset(doc_setup_callback), + XtRImmediate, (XtPointer)NULL + }, + { + XawNpageSetupCallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), Offset(page_setup_callback), + XtRImmediate, (XtPointer)NULL + }, + { + XawNlayoutMode, XawCLayoutMode, XtREnum, + sizeof(XtEnum), Offset(layoutmode), + XtRImmediate, (XtPointer)XawPrintLAYOUTMODE_PAGESIZE + }, + { + XawNminX, XawCMinX, XtRDimension, + sizeof(Dimension), Offset(min_x), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNminY, XawCMinY, XtRDimension, + sizeof(Dimension), Offset(min_y), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNmaxX, XawCMaxX, XtRDimension, + sizeof(Dimension), Offset(max_x), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNmaxY, XawCMaxY, XtRDimension, + sizeof(Dimension), Offset(max_y), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNcurrDocNumInJob, XawCCurrDocNumInJob, XtRInt, + sizeof(unsigned int), Offset(curr_doc_num_in_job), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNcurrPageNumInDoc, XawCCurrPageNumInDoc, XtRInt, + sizeof(unsigned int), Offset(curr_page_num_in_doc), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNcurrPageNumInJob, XawCCurrPageNumInJob, XtRInt, + sizeof(unsigned int), Offset(curr_page_num_in_job), + XtRImmediate, (XtPointer)NULL /* dynamic */ + }, + { + XawNdefaultPixmapResolution, XawCDefaultPixmapResolution, XtRShort, + sizeof(unsigned short), Offset(default_pixmap_resolution), + XtRImmediate, (XtPointer)0 + }, +}; + +static XtActionsRec actions[] = +{ + { NULL, NULL } +}; + +XawPrintShellClassRec xawPrintShellClassRec = { + /* Core class part */ + { + /* superclass */ (WidgetClass) &applicationShellClassRec, + /* class_name */ "XawPrintShell", + /* widget_size */ sizeof(XawPrintShellRec), + /* class_initialize */ class_initialize, + /* class_part_initialize */ class_part_initialize, + /* class_inited */ False, + /* initialize */ initialize, + /* initialize_hook */ NULL, + /* realize */ XtInheritRealize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ False, + /* compress_exposure */ XtExposeCompressSeries, + /* compress_enterleave */ False, + /* visible_interest */ False, + /* destroy */ destroy, + /* resize */ XtInheritResize, + /* expose */ XtInheritExpose, + /* set_values */ set_values, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback offsets */ NULL, + /* tm_table */ XtInheritTranslations, + /* query_geometry */ XtInheritQueryGeometry, + /* display_accelerator */ NULL, + /* extension */ NULL /* (XtPointer)&_XawPrintShellCoreClassExtRec */ + }, + /* Composite class part */ + { + /* geometry manager */ XtInheritGeometryManager, + /* change_managed */ XtInheritChangeManaged, + /* insert_child */ XtInheritInsertChild, + /* delete_child */ XtInheritDeleteChild, + /* extension */ NULL, + }, + /* Shell class part */ + { + /* extension */ NULL, + }, + /* WM Shell class part */ + { + /* extension */ NULL, + }, + /* VendorShell class part */ + { + /* extension */ NULL, + }, + /* TopLevelShell class part */ + { + /* extension */ NULL, + }, + /* ApplicationShell class part */ + { + /* extension */ NULL, + }, + { + /* ?? */ NULL, + }, +}; + +WidgetClass xawPrintShellWidgetClass = (WidgetClass)&xawPrintShellClassRec; + + +static void +class_initialize(void) +{ +} + + +static void +class_part_initialize(WidgetClass widget_class) +{ +} + +/* + * This is a static table to keep the link between widgets and XPContexts. + * Yeah - this is probably not a very bright idea. Maybe it should also + * contain the Display. + */ +typedef struct { + Widget w; + XPContext c; +} WidgetContext; +static WidgetContext *w_ctxt = NULL; +static int wc_nfields = 0; + +static void +XawStoreWidgetContext(Widget w, XPContext c) +{ + wc_nfields++; + w_ctxt = (WidgetContext *)XtRealloc((XtPointer)w_ctxt, sizeof(WidgetContext) * wc_nfields); + w_ctxt[wc_nfields-1].w = w; + w_ctxt[wc_nfields-1].c = c; +} + +/* FIXME: This is not threadsafe... */ +static Widget +XawPrintContextToWidget(XPContext c) +{ + int i; + + for( i = 0 ; i < wc_nfields ; i++ ) { + if( w_ctxt[i].c == c ) { + return w_ctxt[i].w; + } + } + return NULL; +} + +/* FIXME: This is not threadsafe... */ +static XPContext +XawPrintWidgetToContext(Widget w) +{ + int i; + + for( i = 0 ; i < wc_nfields ; i++ ) { + if (w_ctxt[i].w == w) { + return w_ctxt[i].c; + } + } + return (XPContext)None; +} + +/* FIXME: This is not threadsafe... */ +static void +XawPrintDeleteWidgetContext(Widget w) +{ + int i; + + for( i = 0 ; i < wc_nfields ; i++ ) { + if( w_ctxt[i].w == w ) { + w_ctxt[i].w = NULL; + w_ctxt[i].c = None; + } + } +} + +static void +SelectNotify(Widget w, int *e, XtPointer *s, int n, XtPointer client) +{ + XPContext c = XpGetContext(XtDisplay(w)); + + if (!c) { + XtAppWarning(XtWidgetToApplicationContext(w), + "XawPrintShell: SelectNotify: no print context\n"); + return; + } + + XpSelectInput(XtDisplay(w), c, XPPrintMask|XPAttributeMask); +} + + +static Boolean +DispatchEvent(XEvent *evp) +{ + XPPrintEvent *e = (XPPrintEvent*)evp; + + Widget w = XawPrintContextToWidget(e->context); + + /* Make sure this event is really for this window... */ + if (XFilterEvent(evp, XtWindow(w))) + { + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent *** filter XFilterEvent() matched.\n")); + return True; + } + + /* Only for debugging */ +#ifdef XAWDEBUG + { + int error_base, + event_base; + + if (!XpQueryExtension(XtDisplay(w), &event_base, &error_base)) { + return False; + } + + if (e->type == event_base + XPPrintNotify) { + switch (e->detail) { + case XPStartJobNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartJobNotify\n")); + break; + case XPEndJobNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndJobNotify\n")); + break; + case XPStartDocNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartDocNotify\n")); + break; + case XPStartPageNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartPageNotify\n")); + break; + case XPEndPageNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndPageNotify\n")); + break; + case XPEndDocNotify: + DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndDocNotify\n")); + break; + default: + DEBUGOUT((__FILE__, w, "XawPrintShell DispatchEvent\n")); + } + } + } +#endif /* XAWDEBUG */ + + return XtDispatchEventToWidget(w, evp); +} + + +static void +initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) +{ + int error_base, + event_base; + XPContext pcontext; + + DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize\n")); + + if (!XpQueryExtension(XtDisplay(new_w), &event_base, &error_base)) { + DEBUGOUT((__FILE__, new_w, "XawPrintShell initialize: failed!!\n")); + XtAppWarning(XtWidgetToApplicationContext(new_w), + "XawPrintShell: initialize: XpQueryExtension() failed. BAD.\n"); + return; + } + + DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize event_base %d error_base %d\n", + event_base, error_base)); + + pcontext = XpGetContext(XtDisplay(new_w)); + + if( pcontext == None ) { + XtAppWarning(XtWidgetToApplicationContext(new_w), + "XawPrintShell: initialize: No print content. BAD.\n"); + return; + } + + /* Make sure that the Xt machinery is really using the right screen (assertion) */ + if( XpGetScreenOfContext(XtDisplay(new_w), pcontext) != XtScreen(new_w) ) { + XtAppWarning(XtWidgetToApplicationContext(new_w), + "XawPrintShell: initialize: Widget's screen != print screen. BAD.\n"); + return; + } + + XawStoreWidgetContext(new_w, pcontext); + + XtInsertEventTypeHandler(new_w, + event_base + XPPrintNotify, + (XtPointer)XPPrintMask, + XawPrintNotify, NULL, + XtListTail); + XtInsertEventTypeHandler(new_w, + event_base + XPAttributeNotify, + (XtPointer)XPAttributeMask, + XawAttributesNotify, NULL, + XtListTail); + + XtRegisterExtensionSelector(XtDisplay(new_w), + event_base + XPPrintNotify, + event_base + XPAttributeNotify, + SelectNotify, + NULL); + + XtSetEventDispatcher(XtDisplay(new_w), + event_base + XPPrintNotify, + DispatchEvent); + XtSetEventDispatcher(XtDisplay(new_w), + event_base + XPAttributeNotify, + DispatchEvent); + + PS_LastPageInDoc(new_w) = False; + PS_LastPageInJob(new_w) = False; + + XawUpdateResources(new_w, pcontext); + XawUpdateLayout(new_w); + + DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize x %d y %d wid %d ht %d\n", + new_w->core.x, + new_w->core.y, + new_w->core.width, + new_w->core.height)); +} + + +static void +destroy(Widget w) +{ + DEBUGOUT((__FILE__, w, "XawPrintShell Destroy\n")); + XawPrintDeleteWidgetContext(w); +} + +static Boolean +set_values(Widget current, Widget request, Widget new_w, + ArgList args, Cardinal *num_args) +{ + DEBUGOUT((__FILE__, new_w, "XawPrintShell SetValues\n")); + return True; +} + +void XawPrintRedisplayWidget(Widget w) +{ + XExposeEvent xev; + Region region; + + xev.type = Expose; + xev.serial = XLastKnownRequestProcessed(XtDisplay(w)); + xev.send_event = False; + xev.display = XtDisplay(w); + xev.window = XtWindowOfObject(w); + xev.x = 0; + xev.y = 0; + xev.width = w->core.width; + xev.height = w->core.height; + xev.count = 0; + + region = XCreateRegion(); + if (!region) + return; + + XtAddExposureToRegion((XEvent*)&xev, region); + + if (w->core.widget_class->core_class.expose) + (*(w->core.widget_class->core_class.expose))(w, (XEvent *)&xev, region); + + XDestroyRegion(region); +} + +/* XawOpenApplication() - mainly identical to XtOpenApplication() but + * takes a |Display *| and |Screen *| as arguments, too... */ +Widget XawOpenApplication(XtAppContext *app_context_return, + Display *dpy, + Screen *screen, + String application_name, + String application_class, + WidgetClass widget_class, + int *argc, + String *argv) +{ + Widget toplevel; + Cardinal n; + Arg args[2]; + + XtToolkitInitialize(); + *app_context_return = XtCreateApplicationContext(); + if( *app_context_return == NULL ) + return NULL; + + XtDisplayInitialize(*app_context_return, dpy, + application_name, application_class, + NULL, 0, + argc, argv); + + n = 0; + if (screen) { + XtSetArg(args[n], XtNscreen, screen); n++; + } + toplevel = XtAppCreateShell(application_name, + application_class, + widget_class, + dpy, + args, n); + + return toplevel; +} + + +/* Returns whether the widget passed in is a print shell or "print shell"-like + * widget (e.g. print preview). + * Note that this will return |True| for more classes than |XawPrintShell| in + * the future (like for |XmPrintShell| etc.) + */ +Boolean +XawIsPrintShell(Widget w) +{ + return XtIsSubclass(w, xawPrintShellWidgetClass); +} + + +static void +XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont) +{ + XPPrintEvent *e = (XPPrintEvent *)evp; + XawPrintShellCallbackStruct cbs; + + switch (e->detail) { + case XPStartPageNotify: + DEBUGOUT((__FILE__, w, "XPStartPageNotify\n")); + + /* Re do not have to call |XawPrintRedisplayWidget(w)| here since + * Xprint triggers an expose event anyway + */ + + DEBUGOUT((__FILE__, w, "XpEndPage\n")); + XpEndPage(XtDisplay(w)); + break; + + case XPEndPageNotify: + DEBUGOUT((__FILE__, w, "XPEndPageNotify\n")); + + if (PS_LastPageInDoc(w) || PS_LastPageInJob(w)) { + DEBUGOUT((__FILE__, w, "XpEndDoc\n")); + XpEndDoc(XtDisplay(w)); + } + else { + /* Increment page numbers... */ + PS_CurrPageNumInDoc(w) += 1; + PS_CurrPageNumInJob(w) += 1; + + /* ... do the page setup callback ... */ + cbs.reason = XawCR_PAGE_SETUP; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = XawPrintWidgetToContext(w); + cbs.last_page_in_doc = False; + cbs.last_page_in_job = False; + + if (PS_PageSetupCallback(w)) + XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs); + + PS_LastPageInDoc(w) = cbs.last_page_in_doc; + PS_LastPageInJob(w) = cbs.last_page_in_job; + + /* ... and start the new page */ + DEBUGOUT((__FILE__, w, "XpStartPage\n")); + XpStartPage(XtDisplay(w), XtWindow(w)); + } + break; + + case XPStartDocNotify: + DEBUGOUT((__FILE__, w, "XPStartDocNotify\n")); + + cbs.reason = XawCR_PAGE_SETUP; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = XawPrintWidgetToContext(w); + cbs.last_page_in_doc = False; + cbs.last_page_in_job = False; + + if (PS_PageSetupCallback(w)) + XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs); + + PS_LastPageInDoc(w) = cbs.last_page_in_doc; + PS_LastPageInJob(w) = cbs.last_page_in_job; + + DEBUGOUT((__FILE__, w, "XpStartPage\n")); + XpStartPage(XtDisplay(w), XtWindow(w)); + break; + + case XPEndDocNotify: + DEBUGOUT((__FILE__, w, "XPEndDocNotify\n")); + + /* Start a new document (via XpStartDoc()) if we are not done with the job yet, + * otherwise finish the job (via XpEndJob()) + */ + if (PS_LastPageInJob(w)) { + DEBUGOUT((__FILE__, w, "XpEndJob\n")); + XpEndJob(XtDisplay(w)); + } + else { + PS_CurrDocNumInJob(w) += 1; + PS_CurrPageNumInDoc(w) = 1; + + cbs.reason = XawCR_DOC_SETUP; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = XawPrintWidgetToContext(w); + cbs.last_page_in_doc = False; + cbs.last_page_in_job = False; + + if (PS_DocSetupCallback(w)) + XtCallCallbackList(w, PS_DocSetupCallback(w), &cbs); + + PS_LastPageInDoc(w) = cbs.last_page_in_doc; + PS_LastPageInJob(w) = cbs.last_page_in_job; + + DEBUGOUT((__FILE__, w, "XpStartDoc\n")); + XpStartDoc(XtDisplay(w), XPDocNormal); + } + break; + + case XPStartJobNotify: + DEBUGOUT((__FILE__, w, "XPStartJobNotify\n")); + PS_LastPageInJob(w) = False; + PS_LastPageInDoc(w) = False; + PS_CurrDocNumInJob(w) = 1; + PS_CurrPageNumInDoc(w) = 1; + PS_CurrPageNumInJob(w) = 1; + + cbs.reason = XawCR_START_JOB; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = XawPrintWidgetToContext(w); + cbs.last_page_in_doc = False; + cbs.last_page_in_job = False; + + if (PS_StartJobCallback(w)) + XtCallCallbackList(w, PS_StartJobCallback(w), &cbs); + + PS_LastPageInDoc(w) = cbs.last_page_in_doc; + PS_LastPageInJob(w) = cbs.last_page_in_job; + + /* Start a document (which will trigger the first page in + * |XPStartDocNotify| above) */ + if (PS_LastPageInDoc(w) || PS_LastPageInJob(w)) { + DEBUGOUT((__FILE__, w, "XpEndJob\n")); + XpEndJob(XtDisplay(w)); + } + else + { + cbs.reason = XawCR_DOC_SETUP; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = XawPrintWidgetToContext(w); + cbs.last_page_in_doc = False; + cbs.last_page_in_job = False; + + if (PS_DocSetupCallback(w)) + XtCallCallbackList(w, PS_DocSetupCallback(w), &cbs); + + PS_LastPageInDoc(w) = cbs.last_page_in_doc; + PS_LastPageInJob(w) = cbs.last_page_in_job; + + DEBUGOUT((__FILE__, w, "XpStartDoc\n")); + XpStartDoc(XtDisplay(w), XPDocNormal); + } + break; + + case XPEndJobNotify: + DEBUGOUT((__FILE__, w, "XPEndJobNotify\n")); + cbs.reason = XawCR_END_JOB; + cbs.event = evp; + cbs.detail = NULL; + cbs.context = None; + cbs.last_page_in_doc = True; + cbs.last_page_in_job = True; + + if (PS_EndJobCallback(w)) + XtCallCallbackList(w, PS_EndJobCallback(w), &cbs); + break; + + default: + DEBUGOUT((__FILE__, w, "XawPrintNotify(default)\n")); + break; + } +} + +static void +XawUpdateResources(Widget w, XPContext pcontext) +{ + XawPrintShellWidget print_shell = (XawPrintShellWidget)w; + String string_resolution; + XRectangle drawable_paper_area; + + string_resolution = XpGetOneAttribute(XtDisplay(w), pcontext, XPDocAttr, "default-printer-resolution"); + if (!string_resolution) { + XtAppWarning(XtWidgetToApplicationContext(w), + "XawPrintShell: XawUpdateResources: Could not get 'default-printer-resolution' XPDocAttr\n"); + } + print_shell->print.print_resolution = atol(string_resolution); + XFree(string_resolution); + + if (print_shell->print.print_resolution == 0) { + XtAppWarning(XtWidgetToApplicationContext(w), + "XawPrintShell: XawUpdateResources: Resolution '0' invalid\n"); + } + + /* Get the paper size... */ + XpGetPageDimensions(XtDisplay(w), pcontext, + &print_shell->print.page_width, &print_shell->print.page_height, + &drawable_paper_area); + /* ... and store it in the widget */ + print_shell->print.min_x = drawable_paper_area.x; + print_shell->print.min_y = drawable_paper_area.y; + print_shell->print.max_x = drawable_paper_area.x + drawable_paper_area.width; + print_shell->print.max_y = drawable_paper_area.y + drawable_paper_area.height; +} + +static void +XawUpdateLayout(Widget w) +{ + XawPrintShellWidget print_shell = (XawPrintShellWidget)w; + + switch( print_shell->print.layoutmode ) + { + case XawPrintLAYOUTMODE_NONE: + break; + case XawPrintLAYOUTMODE_PAGESIZE: + XtResizeWidget(w, + print_shell->print.page_width, + print_shell->print.page_height, + w->core.border_width); + break; + case XawPrintLAYOUTMODE_DRAWABLEAREA: + XtConfigureWidget(w, + print_shell->print.min_x, + print_shell->print.min_y, + print_shell->print.max_x - print_shell->print.min_x, + print_shell->print.max_y - print_shell->print.min_y, + w->core.border_width); + break; + default: + XtAppWarning(XtWidgetToApplicationContext(w), + "XawPrintShell: XawUpdateResources: Invalid layout mode\n"); + break; + } +} + + +/* Update widget attributes+properties when the we receive + * "Xp attribute change"-events (e.g. paper (size/orientation/etc.) + * changed etc.) */ +static void +XawAttributesNotify(Widget w, + XtPointer client, + XEvent *evp, + Boolean *cont) +{ + XawPrintShellWidget print_shell = (XawPrintShellWidget)w; + XPAttributeEvent *xpevp = (XPAttributeEvent *)evp; + + XawUpdateResources(w, xpevp->context); + XawUpdateLayout(w); +} + + + Index: xc/lib/Xaw/sharedlib.c =================================================================== RCS file: /cvs/xorg/xc/lib/Xaw/sharedlib.c,v retrieving revision 1.1 diff -u -r1.1 sharedlib.c --- xc/lib/Xaw/sharedlib.c 14 Nov 2003 15:54:38 -0000 1.1 +++ xc/lib/Xaw/sharedlib.c 13 Apr 2004 23:27:13 -0000 @@ -59,6 +59,7 @@ #include #include #include +#include extern AsciiSinkClassRec asciiSinkClassRec; WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; @@ -168,4 +169,7 @@ extern ViewportClassRec viewportClassRec; WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec; +extern XawPrintShellClassRec xawPrintShellClassRec; +WidgetClass xawPrintShellWidgetClass = (WidgetClass) &xawPrintShellClassRec; + #endif /* SUNSHLIB */ Index: xc/programs/xphelloworld/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xphelloworld/Attic/Imakefile,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 Imakefile --- xc/programs/xphelloworld/Imakefile 13 Apr 2004 05:07:47 -0000 1.1.2.2 +++ xc/programs/xphelloworld/Imakefile 13 Apr 2004 23:27:16 -0000 @@ -2,15 +2,12 @@ #define IHaveSubdirs #define PassCDebugFlags -XCOMM xpxmprintshell and xpawprintshell use Motif widgets -#if HasMotif2 XCOMM Solaris's Motif version is broken and misses XmPrintShell XCOMM (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1366) #ifndef SunArchitecture XPXMHELLOWORLDDIR = xpxmhelloworld #endif /* SunArchitecture */ XPAWHELLOWORLDDIR = xpawhelloworld -#endif /* HasMotif2 */ XPXTHELLOWORLDDIR = xpxthelloworld XPHELLOWORLDDIR = xphelloworld XPSIMPLEHELLOWORLDDIR = xpsimplehelloworld Index: xc/programs/xphelloworld/xpawhelloworld/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xphelloworld/xpawhelloworld/Attic/Imakefile,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 Imakefile --- xc/programs/xphelloworld/xpawhelloworld/Imakefile 13 Apr 2004 03:16:48 -0000 1.1.2.1 +++ xc/programs/xphelloworld/xpawhelloworld/Imakefile 13 Apr 2004 23:27:16 -0000 @@ -1,3 +1,19 @@ -XCOMM $Xorg: Imakefile,v 1.1 2003/07/26 20:54:53 gisburn Exp $ +XCOMM $Xorg: Imakefile,v 1.1 2003/05/12 19:54:53 gisburn Exp $ + + DEPLIBS = XawClientDepLibs +LOCAL_LIBRARIES = -L$(PROJECTROOT)/lib -lXm -lXprintUtil XawClientLibs +SYS_LIBRARIES = MathLibrary +INCLUDES = -I/usr/X11R6/include -XCOMM nothing here yet +DEFINES = + SRCS = xpawhelloworld.c + OBJS = xpawhelloworld.o + +ComplexProgramTarget(xpawhelloworld) + +#ifdef HasDocbookToMan +all:: xpawhelloworld.man + +xpawhelloworld.man: xpawhelloworld.sgml + docbook-to-man xpawhelloworld.sgml >xpawhelloworld.man +#endif Index: xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c =================================================================== RCS file: xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c diff -N xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c 13 Apr 2004 23:27:16 -0000 @@ -0,0 +1,423 @@ + +/* + * $Xorg: xpawhelloworld.c,v 1.1 2003/07/30 14:44:31 gisburn Exp $ + * + * xpawhelloworld - Xprint version of hello world using the + * Athena PrintShell widget class + * + * +Copyright 2003 Roland Mainz + +All Rights Reserved. + +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 +OPEN GROUP 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 name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Roland Mainz + */ + +/* + * Referencess: + * http://nscp.upenn.edu/aix4.3html/libs/motiftr/XmPrintShell.htm + * http://nscp.upenn.edu/aix4.3html/libs/motiftr/XmText.htm + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Turn a NULL pointer string into an empty string */ +#define NULLSTR(x) (((x)!=NULL)?(x):("")) + +#define Error(x) { printf x ; exit(EXIT_FAILURE); } +#define Log(x) { if(verbose) printf x; } + +/* Prototypes */ +static int do_hello_world( int argc, char *argv[], const char *printername, + const char *toFile, const char *sample_string ); + +/* Global vars */ +const char *ProgramName; /* program name (from argv[0]) */ +Bool verbose = False; /* verbose output what the program is doing */ +Bool doPrint = False; /* Do we print on a printer ? */ +Display *pdpy = NULL; /* (Paper) display */ +Screen *pscreen = NULL; /* (Paper) screen (DDX-specific!) */ +XPContext pcontext = None; /* Xprint context */ +void *printtofile_handle = NULL; /* XprintUtil "context" when printing to file */ +Drawable pdrawable = None; /* paper drawable */ + +static +void usage( void ) +{ + fprintf(stderr, "usage: %s [options] string\n", ProgramName); + fprintf(stderr, "-print\tPrint via Xprint instead of displaying on the Xserver\n"); + fprintf(stderr, "-printer printernname\tprinter to use\n"); + fprintf(stderr, "-printfile file\tprint to file instead of printer\n"); + fprintf(stderr, "-v\tverbose output\n"); + fprintf(stderr, "\n"); + exit(EXIT_FAILURE); +} + +int main( int argc, char *argv[] ) +{ + const char *printername = NULL; /* printer to query */ + const char *toFile = NULL; /* output file (instead of printer) */ + XPPrinterList plist; /* list of printers */ + int plist_count; /* number of entries in |plist|-array */ + int i; + int retval; + const char *sample_string; + + ProgramName = argv[0]; + + if( argc < 2 ) + { + usage(); + } + + for( i = 1 ; i < (argc-1) ; i++ ) + { + char *arg = argv[i]; + int len = strlen(arg); + + if (!strncmp("-print", arg, len)) + { + doPrint = True; + } + else if (!strncmp("-printer", arg, len)) + { + if (++i >= argc) + usage(); + printername = argv[i]; + doPrint = True; + } + else if (!strncmp("-printfile", arg, len)) + { + if (++i >= argc) + usage(); + toFile = argv[i]; + doPrint = True; + } + else if (!strncmp("-v", arg, len)) + { + verbose = True; + } + else + { + usage(); + } + } + + sample_string = argv[argc-1]; + + if( doPrint ) + { + plist = XpuGetPrinterList(printername, &plist_count); + + if (!plist) { + fprintf(stderr, "%s: no printers found for printer spec \"%s\".\n", + ProgramName, NULLSTR(printername)); + exit(EXIT_FAILURE); + } + + Log(("Using printer '%s'\n", plist[0].name)); + + retval = do_hello_world(argc, argv, plist[0].name, toFile, sample_string); + + XpuFreePrinterList(plist); + } + else + { + Log(("Displaying on framebuffer Xserver\n")); + + retval = do_hello_world(argc, argv, NULL, NULL, sample_string); + } + + return retval; +} + +typedef struct +{ + int num_pages; + Widget printshell_content; + int num_visible_rows; + XtAppContext appcontext; /* for XtAppSetExitFlag() */ +} MyPrintCallbackData; + +static +int GetCurrPageNum(Widget printshell) +{ + Cardinal n; + Arg args[2]; + int pagenum = -666; /* bah! */ + + n = 0; + XtSetArg(args[n], XawNcurrPageNumInJob, &pagenum); n++; + XtGetValues(printshell, args, n); + + return pagenum; +} + +static +void PrintOnePageCB(Widget pshell, XtPointer context, XtPointer call_data) +{ + MyPrintCallbackData *mpcd = (MyPrintCallbackData *)context; + XawPrintShellCallbackStruct *psp = (XawPrintShellCallbackStruct *)call_data; + int curr_page; + + curr_page = GetCurrPageNum(pshell); + Log(("--> PrintOnePageCB, printing page %d of %d\n", curr_page, mpcd->num_pages)); + + /* Get ready for next page + * Scroll widget to display the next page (except for the first page :) + */ + if (!psp->last_page_in_job && curr_page > 1) + { + /* XmText allows two solutions to scroll a page down + * - Either scroll num_rows_per_page down (this is XmText-specific) + * or + * - Call the "next-page" action procedure (this works for all widgets + * which support this action proc) + */ +#define USE_ACTION_TO_SCROLL_DOWN 1 +#ifdef USE_ACTION_TO_SCROLL_DOWN + Log(("Scrolling down one page ...\n")); + XtCallActionProc(mpcd->printshell_content, "next-page", NULL, NULL, 0); +#else + Log(("Scrolling down %d rows (=one page) ...\n", mpcd->num_visible_rows)); + XmTextScroll(mpcd->printshell_content, mpcd->num_visible_rows); +#endif /* USE_ACTION_TO_SCROLL_DOWN */ + } + + if (curr_page == (int)mpcd->num_pages) + { + Log(("Printing last page.\n")); + psp->last_page_in_job = True; + } + + Log(("PrintOnePageCB: done\n")); +} + +static +void PrintStartJobCB(Widget pshell, XtPointer context, XtPointer call_data) +{ + XawPrintShellCallbackStruct *psp = (XawPrintShellCallbackStruct *)call_data; + + Log(("--> PrintStartJobCB\n")); +} + +static +void PrintEndJobCB(Widget pshell, XtPointer context, XtPointer call_data) +{ + MyPrintCallbackData *mpcd = (MyPrintCallbackData *)context; + XawPrintShellCallbackStruct *psp = (XawPrintShellCallbackStruct *)call_data; + + Log(("--> PrintEndJobCB\n")); + + /* We're done with printing, tell |XtAppMainLoop()| that it can exit */ + XtAppSetExitFlag(mpcd->appcontext); +} + +int do_hello_world( int argc, char *argv[], const char *printername, const char *toFile, const char *sample_string ) +{ + XtAppContext app; + Widget toplevel, + shell, + print_shell, + hello; + long dpi; + char fontname[256]; /* BUG: is this really big enougth ? */ + XFontStruct *textFont; + XmFontList textFontList; + Cardinal n; + Arg args[10]; + MyPrintCallbackData mpcd; + + if( doPrint ) + { + /* Get printer, either by "name" (foobar) or "name@display" (foobar@gaja:5) */ + if( XpuGetPrinter(printername, &pdpy, &pcontext) != 1 ) + Error(("XpuGetPrinter failure.\n")); + + /* Configure the print context (paper size, title etc.) + * We must do this before creating any Xt widgets - otherwise they will + * make wrong assuptions about fonts, resultions etc. ... + */ + XpuSetJobTitle(pdpy, pcontext, "Simple Xprint XawPrintShell widget demo"); + + /* Configuration done, set the context */ + XpSetContext(pdpy, pcontext); + + /* Get default printer resolution */ + if( XpuGetResolution(pdpy, pcontext, &dpi) != 1 ) + { + fprintf(stderr, "No default resolution for printer '%s'\n", printername); + XpuClosePrinterDisplay(pdpy, pcontext); + return(EXIT_FAILURE); + } + + pscreen = XpGetScreenOfContext(pdpy, pcontext); + } + else + { + pdpy = XOpenDisplay(NULL); + if( !pdpy ) + Error(("XOpenDisplay failure.\n")); + + dpi = 0; + + pscreen = XDefaultScreenOfDisplay(pdpy); + } + + toplevel = XawOpenApplication(&app, + pdpy, pscreen, + "xpawprintshelldemo", "XpXawPrintShellDemo", + applicationShellWidgetClass, + &argc, argv); + + if( !toplevel ) + Error(("XawOpenApplication failure.\n")); + + if( doPrint ) + { + n = 0; + XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++; + print_shell = XtCreatePopupShell("myprintshell", + xawPrintShellWidgetClass, + toplevel, args, n); + + /* we're mapping/unmapping at start/end page time */ + XtSetMappedWhenManaged(print_shell, False); + + shell = print_shell; + } + else + { + shell = toplevel; + } + + sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi, dpi); + textFont = XLoadQueryFont(pdpy, fontname); + if( !textFont ) + { + sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi, dpi); + textFont = XLoadQueryFont(pdpy, fontname); + } + if( !textFont ) + Error(("XLoadQueryFont failure.\n")); + textFontList = XmFontListCreate(textFont, XmSTRING_DEFAULT_CHARSET); + + n = 0; + /* Make sure the cursor is off, current Xprt servers do not seem to like + * blinking cursors that much... ;-/ */ + XtSetArg(args[n], XmNcursorPositionVisible, False); n++; + XtSetArg(args[n], XmNvalue, sample_string); n++; + XtSetArg(args[n], XmNfontList, textFontList); n++; + XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; + + hello = XmCreateText(shell, "mytext", args, n); + if( !hello ) + Error(("XmCreateText failure.\n")); + + XtManageChild(hello); + XtRealizeWidget(toplevel); + XtRealizeWidget(shell); + + if( doPrint ) + { + int num_total_rows; + short num_visible_rows; + int num_pages; + + pdpy = XtDisplay(toplevel); + pdrawable = XtWindow(toplevel); + if( !pdpy || !pdrawable ) + Error(("No display.\n")); + + /* Make sure that the Xt machinery is really using the right screen (assertion) */ + if( XpGetScreenOfContext(XtDisplay(toplevel), pcontext) != XtScreen(toplevel) ) + Error(("Widget's screen != print screen. BAD.\n")); + + /* Get number of rows visible per page and the number of total rows + * in the whole text widget... */ + n = 0; + XtSetArg(args[n], XmNrows, &num_visible_rows); n++ ; + XtSetArg(args[n], XmNtotalLines, &num_total_rows); n++ ; + XtGetValues(hello, args, n); + + /* Take away one row to match the one-line overlapping used by the + * "next-page" action proc */ + num_visible_rows -= 1; + + /* Calculate the number of pages */ + num_pages = (num_total_rows+num_visible_rows-1) / num_visible_rows; + Log(("Printing %d pages (num_total_rows=%d, num_visible_rows=%d)...\n", + num_pages, num_total_rows, num_visible_rows)); + + /* Prepare our own context data for the print shell callbacks */ + mpcd.num_pages = num_pages; + mpcd.printshell_content = hello; + mpcd.num_visible_rows = num_visible_rows; + mpcd.appcontext = app; + + /* Setup the print shell callbacks... */ + XtAddCallback(print_shell, XawNpageSetupCallback, PrintOnePageCB, (XtPointer)&mpcd); + XtAddCallback(print_shell, XawNstartJobCallback, PrintStartJobCB, NULL); + XtAddCallback(print_shell, XawNendJobCallback, PrintEndJobCB, (XtPointer)&mpcd); + + /* ... and finally start the print job. */ + if( toFile ) + { + printtofile_handle = XpuStartJobToFile(pdpy, pcontext, toFile); + if( !printtofile_handle ) + { + perror("XpuStartJobToFile failure"); + Error(("XpuStartJobToFile failure.")); + } + } + else + { + XpuStartJobToSpooler(pdpy); + } + } + + XtAppMainLoop(app); + + if( doPrint ) + { + if( toFile ) + { + if( XpuWaitForPrintFileChild(printtofile_handle) != XPGetDocFinished ) + { + fprintf(stderr, "%s: Error while printing to file.\n", ProgramName); + } + } + + /* We have to use XpDestroyContext() and XtCloseDisplay() instead + * of XpuClosePrinterDisplay() to make libXt happy... */ + if( pcontext != None ) + XpDestroyContext(pdpy, pcontext); + XtCloseDisplay(pdpy); + } + + return EXIT_SUCCESS; +} Index: xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.man =================================================================== RCS file: xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.man diff -N xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.man Index: xc/programs/xphelloworld/xpxmhelloworld/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xphelloworld/xpxmhelloworld/Attic/Imakefile,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 Imakefile --- xc/programs/xphelloworld/xpxmhelloworld/Imakefile 13 Apr 2004 03:16:48 -0000 1.1.2.1 +++ xc/programs/xphelloworld/xpxmhelloworld/Imakefile 13 Apr 2004 23:27:16 -0000 @@ -1,6 +1,6 @@ XCOMM $Xorg: Imakefile,v 1.1 2003/05/12 19:54:53 gisburn Exp $ -LOCAL_LIBRARIES = $(XLIB) -lXm -lXt -lXp -lXprintUtil +LOCAL_LIBRARIES = -L$(PROJECTROOT)/lib -lXm -lXt $(XPLIB) -lXprintUtil $(XLIB) SYS_LIBRARIES = MathLibrary DEPLIBS = $(DEPXLIB) INCLUDES = -I/usr/X11R6/include