1 /* 2 Copyright (c) 2002 XFree86 Inc 3 */ 4 5 #ifndef _XRES_H 6 #define _XRES_H 7 8 #include <X11/Xfuncproto.h> 9 10 /* v1.0 */ 11 12 typedef struct { 13 XID resource_base; 14 XID resource_mask; 15 } XResClient; 16 17 typedef struct { 18 Atom resource_type; 19 unsigned int count; 20 } XResType; 21 22 /* v1.2 */ 23 24 typedef enum { 25 XRES_CLIENT_ID_XID, 26 XRES_CLIENT_ID_PID, 27 XRES_CLIENT_ID_NR 28 } XResClientIdType; 29 30 typedef enum { 31 XRES_CLIENT_ID_XID_MASK = 1 << XRES_CLIENT_ID_XID, 32 XRES_CLIENT_ID_PID_MASK = 1 << XRES_CLIENT_ID_PID 33 } XResClientIdMask; 34 35 typedef struct { 36 XID client; 37 unsigned int mask; 38 } XResClientIdSpec; 39 40 typedef struct { 41 XResClientIdSpec spec; 42 long length; 43 void *value; 44 } XResClientIdValue; 45 46 typedef struct { 47 XID resource; 48 Atom type; 49 } XResResourceIdSpec; 50 51 typedef struct { 52 XResResourceIdSpec spec; 53 long bytes; 54 long ref_count; 55 long use_count; 56 } XResResourceSizeSpec; 57 58 typedef struct { 59 XResResourceSizeSpec size; 60 long num_cross_references; 61 XResResourceSizeSpec *cross_references; 62 } XResResourceSizeValue; 63 64 _XFUNCPROTOBEGIN 65 66 /* v1.0 */ 67 68 Bool XResQueryExtension ( 69 Display *dpy, 70 int *event_base_return, 71 int *error_base_return 72 ); 73 74 Status XResQueryVersion ( 75 Display *dpy, 76 int *major_version_return, 77 int *minor_version_return 78 ); 79 80 Status XResQueryClients ( 81 Display *dpy, 82 int *num_clients, 83 XResClient **clients 84 ); 85 86 Status XResQueryClientResources ( 87 Display *dpy, 88 XID xid, 89 int *num_types, 90 XResType **types 91 ); 92 93 Status XResQueryClientPixmapBytes ( 94 Display *dpy, 95 XID xid, 96 unsigned long *bytes 97 ); 98 99 /* v1.2 */ 100 101 /* Returns an array of uint32_t values, not an array of long */ 102 Status XResQueryClientIds ( 103 Display *dpy, 104 long num_specs, 105 XResClientIdSpec *client_specs, /* in */ 106 long *num_ids, /* out */ 107 XResClientIdValue **client_ids /* out */ 108 ); 109 110 XResClientIdType XResGetClientIdType(XResClientIdValue* value); 111 112 /* return -1 if no pid associated to the value */ 113 pid_t XResGetClientPid(XResClientIdValue* value); 114 115 void XResClientIdsDestroy ( 116 long num_ids, 117 XResClientIdValue *client_ids 118 ); 119 120 Status XResQueryResourceBytes ( 121 Display *dpy, 122 XID client, 123 long num_specs, 124 XResResourceIdSpec *resource_specs, /* in */ 125 long *num_sizes, /* out */ 126 XResResourceSizeValue **sizes /* out */ 127 ); 128 129 void XResResourceSizeValuesDestroy ( 130 long num_sizes, 131 XResResourceSizeValue *sizes 132 ); 133 134 _XFUNCPROTOEND 135 136 #endif /* _XRES_H */ 137