summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-04-30 19:38:48 -0700
committerKeith Packard <keithp@keithp.com>2010-06-05 19:31:37 -0700
commitab07e2b8ededaa2193fc199a8c09623d84032280 (patch)
tree4d4525fde553e7868f15959f5e30da0cb639f325 /mi
parent34db537907c6cb2635dbefdce7dcfcae90f7c902 (diff)
Allocate per-screen device/cursor-bits private keys in midispcur
midispcur was abusing the CursorScreenKey to index the cursor_bits privates, it also had a MAXSCREENS array of keys to index device privates. Switch both of these to the new dixCreatePrivateKey API and store a pointer to that in the screen private. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'mi')
-rw-r--r--mi/midispcur.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/mi/midispcur.c b/mi/midispcur.c
index b41247764..323ee028b 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -59,14 +59,7 @@ static DevPrivateKeyRec miDCScreenKeyRec;
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
-/* per bits per-screen private data */
-static DevPrivateKeyRec miDCCursorBitsKeyRec[MAXSCREENS];
-#define miDCCursorBitsKey(screen) (&miDCCursorBitsKeyRec[(screen)->myNum])
-
-/* per device per-screen private data */
-static DevPrivateKeyRec miDCDeviceKeyRec[MAXSCREENS];
-#define miDCDeviceKey(screen) (&miDCDeviceKeyRec[(screen)->myNum])
-
+/* per device private data */
typedef struct {
GCPtr pSourceGC, pMaskGC;
GCPtr pSaveGC, pRestoreGC;
@@ -86,9 +79,15 @@ typedef struct {
* in the pCursorBuffers array.
*/
typedef struct {
- CloseScreenProcPtr CloseScreen;
+ CloseScreenProcPtr CloseScreen;
+ DevPrivateKey device_key;
+ DevPrivateKey cursor_bits_key;
} miDCScreenRec, *miDCScreenPtr;
+#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey)))
+#define miDCDeviceKey(s) (miGetDCScreen(s)->device_key)
+#define miDCCursorBitsKey(s) (miGetDCScreen(s)->cursor_bits_key)
+
/* per-cursor per-screen private data */
typedef struct {
PixmapPtr sourceBits; /* source bits */
@@ -106,16 +105,16 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
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->cursor_bits_key = dixCreatePrivateKey(PRIVATE_CURSOR_BITS, 0);
+ pScreenPriv->device_key = dixCreatePrivateKey(PRIVATE_DEVICE, 0);
+ if (!pScreenPriv->cursor_bits_key || !pScreenPriv->device_key) {
+ free(pScreenPriv);
+ return FALSE;
+ }
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;