devPrivates rework: since API is already broken, switch everything

over to new system.

Need to update documentation and address some remaining vestiges of
old system such as CursorRec structure, fb "offman" structure, and
FontRec privates.
This commit is contained in:
Eamon Walsh 2007-08-28 09:28:25 -04:00 committed by Eamon Walsh
commit 4017d31902
261 changed files with 1642 additions and 3957 deletions

View file

@ -27,51 +27,33 @@
#include "fb.h"
#ifdef FB_SCREEN_PRIVATE
int fbScreenPrivateIndex;
int fbGetScreenPrivateIndex(void)
static DevPrivateKey fbScreenPrivateKey = &fbScreenPrivateKey;
DevPrivateKey fbGetScreenPrivateKey(void)
{
return fbScreenPrivateIndex;
return fbScreenPrivateKey;
}
#endif
int fbGCPrivateIndex;
int fbGetGCPrivateIndex(void)
static DevPrivateKey fbGCPrivateKey = &fbGCPrivateKey;
DevPrivateKey fbGetGCPrivateKey(void)
{
return fbGCPrivateIndex;
return fbGCPrivateKey;
}
#ifndef FB_NO_WINDOW_PIXMAPS
int fbWinPrivateIndex;
int fbGetWinPrivateIndex(void)
static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKey;
DevPrivateKey fbGetWinPrivateKey(void)
{
return fbWinPrivateIndex;
return fbWinPrivateKey;
}
#endif
int fbGeneration;
Bool
fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
if (fbGeneration != serverGeneration)
{
fbGCPrivateIndex = miAllocateGCPrivateIndex ();
#ifndef FB_NO_WINDOW_PIXMAPS
fbWinPrivateIndex = AllocateWindowPrivateIndex();
#endif
#ifdef FB_SCREEN_PRIVATE
fbScreenPrivateIndex = AllocateScreenPrivateIndex ();
if (fbScreenPrivateIndex == -1)
return FALSE;
#endif
fbGeneration = serverGeneration;
}
if (pGCIndex)
*pGCIndex = fbGCPrivateIndex;
if (!AllocateGCPrivate(pScreen, fbGCPrivateIndex, sizeof(FbGCPrivRec)))
if (pGCKey)
*pGCKey = fbGCPrivateKey;
if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec)))
return FALSE;
#ifndef FB_NO_WINDOW_PIXMAPS
if (!AllocateWindowPrivate(pScreen, fbWinPrivateIndex, 0))
return FALSE;
#endif
#ifdef FB_SCREEN_PRIVATE
{
FbScreenPrivPtr pScreenPriv;
@ -79,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
if (!pScreenPriv)
return FALSE;
pScreen->devPrivates[fbScreenPrivateIndex].ptr = (pointer) pScreenPriv;
dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
}
#endif
return TRUE;