summaryrefslogtreecommitdiff
path: root/fb/fballpriv.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-04-26 17:22:21 -0700
committerKeith Packard <keithp@keithp.com>2010-06-05 19:23:03 -0700
commitfaeebead7bfcc78535757ca7acc1faf7554c03b7 (patch)
tree1a8f13a3b1ae968011efb9679bc3ed79a29020be /fb/fballpriv.c
parentc865a24401f06bcf1347d8b41f736a066ab25693 (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 'fb/fballpriv.c')
-rw-r--r--fb/fballpriv.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/fb/fballpriv.c b/fb/fballpriv.c
index 569391b93..efeb26880 100644
--- a/fb/fballpriv.c
+++ b/fb/fballpriv.c
@@ -27,46 +27,34 @@
#include "fb.h"
#ifdef FB_SCREEN_PRIVATE
-static int fbScreenPrivateKeyIndex;
-static DevPrivateKey fbScreenPrivateKey = &fbScreenPrivateKeyIndex;
-DevPrivateKey fbGetScreenPrivateKey(void)
-{
- return fbScreenPrivateKey;
-}
+static DevPrivateKeyRec fbScreenPrivateKeyRec;
+DevPrivateKey
+fbGetScreenPrivateKey(void) { return &fbScreenPrivateKeyRec; }
#endif
-static int fbGCPrivateKeyIndex;
-static DevPrivateKey fbGCPrivateKey = &fbGCPrivateKeyIndex;
-DevPrivateKey fbGetGCPrivateKey(void)
-{
- return fbGCPrivateKey;
-}
+static DevPrivateKeyRec fbGCPrivateKeyRec;
+DevPrivateKey
+fbGetGCPrivateKey (void) { return &fbGCPrivateKeyRec; }
-static int fbWinPrivateKeyIndex;
-static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKeyIndex;
-DevPrivateKey fbGetWinPrivateKey(void)
-{
- return fbWinPrivateKey;
-}
+static DevPrivateKeyRec fbWinPrivateKeyRec;
+DevPrivateKey
+fbGetWinPrivateKey (void) { return &fbWinPrivateKeyRec; }
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
if (pGCKey)
- *pGCKey = fbGCPrivateKey;
+ *pGCKey = &fbGCPrivateKeyRec;
- if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec)))
+ if (!dixRegisterPrivateKey(&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
return FALSE;
#ifdef FB_SCREEN_PRIVATE
- {
- FbScreenPrivPtr pScreenPriv;
-
- pScreenPriv = (FbScreenPrivPtr) malloc(sizeof (FbScreenPrivRec));
- if (!pScreenPriv)
- return FALSE;
- dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
- }
+ if (!dixRegisterPrivateKey(&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof (FbScreenPrivRec)))
+ return FALSE;
#endif
+ if (!dixRegisterPrivateKey(&fbWinPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+
return TRUE;
}