diff options
author | Keith Packard <keithp@keithp.com> | 2010-04-26 17:22:21 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-06-05 19:23:03 -0700 |
commit | faeebead7bfcc78535757ca7acc1faf7554c03b7 (patch) | |
tree | 1a8f13a3b1ae968011efb9679bc3ed79a29020be /dbe | |
parent | c865a24401f06bcf1347d8b41f736a066ab25693 (diff) |
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>
Diffstat (limited to 'dbe')
-rw-r--r-- | dbe/dbe.c | 33 | ||||
-rw-r--r-- | dbe/dbestruct.h | 8 | ||||
-rw-r--r-- | dbe/midbe.c | 22 | ||||
-rw-r--r-- | dbe/midbe.h | 11 |
4 files changed, 29 insertions, 45 deletions
@@ -57,15 +57,13 @@ /* GLOBALS */ -/* These are static globals copied to DBE's screen private for use by DDX */ -static int dbeScreenPrivKeyIndex; -static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex; -static int dbeWindowPrivKeyIndex; -static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKeyIndex; +/* These are globals for use by DDX */ +DevPrivateKeyRec dbeScreenPrivKeyRec; +DevPrivateKeyRec dbeWindowPrivKeyRec; -/* These are static globals copied to DBE's screen private for use by DDX */ -static RESTYPE dbeDrawableResType; -static RESTYPE dbeWindowPrivResType; +/* These are globals for use by DDX */ +RESTYPE dbeDrawableResType; +RESTYPE dbeWindowPrivResType; /* Used to generate DBE's BadBuffer error. */ static int dbeErrorBase; @@ -254,7 +252,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) * Allocate a window priv. */ - pDbeWindowPriv = calloc(1, sizeof(DbeWindowPrivRec)); + pDbeWindowPriv = dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW); if (!pDbeWindowPriv) return(BadAlloc); @@ -1410,8 +1408,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) NULL); /* We are done with the window priv. */ - dixFreePrivates(pDbeWindowPriv->devPrivates); - free(pDbeWindowPriv); + dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW); } return(Success); @@ -1576,6 +1573,12 @@ DbeExtensionInit(void) if (!dbeWindowPrivResType) return; + if (!dixRegisterPrivateKey(&dbeScreenPrivKeyRec, PRIVATE_SCREEN, 0)) + return; + + if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0)) + return; + for (i = 0; i < screenInfo.numScreens; i++) { /* For each screen, set up DBE screen privates and init DIX and DDX @@ -1602,14 +1605,6 @@ DbeExtensionInit(void) dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv); - /* Copy the resource types */ - pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType; - pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType; - - /* Copy the private indices */ - pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey; - pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey; - { /* We don't have DDX support for DBE anymore */ diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index ba6b56d79..9c383cef8 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -167,14 +167,6 @@ typedef struct _DbeWindowPrivRec typedef struct _DbeScreenPrivRec { - /* Resources created by DIX to be used by DDX */ - RESTYPE dbeDrawableResType; - RESTYPE dbeWindowPrivResType; - - /* Private indices created by DIX to be used by DDX */ - DevPrivateKey dbeScreenPrivKey; - DevPrivateKey dbeWindowPrivKey; - /* Wrapped functions * It is the responsibilty of the DDX layer to wrap PositionWindow(). * DbeExtensionInit wraps DestroyWindow(). diff --git a/dbe/midbe.c b/dbe/midbe.c index 49689c529..03e8e2e1b 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -58,14 +58,8 @@ #include <stdio.h> -static int miDbeWindowPrivPrivKeyIndex; -static DevPrivateKey miDbeWindowPrivPrivKey = &miDbeWindowPrivPrivKeyIndex; -static RESTYPE dbeDrawableResType; -static RESTYPE dbeWindowPrivResType; -static int dbeScreenPrivKeyIndex; -static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKeyIndex; -static int dbeWindowPrivKeyIndex; -static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKeyIndex; +static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec; +#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec) /****************************************************************************** @@ -787,16 +781,8 @@ miDbeResetProc(ScreenPtr pScreen) Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) { - /* Copy resource types created by DIX */ - dbeDrawableResType = pDbeScreenPriv->dbeDrawableResType; - dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType; - - /* Copy private indices created by DIX */ - dbeScreenPrivKey = pDbeScreenPriv->dbeScreenPrivKey; - dbeWindowPrivKey = pDbeScreenPriv->dbeWindowPrivKey; - - if (!dixRequestPrivate(miDbeWindowPrivPrivKey, - sizeof(MiDbeWindowPrivPrivRec))) + if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW, + sizeof(MiDbeWindowPrivPrivRec))) return(FALSE); /* Wrap functions. */ diff --git a/dbe/midbe.h b/dbe/midbe.h index 007f2e37b..cff36d038 100644 --- a/dbe/midbe.h +++ b/dbe/midbe.h @@ -36,6 +36,8 @@ #ifndef MIDBE_H #define MIDBE_H +#include "privates.h" + /* EXTERNS */ extern Bool miDbeInit( @@ -43,5 +45,14 @@ extern Bool miDbeInit( DbeScreenPrivPtr pDbeScreenPriv ); +extern DevPrivateKeyRec dbeScreenPrivKeyRec; +#define dbeScreenPrivKey (&dbeScreenPrivKeyRec) + +extern DevPrivateKeyRec dbeWindowPrivKeyRec; +#define dbeWindowPrivKey (&dbeWindowPrivKeyRec) + +extern RESTYPE dbeDrawableResType; +extern RESTYPE dbeWindowPrivResType; + #endif /* MIDBE_H */ |