xres: Return the atom naming the type, not its internal type number
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
68556d74b4
commit
eafcd009f1
34
Xext/xres.c
34
Xext/xres.c
|
@ -274,6 +274,24 @@ ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
|
|||
counts[(type & TypeMask) - 1]++;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
resourceTypeAtom(int i)
|
||||
{
|
||||
CARD32 ret;
|
||||
|
||||
const char *name = LookupResourceName(i);
|
||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||
ret = MakeAtom(name, strlen(name), TRUE);
|
||||
else {
|
||||
char buf[40];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||
ret = MakeAtom(buf, strlen(buf), TRUE);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXResQueryClientResources(ClientPtr client)
|
||||
{
|
||||
|
@ -318,22 +336,12 @@ ProcXResQueryClientResources(ClientPtr client)
|
|||
|
||||
if (num_types) {
|
||||
xXResType scratch;
|
||||
const char *name;
|
||||
|
||||
for (i = 0; i < lastResourceType; i++) {
|
||||
if (!counts[i])
|
||||
continue;
|
||||
|
||||
name = LookupResourceName(i + 1);
|
||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
|
||||
else {
|
||||
char buf[40];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
|
||||
}
|
||||
|
||||
scratch.resource_type = resourceTypeAtom(i + 1);
|
||||
scratch.count = counts[i];
|
||||
|
||||
if (client->swapped) {
|
||||
|
@ -693,7 +701,7 @@ AddSubResourceSizeSpec(void *value,
|
|||
sizeFunc(value, id, &size);
|
||||
|
||||
crossRef->spec.resource = id;
|
||||
crossRef->spec.type = type;
|
||||
crossRef->spec.type = resourceTypeAtom(type);
|
||||
crossRef->bytes = size.resourceSize;
|
||||
crossRef->refCount = size.refCnt;
|
||||
crossRef->useCount = 1;
|
||||
|
@ -766,7 +774,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
|
|||
sizeFunc(ptr, id, &size);
|
||||
|
||||
value->size.spec.resource = id;
|
||||
value->size.spec.type = type;
|
||||
value->size.spec.type = resourceTypeAtom(type);
|
||||
value->size.bytes = size.resourceSize;
|
||||
value->size.refCount = size.refCnt;
|
||||
value->size.useCount = 1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user