Add ResourceStateCallback similar in function to ClientStateCallback.
This commit is contained in:
parent
2fcb45eb5d
commit
b9cff1670f
|
@ -193,6 +193,17 @@ _X_EXPORT RESTYPE TypeMask;
|
||||||
|
|
||||||
static DeleteType *DeleteFuncs = (DeleteType *)NULL;
|
static DeleteType *DeleteFuncs = (DeleteType *)NULL;
|
||||||
|
|
||||||
|
_X_EXPORT CallbackListPtr ResourceStateCallback;
|
||||||
|
|
||||||
|
static _X_INLINE void
|
||||||
|
CallResourceStateCallback(ResourceState state, ResourceRec *res)
|
||||||
|
{
|
||||||
|
if (ResourceStateCallback) {
|
||||||
|
ResourceStateInfoRec rsi = { state, res->id, res->type, res->value };
|
||||||
|
CallCallbacks(&ResourceStateCallback, &rsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XResExtension
|
#ifdef XResExtension
|
||||||
|
|
||||||
_X_EXPORT Atom * ResourceNames = NULL;
|
_X_EXPORT Atom * ResourceNames = NULL;
|
||||||
|
@ -492,6 +503,7 @@ AddResource(XID id, RESTYPE type, pointer value)
|
||||||
rrec->elements++;
|
rrec->elements++;
|
||||||
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
|
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
|
||||||
rrec->expectID = id + 1;
|
rrec->expectID = id + 1;
|
||||||
|
CallResourceStateCallback(ResourceStateAdding, res);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +584,9 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
|
||||||
#endif
|
#endif
|
||||||
*prev = res->next;
|
*prev = res->next;
|
||||||
elements = --*eltptr;
|
elements = --*eltptr;
|
||||||
|
|
||||||
|
CallResourceStateCallback(ResourceStateFreeing, res);
|
||||||
|
|
||||||
if (rtype & RC_CACHED)
|
if (rtype & RC_CACHED)
|
||||||
FlushClientCaches(res->id);
|
FlushClientCaches(res->id);
|
||||||
if (rtype != skipDeleteFuncType)
|
if (rtype != skipDeleteFuncType)
|
||||||
|
@ -616,6 +631,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
|
||||||
res->value, TypeNameString(res->type));
|
res->value, TypeNameString(res->type));
|
||||||
#endif
|
#endif
|
||||||
*prev = res->next;
|
*prev = res->next;
|
||||||
|
|
||||||
|
CallResourceStateCallback(ResourceStateFreeing, res);
|
||||||
|
|
||||||
if (type & RC_CACHED)
|
if (type & RC_CACHED)
|
||||||
FlushClientCaches(res->id);
|
FlushClientCaches(res->id);
|
||||||
if (!skipFree)
|
if (!skipFree)
|
||||||
|
@ -782,6 +800,9 @@ FreeClientNeverRetainResources(ClientPtr client)
|
||||||
this->value, TypeNameString(this->type));
|
this->value, TypeNameString(this->type));
|
||||||
#endif
|
#endif
|
||||||
*prev = this->next;
|
*prev = this->next;
|
||||||
|
|
||||||
|
CallResourceStateCallback(ResourceStateFreeing, this);
|
||||||
|
|
||||||
if (rtype & RC_CACHED)
|
if (rtype & RC_CACHED)
|
||||||
FlushClientCaches(this->id);
|
FlushClientCaches(this->id);
|
||||||
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
|
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
|
||||||
|
@ -832,6 +853,9 @@ FreeClientResources(ClientPtr client)
|
||||||
this->value, TypeNameString(this->type));
|
this->value, TypeNameString(this->type));
|
||||||
#endif
|
#endif
|
||||||
*head = this->next;
|
*head = this->next;
|
||||||
|
|
||||||
|
CallResourceStateCallback(ResourceStateFreeing, this);
|
||||||
|
|
||||||
if (rtype & RC_CACHED)
|
if (rtype & RC_CACHED)
|
||||||
FlushClientCaches(this->id);
|
FlushClientCaches(this->id);
|
||||||
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
|
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
|
||||||
|
|
|
@ -300,6 +300,7 @@ _X_HIDDEN void *dixLookupTab[] = {
|
||||||
SYMFUNC(FindAllClientResources)
|
SYMFUNC(FindAllClientResources)
|
||||||
SYMVAR(lastResourceType)
|
SYMVAR(lastResourceType)
|
||||||
SYMVAR(TypeMask)
|
SYMVAR(TypeMask)
|
||||||
|
SYMVAR(ResourceStateCallback)
|
||||||
#ifdef RES
|
#ifdef RES
|
||||||
SYMFUNC(RegisterResourceName)
|
SYMFUNC(RegisterResourceName)
|
||||||
SYMVAR(ResourceNames)
|
SYMVAR(ResourceNames)
|
||||||
|
|
|
@ -120,6 +120,19 @@ typedef unsigned long RESTYPE;
|
||||||
|
|
||||||
#define BAD_RESOURCE 0xe0000000
|
#define BAD_RESOURCE 0xe0000000
|
||||||
|
|
||||||
|
/* Resource state callback */
|
||||||
|
extern CallbackListPtr ResourceStateCallback;
|
||||||
|
|
||||||
|
typedef enum {ResourceStateAdding,
|
||||||
|
ResourceStateFreeing} ResourceState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ResourceState state;
|
||||||
|
XID id;
|
||||||
|
RESTYPE type;
|
||||||
|
pointer value;
|
||||||
|
} ResourceStateInfoRec;
|
||||||
|
|
||||||
typedef int (*DeleteType)(
|
typedef int (*DeleteType)(
|
||||||
pointer /*value*/,
|
pointer /*value*/,
|
||||||
XID /*id*/);
|
XID /*id*/);
|
||||||
|
|
Loading…
Reference in New Issue