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>
This commit is contained in:
		
							parent
							
								
									34db537907
								
							
						
					
					
						commit
						ab07e2b8ed
					
				|  | @ -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; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue