mi: track screens' installed colormaps as screen privates

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
Tiago Vignatti 2010-04-22 20:20:43 +03:00
parent a2c716eaf6
commit a94f5455c7
2 changed files with 14 additions and 9 deletions

View File

@ -40,13 +40,14 @@
#include "globals.h" #include "globals.h"
#include "micmap.h" #include "micmap.h"
ColormapPtr miInstalledMaps[MAXSCREENS]; static int micmapScrPrivateKeyIndex;
DevPrivateKey micmapScrPrivateKey = &micmapScrPrivateKeyIndex;
int int
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{ {
if (miInstalledMaps[pScreen->myNum]) { if (GetInstalledmiColormap(pScreen)) {
*pmaps = miInstalledMaps[pScreen->myNum]->mid; *pmaps = GetInstalledmiColormap(pScreen)->mid;
return (1); return (1);
} }
return 0; return 0;
@ -55,8 +56,7 @@ miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
void void
miInstallColormap(ColormapPtr pmap) miInstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
ColormapPtr oldpmap = miInstalledMaps[index];
if(pmap != oldpmap) if(pmap != oldpmap)
{ {
@ -65,7 +65,7 @@ miInstallColormap(ColormapPtr pmap)
if(oldpmap != (ColormapPtr)None) if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */ /* Install pmap */
miInstalledMaps[index] = pmap; SetInstalledmiColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
} }
@ -74,8 +74,7 @@ miInstallColormap(ColormapPtr pmap)
void void
miUninstallColormap(ColormapPtr pmap) miUninstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen);
ColormapPtr curpmap = miInstalledMaps[index];
if(pmap == curpmap) if(pmap == curpmap)
{ {

View File

@ -4,7 +4,13 @@
#ifndef _MICMAP_H_ #ifndef _MICMAP_H_
#define _MICMAP_H_ #define _MICMAP_H_
extern _X_EXPORT ColormapPtr miInstalledMaps[MAXSCREENS]; #define GetInstalledmiColormap(s) \
((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
#define SetInstalledmiColormap(s,c) \
(dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
extern _X_EXPORT DevPrivateKey micmapScrPrivateKey;
typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *, typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
int *, VisualID *, unsigned long, int, int *, VisualID *, unsigned long, int,