diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-04-22 07:34:04 +0200 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-04-23 15:32:19 +0300 |
commit | a2c716eaf6b3a4ce75382394636a0a890b5dcfe0 (patch) | |
tree | 56ddc7a2c7aaec3060adcfe2cd56b2f91f847c98 /fb | |
parent | e055bef055b6c726e9f3ef91a83585d13c80651d (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 'fb')
-rw-r--r-- | fb/fbcmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fb/fbcmap.c b/fb/fbcmap.c index 2ff3234b5..b775bc335 100644 --- a/fb/fbcmap.c +++ b/fb/fbcmap.c @@ -36,16 +36,18 @@ #error "You should be compiling fbcmap_mi.c instead of fbcmap.c!" #endif +static int cmapScrPrivateKeyIndex; +static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex; - -ColormapPtr FbInstalledMaps[MAXSCREENS]; +#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey)) +#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c)) int fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) { /* By the time we are processing requests, we can guarantee that there * is always a colormap installed */ - *pmaps = FbInstalledMaps[pScreen->myNum]->mid; + *pmaps = GetInstalledColormap(pScreen)->mid; return (1); } @@ -53,8 +55,7 @@ fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) void fbInstallColormap(ColormapPtr pmap) { - int index = pmap->pScreen->myNum; - ColormapPtr oldpmap = FbInstalledMaps[index]; + ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen); if(pmap != oldpmap) { @@ -63,7 +64,7 @@ fbInstallColormap(ColormapPtr pmap) if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); /* Install pmap */ - FbInstalledMaps[index] = pmap; + SetInstalledColormap(pmap->pScreen, pmap); WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); } } @@ -71,8 +72,7 @@ fbInstallColormap(ColormapPtr pmap) void fbUninstallColormap(ColormapPtr pmap) { - int index = pmap->pScreen->myNum; - ColormapPtr curpmap = FbInstalledMaps[index]; + ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen); if(pmap == curpmap) { |