Filewatcher File Search File Search
Catalog
Content Search
» » » » » » XFree86-4.3.0-2.90.55.src.rpm » Content »
pkg://XFree86-4.3.0-2.90.55.src.rpm:66874254/  info  HEADER  downloads

XFree86 - The basic fonts, programs and docs for an X workstation.…  more info»

restest.c

/*
     gcc -o restest -Wall restest.c -L/usr/X11R6/lib -lX11 -lXext -lXRes
*/


#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/extensions/XRes.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>


int main(void)
{
    Display *TheDisplay;
    int event, error, major, minor, num_clients, i, j, num_types;
    unsigned long bytes;
    XResClient *clients;
    XResType *types;
    char *name;
    Atom pixmap;

    TheDisplay = XOpenDisplay(0);

    if(!XResQueryExtension(TheDisplay, &event, &error)) {
        printf("XResQueryExtension failed\n");
        return 1;
    }

    if(!XResQueryVersion(TheDisplay, &major, &minor)) {
        printf("XResQueryVersion failed\n");
        return 1;
    } else {
        printf("X-Resource extension version %i.%i\n", major, minor);
    }

    pixmap = XInternAtom(TheDisplay, "PIXMAP", 0);

    XGrabServer(TheDisplay);

    XResQueryClients(TheDisplay, &num_clients, &clients);
 
    printf("There are %i clients\n", num_clients);
    for(i = 0; i < num_clients; i++) {
       XResQueryClientResources(TheDisplay, clients[i].resource_base,
                                &num_types, &types);

       printf("Client %i (base = 0x%x, mask = 0x%x): %i resource types\n", i,
                                        clients[i].resource_base,
                                        clients[i].resource_mask, num_types);

       for(j = 0; j < num_types; j++) {
          name = XGetAtomName(TheDisplay, types[j].resource_type);
          printf("   %s: %i", name, types[j].count);
          if(types[j].resource_type == pixmap) {
              XResQueryClientPixmapBytes(TheDisplay, clients[i].resource_base,
                                         &bytes);
              printf("  (%i bytes)\n", bytes); 
          } else printf("\n");
          XFree(name);
       }

       XFree(types);
    }

    XUngrabServer(TheDisplay);

    XFree(clients);
     
    XCloseDisplay(TheDisplay);

    return 0;
}


Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com