Change the devPrivates API to require dixRegisterPrivateKey

This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
This commit is contained in:
Keith Packard 2010-04-26 17:22:21 -07:00
commit faeebead7b
139 changed files with 1105 additions and 711 deletions

View file

@ -54,18 +54,18 @@ in this Software without prior written authorization from The Open Group.
# include "inputstr.h"
/* per-screen private data */
static int miDCScreenKeyIndex;
static DevPrivateKey miDCScreenKey = &miDCScreenKeyIndex;
static DevPrivateKeyRec miDCScreenKeyRec;
#define miDCScreenKey (&miDCScreenKeyRec)
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
/* per bits per-screen private data */
static int miDCCursorBitsKeyIndex[MAXSCREENS];
#define miDCCursorBitsKey(screen) (&miDCCursorBitsKeyIndex[(screen)->myNum])
static DevPrivateKeyRec miDCCursorBitsKeyRec[MAXSCREENS];
#define miDCCursorBitsKey(screen) (&miDCCursorBitsKeyRec[(screen)->myNum])
/* per device per-screen private data */
static int miDCDeviceKeyIndex[MAXSCREENS];
#define miDCDeviceKey(screen) (&miDCDeviceKeyIndex[(screen)->myNum])
static DevPrivateKeyRec miDCDeviceKeyRec[MAXSCREENS];
#define miDCDeviceKey(screen) (&miDCDeviceKeyRec[(screen)->myNum])
typedef struct {
GCPtr pSourceGC, pMaskGC;
@ -103,11 +103,19 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{
miDCScreenPtr pScreenPriv;
if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if (!dixRegisterPrivateKey(&miDCDeviceKeyRec[pScreen->myNum], PRIVATE_DEVICE, 0))
return FALSE;
if (!dixRegisterPrivateKey(&miDCCursorBitsKeyRec[pScreen->myNum], PRIVATE_CURSOR_BITS, 0))
return FALSE;
pScreenPriv = malloc(sizeof (miDCScreenRec));
if (!pScreenPriv)
return FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;