summaryrefslogtreecommitdiff
path: root/hw/xnest/Color.c
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-04-22 07:34:04 +0200
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-04-23 15:32:19 +0300
commita2c716eaf6b3a4ce75382394636a0a890b5dcfe0 (patch)
tree56ddc7a2c7aaec3060adcfe2cd56b2f91f847c98 /hw/xnest/Color.c
parente055bef055b6c726e9f3ef91a83585d13c80651d (diff)
fb: track screens' installed colormaps as screen privates.
Several DDXes allow each screen to have at most one (or in some cases, exactly one) installed colormap. These all use the same pattern: Declare a global-lifetime array of MAXSCREENS ColormapPtrs, and index it by screen number. This patch converts most of those to use screen privates instead. Signed-off-by: Jamey Sharp <jamey@minilop.net> Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Diffstat (limited to 'hw/xnest/Color.c')
-rw-r--r--hw/xnest/Color.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index dc749478f..2e6de15e4 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -34,7 +34,11 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Args.h"
-static ColormapPtr InstalledMaps[MAXSCREENS];
+static int cmapScrPrivateKeyIndex;
+static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
+
+#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
+#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
Bool
xnestCreateColormap(ColormapPtr pCmap)
@@ -332,11 +336,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
void
xnestInstallColormap(ColormapPtr pCmap)
{
- int index;
- ColormapPtr pOldCmap;
-
- index = pCmap->pScreen->myNum;
- pOldCmap = InstalledMaps[index];
+ ColormapPtr pOldCmap = GetInstalledColormap(pCmap->pScreen);
if(pCmap != pOldCmap)
{
@@ -346,7 +346,7 @@ xnestInstallColormap(ColormapPtr pCmap)
if(pOldCmap != (ColormapPtr)None)
WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
- InstalledMaps[index] = pCmap;
+ SetInstalledColormap(pCmap->pScreen, pCmap);
WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
xnestSetInstalledColormapWindows(pCmap->pScreen);
@@ -357,11 +357,7 @@ xnestInstallColormap(ColormapPtr pCmap)
void
xnestUninstallColormap(ColormapPtr pCmap)
{
- int index;
- ColormapPtr pCurCmap;
-
- index = pCmap->pScreen->myNum;
- pCurCmap = InstalledMaps[index];
+ ColormapPtr pCurCmap = GetInstalledColormap(pCmap->pScreen);
if(pCmap == pCurCmap)
{
@@ -382,7 +378,7 @@ int
xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs)
{
if (xnestInstalledDefaultColormap) {
- *pCmapIDs = InstalledMaps[pScreen->myNum]->mid;
+ *pCmapIDs = GetInstalledColormap(pScreen)->mid;
return 1;
}
else