devPrivates rework: add RC_PRIVATES class, make ResourceRec visible in
the API, and add extra fields and structure supporting private storage.
This commit is contained in:
parent
2534f5a902
commit
9a3eb0357e
|
@ -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 {
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue
Block a user