Adding a colormap index to the InitColormapPrivate() func call. Without it

it was completely useless.
test if colormap with index really exists in the list of installed maps
    before using it.
This commit is contained in:
Egbert Eich 2004-07-30 21:10:46 +00:00
parent bbfe7bed3f
commit 0ba1559946
6 changed files with 19 additions and 10 deletions

View File

@ -358,7 +358,7 @@ InitCmapPrivFunc initPrivFunc;
pColormap->devPrivates = privs;
if (!privs || !(*initPrivFunc)(pColormap))
if (!privs || !(*initPrivFunc)(pColormap,index))
{
colormapPrivateCount--;
return -1;

View File

@ -1,4 +1,4 @@
/* $XdotOrg$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.2 2004/04/23 19:20:32 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.25 2003/10/17 20:02:12 alanh Exp $ */
/*
* Copyright (c) 1998-2001 by The XFree86 Project, Inc.
@ -117,7 +117,7 @@ static int CMapChangeGamma(int, Gamma);
static void ComputeGamma(CMapScreenPtr);
static Bool CMapAllocateColormapPrivate(ColormapPtr);
static Bool CMapInitDefMap(ColormapPtr);
static Bool CMapInitDefMap(ColormapPtr,int);
static void CMapRefreshColors(ColormapPtr, int, int*);
static void CMapSetOverscan(ColormapPtr, int, int *);
static void CMapReinstallMap(ColormapPtr);
@ -211,7 +211,7 @@ Bool xf86HandleColormaps(
/* get the default map */
pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
if(!CMapAllocateColormapPrivate(pDefMap)) {
CMapUnwrapScreen(pScreen);
return FALSE;
@ -224,7 +224,7 @@ Bool xf86HandleColormaps(
}
static Bool
CMapInitDefMap(ColormapPtr cmap)
CMapInitDefMap(ColormapPtr cmap, int index)
{
return TRUE;
}
@ -433,7 +433,8 @@ CMapInstallColormap(ColormapPtr pmap)
/* Important. We let the lower layers, namely DGA,
overwrite the choice of Colormap to install */
pmap = miInstalledMaps[index];
if (miInstalledMaps[index])
pmap = miInstalledMaps[index];
if(!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
(pmap->pVisual->class == TrueColor) &&

View File

@ -1,3 +1,9 @@
2004-07-30 Egbert Eich <set EMAIL_ADDRESS environment variable>
reviewed by: <delete if not using a buddy>
* winallpriv.c: (winInitCmapPrivates):
2004-07-09 Alexander Gottwald <ago@freedesktop.org>
* winconfig.c: Add entry for irish layout (ie)

View File

@ -116,7 +116,7 @@ winAllocatePrivates (ScreenPtr pScreen)
*/
Bool
winInitCmapPrivates (ColormapPtr pcmap)
winInitCmapPrivates (ColormapPtr pcmap, int index)
{
#if CYGDEBUG
winDebug ("winInitCmapPrivates\n");
@ -129,7 +129,9 @@ winInitCmapPrivates (ColormapPtr pcmap)
* anything. Perhaps I am misunderstanding the purpose
* of this function.
*/
/* That's definitely true.
* I therefore changed the API and added the index as argument.
*/
return TRUE;
}

View File

@ -104,7 +104,7 @@ extern void ResetColormapPrivates(void);
typedef struct _ColormapRec *ColormapPtr;
typedef int (*InitCmapPrivFunc)(ColormapPtr);
typedef int (*InitCmapPrivFunc)(ColormapPtr, int);
extern int AllocateColormapPrivateIndex(
InitCmapPrivFunc /* initPrivFunc */);

View File

@ -104,7 +104,7 @@ LbxColormapPrivInit (ColormapPtr pmap)
static int
LbxDefCmapPrivInit (ColormapPtr pmap)
LbxDefCmapPrivInit (ColormapPtr pmap, int index)
{
#if 0
/* BUG: You can't do that. lbxColormapPrivIndex hasn't