Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.28 diff -u -2 -0 -r1.28 ChangeLog --- a/xc/ChangeLog 16 May 2004 05:08:39 -0000 1.28 +++ b/xc/ChangeLog 16 May 2004 21:47:58 -0000 @@ -1,20 +1,26 @@ +2004-05-16 Roland Mainz + * xc/programs/xdpyinfo/Imakefile + * xc/programs/xdpyinfo/xdpyinfo.c + BugZilla #623: RFE: "xdpyinfo" should have support for + XpExtension. + 2004-05-15 Alan Coopersmith * xc/programs/Xserver/fb/fb.h * xc/programs/Xserver/fb/fboverlay.c * xc/programs/Xserver/fb/fbscreen.c - Change #ifdef for checking for old format miScreenInit to FB_OLD_MISCREENINIT for easier portability to xservers with updated screen structs but old function prototypes. Make it automatically defined if FB_OLD_SCREEN is defined. - Add _LP64 to list of #ifdefs for 64-bit platforms to support 64-bit Solaris. 2004-05-15 Alan Coopersmith * xc/programs/Xserver/hw/xfree86/xf86config/Imakefile * xc/programs/Xserver/hw/xfree86/xf86config/xorgconfig.c - Clean up server name changes from TM branch - Set default XKB rules file name correctly - Use default font path from Imake configuration for the default font path in generated xorg.conf files. - Use path variables from Imake configuration for paths to files, in case vendor has configured them to install somewhere other than Index: xc/programs/xdpyinfo/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xdpyinfo/Imakefile,v retrieving revision 1.2 diff -u -2 -0 -r1.2 Imakefile --- a/xc/programs/xdpyinfo/Imakefile 23 Apr 2004 19:54:43 -0000 1.2 +++ b/xc/programs/xdpyinfo/Imakefile 16 May 2004 21:48:07 -0000 @@ -48,25 +48,25 @@ MULTIBUFDEFINES = -DMULTIBUFFER #endif #if BuildXKB XKBDEFINES = -DXKB #endif #if BuildXineramaLibrary XINERAMADEFINES = -DPANORAMIX XINERAMALIBS = $(XINERAMALIB) #endif OTHERDEFINES = $(SHMDEFINES) $(XKBDEFINES) $(XINPUTDEFINES) \ $(MULTIBUFDEFINES) $(XIEDEFINES) $(XRENDERDEFINES) \ $(XINERAMADEFINES) OTHERDEPLIBS = $(XINPUTDEPLIBS) $(XIEDEPLIBS) $(XRENDERDEPLIBS) OTHERLIBS = $(XINPUTLIBS) $(XIELIBS) $(XRENDERLIBS) $(XINERAMALIBS) DEFINES = $(OTHERDEFINES) $(XF86DEFINES) DEPLIBS = $(DEPXTESTLIB) XkbClientDepLibs $(OTHERDEPLIBS) \ - $(DEPXF86LIBS) $(DEPXLIB) + $(DEPXF86LIBS) $(DEPXPLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTESTLIB) XkbClientLibs $(OTHERLIBS) \ - $(XF86LIBS) $(XLIB) + $(XF86LIBS) $(XPLIB) $(XLIB) SimpleProgramTarget(xdpyinfo) Index: xc/programs/xdpyinfo/xdpyinfo.c =================================================================== RCS file: /cvs/xorg/xc/programs/xdpyinfo/xdpyinfo.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 xdpyinfo.c --- a/xc/programs/xdpyinfo/xdpyinfo.c 23 Apr 2004 19:54:43 -0000 1.2 +++ b/xc/programs/xdpyinfo/xdpyinfo.c 16 May 2004 21:48:08 -0000 @@ -53,44 +53,48 @@ #include #include #endif #ifdef XFreeXDGA #include #include #endif #ifdef XF86MISC #include #include #endif #ifdef XINPUT #include #endif #ifdef XRENDER #include #endif #ifdef PANORAMIX #include #endif +#include #include #include #include +/* Turn a NULL pointer string into an empty string */ +#define NULLSTR(x) (((x)!=NULL)?(x):("")) + char *ProgramName; Bool queryExtensions = False; static int print_event_mask(char *buf, int lastcol, int indent, long mask); static int StrCmp(const void *a, const void *b) { return strcmp(*(char **)a, *(char **)b); } static void print_extension_info(Display *dpy) { int n = 0; char **extlist = XListExtensions (dpy, &n); printf ("number of extensions: %d\n", n); if (extlist) { register int i; @@ -998,40 +1002,119 @@ if (!XineramaIsActive(dpy)) { printf(" Xinerama is inactive.\n"); } else { int i, count = 0; XineramaScreenInfo *xineramaScreens = XineramaQueryScreens(dpy, &count); for (i = 0; i < count; i++) { XineramaScreenInfo *xs = &xineramaScreens[i]; printf(" head #%d: %dx%d @ %d,%d\n", xs->screen_number, xs->width, xs->height, xs->x_org, xs->y_org); } XFree(xineramaScreens); } return 1; } #endif /* PANORAMIX */ +static +void print_xprint_attrpool(const char *name, const char *attrpool) +{ + int c; + const char *s = attrpool; + + printf(" %s:\n ", name); + + while( (c = *s++) != '\0' ) + { + if (c == '\n') { + printf("\n "); + } + else + { + fputc(c, stdout); + } + } + fputc('\n', stdout); +} + +static int +print_xprint_info(Display *dpy, char *extname) +{ + short majorrev, + minorrev; + int xp_event_base, + xp_error_base; + XPPrinterList printerlist; + int plcount, + i; + + if (XpQueryVersion(dpy, &majorrev, &minorrev) == False) { + return 0; + } + + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + if (XpQueryExtension(dpy, &xp_event_base, &xp_error_base) == False) { + printf(" XpQueryExtension() failed.\n"); + return 0; + } + + printf(" xp_event_base=%d, xp_error_base=%d\n", xp_event_base, xp_error_base); + + printerlist = XpGetPrinterList(dpy, NULL, &plcount); + /* Print number of printers, then each printer name and description */ + printf(" Found %d printers on this server.\n", plcount); + for( i = 0 ; i < plcount ; i++) { + printf(" printer %d: name='%s', descr='%s'\n", + i, NULLSTR(printerlist[i].name), NULLSTR(printerlist[i].desc)); + } + + for( i = 0 ; i < plcount ; i++) { + char *printername = printerlist[i].name; + XPContext pcontext; + char *s; + + printf(" Attributes of printer '%s':\n", NULLSTR(printername)); + + pcontext = XpCreateContext(dpy, printername); + if (pcontext == None) { + printf(" Error: Could not open printer.\n"); + continue; + } + + s=XpGetAttributes(dpy, pcontext, XPJobAttr); print_xprint_attrpool("XPJobAttr", s); XFree(s); + s=XpGetAttributes(dpy, pcontext, XPDocAttr); print_xprint_attrpool("XPDocAttr", s); XFree(s); + s=XpGetAttributes(dpy, pcontext, XPPageAttr); print_xprint_attrpool("XPPageAttr", s); XFree(s); + s=XpGetAttributes(dpy, pcontext, XPPrinterAttr); print_xprint_attrpool("XPPrinterAttr", s); XFree(s); + s=XpGetAttributes(dpy, pcontext, XPServerAttr); print_xprint_attrpool("XPServerAttr", s); XFree(s); + + XpDestroyContext(dpy, pcontext); + } + + XpFreePrinterList(printerlist); + + return 1; +} /* utilities to manage the list of recognized extensions */ typedef int (*ExtensionPrintFunc)( Display *, char * ); typedef struct { char *extname; ExtensionPrintFunc printfunc; Bool printit; } ExtensionPrintInfo; ExtensionPrintInfo known_extensions[] = { #ifdef MITSHM {"MIT-SHM", print_mitshm_info, False}, #endif /* MITSHM */ #ifdef XKB @@ -1046,40 +1129,41 @@ {XF86DGANAME, print_dga_info, False}, #endif /* XFreeXDGA */ #ifdef XF86VIDMODE {XF86VIDMODENAME, print_XF86VidMode_info, False}, #endif /* XF86VIDMODE */ #ifdef XF86MISC {XF86MISCNAME, print_XF86Misc_info, False}, #endif /* XF86MISC */ {XTestExtensionName, print_xtest_info, False}, {"DOUBLE-BUFFER", print_dbe_info, False}, {"RECORD", print_record_info, False}, #ifdef XINPUT {INAME, print_xinput_info, False}, #endif #ifdef XRENDER {RENDER_NAME, print_xrender_info, False}, #endif #ifdef PANORAMIX {"XINERAMA", print_xinerama_info, False}, #endif + {XP_PRINTNAME, print_xprint_info, False}, /* add new extensions here */ }; int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0]; static void print_known_extensions(FILE *f) { int i, col; for (i = 0, col = 6; i < num_known_extensions; i++) { if ((col += strlen(known_extensions[i].extname)+1) > 79) { col = 6; fprintf(f, "\n "); } fprintf(f, "%s ", known_extensions[i].extname); } }