summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-04-22 20:20:43 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-04-23 15:49:23 +0300
commita94f5455c71363d5047668ee093901b9e1645cf1 (patch)
treebf935093e43590921925bebabc19bd9629e90623
parenta2c716eaf6b3a4ce75382394636a0a890b5dcfe0 (diff)
mi: track screens' installed colormaps as screen privates
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--mi/micmap.c15
-rw-r--r--mi/micmap.h8
2 files changed, 14 insertions, 9 deletions
diff --git a/mi/micmap.c b/mi/micmap.c
index e832be7fa..cc829fc10 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -40,13 +40,14 @@
#include "globals.h"
#include "micmap.h"
-ColormapPtr miInstalledMaps[MAXSCREENS];
+static int micmapScrPrivateKeyIndex;
+DevPrivateKey micmapScrPrivateKey = &micmapScrPrivateKeyIndex;
int
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
- if (miInstalledMaps[pScreen->myNum]) {
- *pmaps = miInstalledMaps[pScreen->myNum]->mid;
+ if (GetInstalledmiColormap(pScreen)) {
+ *pmaps = GetInstalledmiColormap(pScreen)->mid;
return (1);
}
return 0;
@@ -55,8 +56,7 @@ miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
void
miInstallColormap(ColormapPtr pmap)
{
- int index = pmap->pScreen->myNum;
- ColormapPtr oldpmap = miInstalledMaps[index];
+ ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
if(pmap != oldpmap)
{
@@ -65,7 +65,7 @@ miInstallColormap(ColormapPtr pmap)
if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */
- miInstalledMaps[index] = pmap;
+ SetInstalledmiColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
}
@@ -74,8 +74,7 @@ miInstallColormap(ColormapPtr pmap)
void
miUninstallColormap(ColormapPtr pmap)
{
- int index = pmap->pScreen->myNum;
- ColormapPtr curpmap = miInstalledMaps[index];
+ ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen);
if(pmap == curpmap)
{
diff --git a/mi/micmap.h b/mi/micmap.h
index 5c8448a95..8ad94b9dd 100644
--- a/mi/micmap.h
+++ b/mi/micmap.h
@@ -4,7 +4,13 @@
#ifndef _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 *,
int *, VisualID *, unsigned long, int,