diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:47 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:47 +0000 |
commit | 694613185002aa7fb12b13e51d1c8eff34adeaa5 (patch) | |
tree | c9077dc1d51e6fc2ea3cda644cad4f5440c4b3c1 /xdpyinfo.c | |
parent | 212617e163d792b20d025502f4138b6bdb7829a0 (diff) |
merge XFree86 4.3.0.1 to -CURRENT
Diffstat (limited to 'xdpyinfo.c')
-rw-r--r-- | xdpyinfo.c | 630 |
1 files changed, 551 insertions, 79 deletions
@@ -29,32 +29,66 @@ in this Software without prior written authorization from The Open Group. * Author: Jim Fulton, MIT X Consortium */ +/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.28 2002/09/26 02:56:51 keithp Exp $ */ + #include <X11/Xlib.h> #include <X11/Xutil.h> +#ifdef MULTIBUFFER #include <X11/extensions/multibuf.h> +#endif +#ifdef XIE #include <X11/extensions/XIElib.h> +#endif #include <X11/extensions/XTest.h> #include <X11/extensions/sync.h> +#include <X11/Xproto.h> #include <X11/extensions/Xdbe.h> #include <X11/extensions/record.h> +#include <X11/extensions/shape.h> #ifdef MITSHM #include <X11/extensions/XShm.h> #endif +#ifdef XKB +#include <X11/extensions/XKB.h> +#include <X11/XKBlib.h> +#endif +#ifdef XF86VIDMODE +#include <X11/extensions/xf86vmode.h> +#include <X11/extensions/xf86vmstr.h> +#endif +#ifdef XFreeXDGA +#include <X11/extensions/xf86dga.h> +#include <X11/extensions/xf86dgastr.h> +#endif +#ifdef XF86MISC +#include <X11/extensions/xf86misc.h> +#include <X11/extensions/xf86mscstr.h> +#endif +#ifdef XINPUT +#include <X11/extensions/XInput.h> +#endif +#ifdef XRENDER +#include <X11/extensions/Xrender.h> +#endif +#ifdef PANORAMIX +#include <X11/extensions/Xinerama.h> +#endif #include <X11/Xos.h> #include <stdio.h> +#include <stdlib.h> char *ProgramName; Bool queryExtensions = False; -static int StrCmp(a, b) - char **a, **b; +static int print_event_mask(char *buf, int lastcol, int indent, long mask); + +static int StrCmp(const void *a, const void *b) { - return strcmp(*a, *b); + return strcmp(*(char **)a, *(char **)b); } -void -print_extension_info (dpy) - Display *dpy; +static void +print_extension_info(Display *dpy) { int n = 0; char **extlist = XListExtensions (dpy, &n); @@ -84,9 +118,8 @@ print_extension_info (dpy) } } -void -print_display_info (dpy) - Display *dpy; +static void +print_display_info(Display *dpy) { char dummybuf[40]; char *cp; @@ -102,10 +135,52 @@ print_display_info (dpy) ProtocolVersion (dpy), ProtocolRevision (dpy)); printf ("vendor string: %s\n", ServerVendor (dpy)); printf ("vendor release number: %d\n", VendorRelease (dpy)); + + if (strstr(ServerVendor (dpy), "XFree86")) { + int vendrel = VendorRelease(dpy); + + printf("XFree86 version: "); + if (vendrel < 336) { + /* + * vendrel was set incorrectly for 3.3.4 and 3.3.5, so handle + * those cases here. + */ + printf("%d.%d.%d", vendrel / 100, + (vendrel / 10) % 10, + vendrel % 10); + } else if (vendrel < 3900) { + /* 3.3.x versions, other than the exceptions handled above */ + printf("%d.%d", vendrel / 1000, + (vendrel / 100) % 10); + if (((vendrel / 10) % 10) || (vendrel % 10)) { + printf(".%d", (vendrel / 10) % 10); + if (vendrel % 10) { + printf(".%d", vendrel % 10); + } + } + } else if (vendrel < 40000000) { + /* 4.0.x versions */ + printf("%d.%d", vendrel / 1000, + (vendrel / 10) % 10); + if (vendrel % 10) { + printf(".%d", vendrel % 10); + } + } else { + /* post-4.0.x */ + printf("%d.%d.%d", vendrel / 10000000, + (vendrel / 100000) % 100, + (vendrel / 1000) % 100); + if (vendrel % 1000) { + printf(".%d", vendrel % 1000); + } + } + printf("\n"); + } + req_size = XExtendedMaxRequestSize (dpy); if (!req_size) req_size = XMaxRequestSize (dpy); printf ("maximum request size: %ld bytes\n", req_size * 4); - printf ("motion buffer size: %d\n", XDisplayMotionBufferSize (dpy)); + printf ("motion buffer size: %ld\n", XDisplayMotionBufferSize (dpy)); switch (BitmapBitOrder (dpy)) { case LSBFirst: cp = "LSBFirst"; break; @@ -182,9 +257,8 @@ print_display_info (dpy) printf ("number of screens: %d\n", ScreenCount (dpy)); } -void -print_visual_info (vip) - XVisualInfo *vip; +static void +print_visual_info(XVisualInfo *vip) { char errorbuf[40]; /* for sprintfing into */ char *class = NULL; /* for printing */ @@ -219,10 +293,8 @@ print_visual_info (vip) vip->bits_per_rgb); } -void -print_screen_info (dpy, scr) - Display *dpy; - int scr; +static void +print_screen_info(Display *dpy, int scr) { Screen *s = ScreenOfDisplay (dpy, scr); /* opaque structure */ XVisualInfo viproto; /* fill in for getting info */ @@ -277,7 +349,7 @@ print_screen_info (dpy, scr) printf (" default colormap: 0x%lx\n", DefaultColormap (dpy, scr)); printf (" default number of colormap cells: %d\n", DisplayCells (dpy, scr)); - printf (" preallocated pixels: black %d, white %d\n", + printf (" preallocated pixels: black %ld, white %ld\n", BlackPixel (dpy, scr), WhitePixel (dpy, scr)); printf (" options: backing-store %s, save-unders %s\n", (DoesBackingStore (s) == NotUseful) ? no : @@ -343,11 +415,11 @@ static struct _event_table { { "OwnerGrabButtonMask ", OwnerGrabButtonMask }, { NULL, 0 }}; -int print_event_mask (buf, lastcol, indent, mask) - char *buf; /* string to write into */ - int lastcol; /* strlen(buf)+1 */ - int indent; /* amount by which to indent */ - long mask; /* event mask */ +static int +print_event_mask(char *buf, /* string to write into */ + int lastcol, /* strlen(buf)+1 */ + int indent, /* amount by which to indent */ + long mask) /* event mask */ { struct _event_table *etp; int len; @@ -379,11 +451,9 @@ int print_event_mask (buf, lastcol, indent, mask) return (bitsfound); } -void -print_standard_extension_info(dpy, extname, majorrev, minorrev) - Display *dpy; - char *extname; - int majorrev, minorrev; +static void +print_standard_extension_info(Display *dpy, char *extname, + int majorrev, int minorrev) { int opcode, event, error; @@ -398,10 +468,9 @@ print_standard_extension_info(dpy, extname, majorrev, minorrev) printf("\n"); } -int -print_multibuf_info(dpy, extname) - Display *dpy; - char *extname; +#ifdef MULTIBUFFER +static int +print_multibuf_info(Display *dpy, char *extname) { int i, j; /* temp variable: iterator */ int nmono, nstereo; /* count */ @@ -440,8 +509,10 @@ print_multibuf_info(dpy, extname) } return 1; } /* end print_multibuf_info */ +#endif +#ifdef XIE /* XIE stuff */ char *subset_names[] = { NULL, "FULL", "DIS" }; @@ -461,10 +532,8 @@ char *group_names[] = { /* 0 */ "Default", /* 24 */ "WhiteAdjust" }; -int -print_xie_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_xie_info(Display *dpy, char *extname) { XieExtensionInfo *xieInfo; int i; @@ -485,7 +554,7 @@ print_xie_info(dpy, extname) printf(" uncnst_max_exp: %d\n", xieInfo->uncnst_max_exp); printf(" cnst_levels:"); for (i = 0; i < xieInfo->n_cnst_levels; i++) - printf(" %d", xieInfo->cnst_levels[i]); + printf(" %ld", xieInfo->cnst_levels[i]); printf("\n"); if (!XieQueryTechniques(dpy, xieValAll, &ntechs, &techs)) @@ -507,11 +576,10 @@ print_xie_info(dpy, extname) } return 1; } /* end print_xie_info */ +#endif -int -print_xtest_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_xtest_info(Display *dpy, char *extname) { int majorrev, minorrev, foo; @@ -521,10 +589,8 @@ print_xtest_info(dpy, extname) return 1; } -int -print_sync_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_sync_info(Display *dpy, char *extname) { int majorrev, minorrev; XSyncSystemCounter *syscounters; @@ -539,7 +605,7 @@ print_sync_info(dpy, extname) for (i = 0; i < ncounters; i++) { printf(" %s id: 0x%08x resolution_lo: %d resolution_hi: %d\n", - syscounters[i].name, syscounters[i].counter, + syscounters[i].name, (unsigned int)syscounters[i].counter, XSyncValueLow32(syscounters[i].resolution), XSyncValueHigh32(syscounters[i].resolution)); } @@ -547,10 +613,8 @@ print_sync_info(dpy, extname) return 1; } -int -print_shape_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_shape_info(Display *dpy, char *extname) { int majorrev, minorrev; @@ -560,11 +624,181 @@ print_shape_info(dpy, extname) return 1; } +#ifdef XFreeXDGA +static int +print_dga_info(Display *dpy, char *extname) +{ + int majorrev, minorrev, width, bank, ram, offset, flags; + + if (!XF86DGAQueryVersion(dpy, &majorrev, &minorrev)) + return 0; + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + if (!XF86DGAQueryDirectVideo(dpy, DefaultScreen(dpy), &flags) + || ! (flags & XF86DGADirectPresent) ) + { + printf(" DGA not available on screen %d.\n", DefaultScreen(dpy)); + return 1; + } + + if (!XF86DGAGetVideoLL(dpy, DefaultScreen(dpy), &offset, + &width, &bank, &ram)) + return 0; + printf(" Base address = 0x%X, Width = %d, Bank size = %d," + " RAM size = %dk\n", offset, width, bank, ram); + + return 1; +} +#endif + +#ifdef XF86VIDMODE +#define V_PHSYNC 0x001 +#define V_NHSYNC 0x002 +#define V_PVSYNC 0x004 +#define V_NVSYNC 0x008 +#define V_INTERLACE 0x010 +#define V_DBLSCAN 0x020 +#define V_CSYNC 0x040 +#define V_PCSYNC 0x080 +#define V_NCSYNC 0x100 + +static int +print_XF86VidMode_info(Display *dpy, char *extname) +{ + int majorrev, minorrev, modecount, dotclock, i; + XF86VidModeMonitor monitor; + XF86VidModeModeLine modeline; + XF86VidModeModeInfo **modelines; + + if (!XF86VidModeQueryVersion(dpy, &majorrev, &minorrev)) + return 0; + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + if (!XF86VidModeGetMonitor(dpy, DefaultScreen(dpy), &monitor)) + return 0; + printf(" Monitor Information:\n"); + printf(" Vendor: %s, Model: %s\n", monitor.vendor, monitor.model); + printf(" Num hsync: %d, Num vsync: %d\n", monitor.nhsync, monitor.nvsync); + for (i = 0; i < monitor.nhsync; i++) { + printf(" hsync range %d: %6.2f - %6.2f\n", i, monitor.hsync[i].lo, + monitor.hsync[i].hi); + } + for (i = 0; i < monitor.nvsync; i++) { + printf(" vsync range %d: %6.2f - %6.2f\n", i, monitor.vsync[i].lo, + monitor.vsync[i].hi); + } + + if ((majorrev > 0) || (majorrev == 0 && minorrev > 5)) { + if (!XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &modecount, + &modelines)) + return 0; + printf(" Available Video Mode Settings:\n"); + printf(" Clock Hdsp Hbeg Hend Httl Vdsp Vbeg Vend Vttl Flags\n"); + for (i = 0; i < modecount; i++) { + printf(" %6.2f %4d %4d %4d %4d %4d %4d %4d %4d ", + (float)modelines[i]->dotclock/1000.0, + modelines[i]->hdisplay, modelines[i]->hsyncstart, + modelines[i]->hsyncend, modelines[i]->htotal, + modelines[i]->vdisplay, modelines[i]->vsyncstart, + modelines[i]->vsyncend, modelines[i]->vtotal); + if (modelines[i]->flags & V_PHSYNC) printf(" +hsync"); + if (modelines[i]->flags & V_NHSYNC) printf(" -hsync"); + if (modelines[i]->flags & V_PVSYNC) printf(" +vsync"); + if (modelines[i]->flags & V_NVSYNC) printf(" -vsync"); + if (modelines[i]->flags & V_INTERLACE) printf(" interlace"); + if (modelines[i]->flags & V_CSYNC) printf(" composite"); + if (modelines[i]->flags & V_PCSYNC) printf(" +csync"); + if (modelines[i]->flags & V_PCSYNC) printf(" -csync"); + if (modelines[i]->flags & V_DBLSCAN) printf(" doublescan"); + printf("\n"); + } + + if (!XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), + &dotclock, &modeline)) + return 0; + printf(" Current Video Mode Setting:\n"); + printf(" %6.2f %4d %4d %4d %4d %4d %4d %4d %4d ", + (float)dotclock/1000.0, + modeline.hdisplay, modeline.hsyncstart, + modeline.hsyncend, modeline.htotal, + modeline.vdisplay, modeline.vsyncstart, + modeline.vsyncend, modeline.vtotal); + if (modeline.flags & V_PHSYNC) printf(" +hsync"); + if (modeline.flags & V_NHSYNC) printf(" -hsync"); + if (modeline.flags & V_PVSYNC) printf(" +vsync"); + if (modeline.flags & V_NVSYNC) printf(" -vsync"); + if (modeline.flags & V_INTERLACE) printf(" interlace"); + if (modeline.flags & V_CSYNC) printf(" composite"); + if (modeline.flags & V_PCSYNC) printf(" +csync"); + if (modeline.flags & V_PCSYNC) printf(" -csync"); + if (modeline.flags & V_DBLSCAN) printf(" doublescan"); + printf("\n"); + } + + return 1; +} +#endif + +#ifdef XF86MISC + +char *kbdtable[] = { "Unknown", "84-key", "101-key", "Other", "Xqueue" }; +char *msetable[] = { "None", "Microsoft", "MouseSystems", "MMSeries", + "Logitech", "BusMouse", "Mouseman", "PS/2", "MMHitTab", + "GlidePoint", "IntelliMouse", "ThinkingMouse", + "IMPS/2", "ThinkingMousePS/2", "MouseManPlusPS/2", + "GlidePointPS/2", "NetMousePS/2", "NetScrollPS/2", + "SysMouse", "Auto" }; +char *flgtable[] = { "None", "ClearDTR", "ClearRTS", + "ClearDTR and ClearRTS" }; + +static int +print_XF86Misc_info(Display *dpy, char *extname) +{ + int majorrev, minorrev; + XF86MiscMouseSettings mouseinfo; + XF86MiscKbdSettings kbdinfo; + + if (!XF86MiscQueryVersion(dpy, &majorrev, &minorrev)) + return 0; + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + if ((majorrev > 0) || (majorrev == 0 && minorrev > 0)) { + if (!XF86MiscGetKbdSettings(dpy, &kbdinfo)) + return 0; + printf(" Keyboard Settings- Type: %s, Rate: %d, Delay: %d, ServerNumLock: %s\n", + kbdtable[kbdinfo.type], kbdinfo.rate, kbdinfo.delay, + (kbdinfo.servnumlock? "yes": "no")); + + if (!XF86MiscGetMouseSettings(dpy, &mouseinfo)) + return 0; + printf(" Mouse Settings- Device: %s, Type: ", + strlen(mouseinfo.device) == 0 ? "None": mouseinfo.device); + if (mouseinfo.type == MTYPE_XQUEUE) + printf("Xqueue\n"); + else if (mouseinfo.type == MTYPE_OSMOUSE) + printf("OSMouse\n"); + else if (mouseinfo.type <= MTYPE_AUTOMOUSE) + printf("%s\n", msetable[mouseinfo.type+1]); + else + printf("Unknown\n"); + printf(" BaudRate: %d, SampleRate: %d, Resolution: %d\n", + mouseinfo.baudrate, mouseinfo.samplerate, mouseinfo.resolution); + printf(" Emulate3Buttons: %s, Emulate3Timeout: %d ms\n", + mouseinfo.emulate3buttons? "yes": "no", mouseinfo.emulate3timeout); + printf(" ChordMiddle: %s, Flags: %s\n", + mouseinfo.chordmiddle? "yes": "no", + flgtable[(mouseinfo.flags & MF_CLEAR_DTR? 1: 0) + +(mouseinfo.flags & MF_CLEAR_RTS? 1: 0)] ); + printf(" Buttons: %d\n", mouseinfo.buttons); + } + + return 1; +} +#endif + #ifdef MITSHM -int -print_mitshm_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_mitshm_info(Display *dpy, char *extname) { int majorrev, minorrev; Bool sharedPixmaps; @@ -586,10 +820,31 @@ print_mitshm_info(dpy, extname) } #endif /* MITSHM */ -int -print_dbe_info(dpy, extname) - Display *dpy; - char *extname; +#ifdef XKB +static int +print_xkb_info(Display *dpy, char *extname) +{ + int opcode, eventbase, errorbase, majorrev, minorrev; + + if (!XkbQueryExtension(dpy, &opcode, &eventbase, &errorbase, + &majorrev, &minorrev)) { + return 0; + } + printf("%s version %d.%d ", extname, majorrev, minorrev); + + printf ("opcode: %d", opcode); + if (eventbase) + printf (", base event: %d", eventbase); + if (errorbase) + printf (", base error: %d", errorbase); + printf("\n"); + + return 1; +} +#endif + +static int +print_dbe_info(Display *dpy, char *extname) { int majorrev, minorrev; XdbeScreenVisualInfo *svi; @@ -616,10 +871,8 @@ print_dbe_info(dpy, extname) return 1; } -int -print_record_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_record_info(Display *dpy, char *extname) { int majorrev, minorrev; @@ -629,6 +882,198 @@ print_record_info(dpy, extname) return 1; } +#ifdef XINPUT +static int +print_xinput_info(Display *dpy, char *extname) +{ + int loop, num_extensions, num_devices; + char **extensions; + XDeviceInfo *devices; + XExtensionVersion *ext; + + ext = XGetExtensionVersion(dpy, extname); + + if (!ext || (ext == (XExtensionVersion*) NoSuchExtension)) + return 0; + + print_standard_extension_info(dpy, extname, ext->major_version, + ext->minor_version); + + extensions = XListExtensions(dpy, &num_extensions); + for (loop = 0; loop < num_extensions && + (strcmp(extensions[loop], extname) != 0); loop++); + XFreeExtensionList(extensions); + if (loop != num_extensions) { + printf(" Extended devices :\n"); + devices = XListInputDevices(dpy, &num_devices); + for(loop=0; loop<num_devices; loop++) { + printf(" \"%s\" [", devices[loop].name ? devices[loop].name : "<noname>"); + switch(devices[loop].use) { + case IsXPointer: + printf("XPointer]\n"); + break; + case IsXKeyboard: + printf("XKeyboard]\n"); + break; + case IsXExtensionDevice: + printf("XExtensionDevice]\n"); + break; + default: + printf("invalid value]\n"); + break; + } + } + XFreeDeviceList(devices); + return 1; + } + else + return 0; +} +#endif + +#ifdef XRENDER +static int +print_xrender_info(Display *dpy, char *extname) +{ + int loop, num_extensions; + char **extensions; + XRenderPictFormat *pictform; + int count; + int major, minor; + int i, j; + XVisualInfo viproto; /* fill in for getting info */ + XVisualInfo *vip; /* retured info */ + int nvi; /* number of elements returned */ + int ndepths = 0, *depths = NULL; +#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 + XFilters *filters; + int f; +#endif + + if (!XRenderQueryVersion (dpy, &major, &minor)) + return 0; + + print_standard_extension_info(dpy, extname, major, minor); + + extensions = XListExtensions(dpy, &num_extensions); + for (loop = 0; loop < num_extensions && + (strcmp(extensions[loop], extname) != 0); loop++); + XFreeExtensionList(extensions); + if (loop != num_extensions) { + printf (" Render formats :\n"); + for (count = 0; (pictform = XRenderFindFormat (dpy, 0, 0, count)); count++) + { + printf (" pict format:\n"); + printf ("\tformat id: 0x%lx\n", pictform->id); + printf ("\ttype: %s\n", + pictform->type == PictTypeIndexed ? "Indexed" : "Direct"); + printf ("\tdepth: %d\n", pictform->depth); + if (pictform->type == PictTypeDirect) { + printf("\talpha: %2d mask 0x%x\n", pictform->direct.alpha, pictform->direct.alphaMask); + printf("\tred: %2d mask 0x%x\n", pictform->direct.red, pictform->direct.redMask); + printf("\tgreen: %2d mask 0x%x\n", pictform->direct.green, pictform->direct.greenMask); + printf("\tblue: %2d mask 0x%x\n", pictform->direct.blue, pictform->direct.blueMask); + } + else + printf("\tcolormap 0x%lx\n", pictform->colormap); + } + printf (" Screen formats :\n"); + for (i = 0; i < ScreenCount (dpy); i++) { + nvi = 0; + viproto.screen = i; + vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); + printf (" Screen %d", i); +#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 + switch (XRenderQuerySubpixelOrder (dpy, i)) { + case SubPixelUnknown: printf (" (sub-pixel order Unknown)"); break; + case SubPixelHorizontalRGB: printf (" (sub-pixel order Horizontal RGB)"); break; + case SubPixelHorizontalBGR: printf (" (sub-pixel order Horizontal BGR)"); break; + case SubPixelVerticalRGB: printf (" (sub-pixel order Vertical RGB)"); break; + case SubPixelVerticalBGR: printf (" (sub-pixel order Vertical BGR)"); break; + case SubPixelNone: printf (" (sub-pixel order None)"); break; + } + printf ("\n"); + filters = XRenderQueryFilters (dpy, RootWindow (dpy, i)); + if (filters) + { + printf (" filters: "); + for (f = 0; f < filters->nfilter; f++) + { + printf ("%s", filters->filter[f]); + if (f < filters->nalias && filters->alias[f] != FilterAliasNone) + printf ("(%s)", filters->filter[filters->alias[f]]); + if (f < filters->nfilter - 1) + printf (", "); + } + XFree (filters); + } +#endif + printf ("\n"); + for (j = 0; j < nvi; j++) + { + printf (" visual format:\n"); + printf (" visual id: 0x%lx\n", vip[j].visualid); + pictform = XRenderFindVisualFormat (dpy, vip[j].visual); + if (pictform) + printf(" pict format id: 0x%lx\n", pictform->id); + else + printf(" pict format id: None\n"); + } + if (vip) XFree ((char *) vip); + depths = XListDepths (dpy, i, &ndepths); + if (!depths) ndepths = 0; + for (j = 0; j < ndepths; j++) + { + XRenderPictFormat templ; + + templ.depth = depths[j]; + printf (" depth formats:\n"); + printf (" depth %d\n", depths[j]); + for (count = 0; (pictform = XRenderFindFormat (dpy, PictFormatDepth, &templ, count)); count++) + printf(" pict format id: 0x%lx\n", pictform->id); + } + } + return 1; + } + else + return 0; +} +#endif /* XRENDER */ + + +#ifdef PANORAMIX + +static int +print_xinerama_info(Display *dpy, char *extname) +{ + int majorrev, minorrev; + + if (!XineramaQueryVersion (dpy, &majorrev, &minorrev)) + return 0; + + print_standard_extension_info(dpy, extname, majorrev, minorrev); + + 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 */ + + /* utilities to manage the list of recognized extensions */ @@ -649,33 +1094,61 @@ ExtensionPrintInfo known_extensions[] = #ifdef MITSHM {"MIT-SHM", print_mitshm_info, False}, #endif /* MITSHM */ +#ifdef XKB + {XkbName, print_xkb_info, False}, +#endif /* XKB */ +#ifdef MULTIBUFFER {MULTIBUFFER_PROTOCOL_NAME, print_multibuf_info, False}, +#endif {"SHAPE", print_shape_info, False}, {SYNC_NAME, print_sync_info, False}, +#ifdef XFreeXDGA + {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 */ +#ifdef XIE {xieExtName, print_xie_info, False}, +#endif {XTestExtensionName, print_xtest_info, False}, {"DOUBLE-BUFFER", print_dbe_info, False}, - {"RECORD", print_record_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 /* add new extensions here */ - /* wish list: PEX XKB LBX */ + /* wish list: PEX */ }; int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0]; -void -print_known_extensions(f) - FILE *f; +static void +print_known_extensions(FILE *f) { - int i; - for (i = 0; i < num_known_extensions; i++) + 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); } } -void -mark_extension_for_printing(extname) - char *extname; +static void +mark_extension_for_printing(char *extname) { int i; @@ -698,9 +1171,8 @@ mark_extension_for_printing(extname) } } -void -print_marked_extensions(dpy) - Display *dpy; +static void +print_marked_extensions(Display *dpy) { int i; for (i = 0; i < num_known_extensions; i++) @@ -718,7 +1190,8 @@ print_marked_extensions(dpy) } } -static void usage () +static void +usage(void) { fprintf (stderr, "usage: %s [options]\n", ProgramName); fprintf (stderr, "-display displayname\tserver to query\n"); @@ -730,9 +1203,8 @@ static void usage () exit (1); } -int main (argc, argv) - int argc; - char *argv[]; +int +main(int argc, char *argv[]) { Display *dpy; /* X connection */ char *displayname = NULL; /* server to contact */ |