diff --git a/dix/resource.c b/dix/resource.c index 4468f4575..584ac94fb 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -169,12 +169,6 @@ static void RebuildTable( #define INITHASHSIZE 6 #define MAXHASHSIZE 11 -typedef struct _Resource { - struct _Resource *next; - XID id; - RESTYPE type; - pointer value; -} ResourceRec, *ResourcePtr; #define NullResource ((ResourcePtr)NULL) typedef struct _ClientResource { diff --git a/include/resource.h b/include/resource.h index 3231e8cd9..902305805 100644 --- a/include/resource.h +++ b/include/resource.h @@ -53,10 +53,27 @@ SOFTWARE. * STUFF FOR RESOURCES *****************************************************************/ -/* classes for Resource routines */ +/* Resource structures */ typedef unsigned long RESTYPE; +typedef struct _Private { + int index; + pointer value; + struct _Private *next; +} PrivateRec, *PrivatePtr; + +typedef struct _Resource { + struct _Resource *next; + struct _Resource *nexttype; + XID id; + RESTYPE type; + pointer value; + PrivatePtr privates; +} ResourceRec, *ResourcePtr; + +/* classes for Resource routines */ + #define RC_VANILLA ((RESTYPE)0) #define RC_CACHED ((RESTYPE)1<<31) #define RC_DRAWABLE ((RESTYPE)1<<30) @@ -66,7 +83,12 @@ typedef unsigned long RESTYPE; * Extensions can use this too! */ #define RC_NEVERRETAIN ((RESTYPE)1<<29) -#define RC_LASTPREDEF RC_NEVERRETAIN +/* Use class RC_PRIVATES for resources that support extra private data. + * Resources having this class must provide a field of type ResourcePtr + * at the top of the resource structure, which must be initalized to NULL. + */ +#define RC_PRIVATES ((RESTYPE)1<<28) +#define RC_LASTPREDEF RC_PRIVATES #define RC_ANY (~(RESTYPE)0) /* types for Resource routines */