devPrivates rework: add dix header file containing new interface.

This commit is contained in:
Eamon Walsh 2007-02-23 13:19:53 -05:00 committed by Eamon Walsh
parent 9a3eb0357e
commit 779faccfb7
2 changed files with 78 additions and 0 deletions

View File

@ -31,6 +31,7 @@ sdk_HEADERS = \
os.h \
pixmap.h \
pixmapstr.h \
privates.h \
property.h \
propertyst.h \
region.h \

77
include/privates.h Normal file
View File

@ -0,0 +1,77 @@
/***********************************************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef PRIVATES_H
#define PRIVATES_H 1
#include "dix.h"
#include "resource.h"
/*****************************************************************
* STUFF FOR PRIVATES
*****************************************************************/
/*
* Request private space for your driver/module in all resources of a type.
* A non-null pScreen argument restricts to resources on a given screen.
*/
extern int
dixRequestPrivate(RESTYPE type, unsigned size, pointer pScreen);
/*
* Request private space in just one individual resource object.
*/
extern int
dixRequestSinglePrivate(RESTYPE type, unsigned size, pointer instance);
/*
* Look up a private pointer.
*/
extern pointer
dixLookupPrivate(RESTYPE type, int index, pointer instance);
/*
* Register callbacks to be called on private allocation/freeing.
* The calldata argument to the callbacks is a PrivateCallbackPtr.
*/
typedef struct _PrivateCallback {
pointer value; /* pointer to private */
int index; /* registration index */
ResourcePtr resource; /* resource record (do not modify!) */
} PrivateCallbackRec, *PrivateCallbackPtr;
extern int
dixRegisterPrivateInitFunc(RESTYPE type, int index,
CallbackProcPtr callback, pointer userdata);
extern int
dixRegisterPrivateDeleteFunc(RESTYPE type, int index,
CallbackProcPtr callback, pointer userdata);
/*
* Internal functions
*/
extern void
dixResetPrivates(void);
extern int
dixUpdatePrivates(void);
extern ResourcePtr
dixAllocateResourceRec(RESTYPE type, pointer value, pointer parent);
extern void
dixCallPrivateInitFuncs(ResourcePtr res);
extern void
dixFreeResourceRec(ResourcePtr res);
#endif /* PRIVATES_H */