xfree86: cmap: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new screen close notify hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
b0f1bc92e5
commit
0c39ca358e
|
@ -36,6 +36,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
#include "dix/colormap_priv.h"
|
#include "dix/colormap_priv.h"
|
||||||
|
#include "dix/screen_hooks_priv.h"
|
||||||
#include "mi/mi_priv.h"
|
#include "mi/mi_priv.h"
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
@ -74,7 +75,6 @@ typedef struct _CMapLink {
|
||||||
} CMapLink, *CMapLinkPtr;
|
} CMapLink, *CMapLinkPtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CloseScreenProcPtr CloseScreen;
|
|
||||||
CreateColormapProcPtr CreateColormap;
|
CreateColormapProcPtr CreateColormap;
|
||||||
DestroyColormapProcPtr DestroyColormap;
|
DestroyColormapProcPtr DestroyColormap;
|
||||||
InstallColormapProcPtr InstallColormap;
|
InstallColormapProcPtr InstallColormap;
|
||||||
|
@ -110,7 +110,7 @@ static DevPrivateKeyRec CMapColormapKeyRec;
|
||||||
|
|
||||||
static void CMapInstallColormap(ColormapPtr);
|
static void CMapInstallColormap(ColormapPtr);
|
||||||
static void CMapStoreColors(ColormapPtr, int, xColorItem *);
|
static void CMapStoreColors(ColormapPtr, int, xColorItem *);
|
||||||
static Bool CMapCloseScreen(ScreenPtr);
|
static void CMapCloseScreen(CallbackListPtr*, ScreenPtr, void*);
|
||||||
static Bool CMapCreateColormap(ColormapPtr);
|
static Bool CMapCreateColormap(ColormapPtr);
|
||||||
static void CMapDestroyColormap(ColormapPtr);
|
static void CMapDestroyColormap(ColormapPtr);
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ static Bool CMapAllocateColormapPrivate(ColormapPtr);
|
||||||
static void CMapRefreshColors(ColormapPtr, int, int *);
|
static void CMapRefreshColors(ColormapPtr, int, int *);
|
||||||
static void CMapSetOverscan(ColormapPtr, int, int *);
|
static void CMapSetOverscan(ColormapPtr, int, int *);
|
||||||
static void CMapReinstallMap(ColormapPtr);
|
static void CMapReinstallMap(ColormapPtr);
|
||||||
static void CMapUnwrapScreen(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn)
|
xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn)
|
||||||
|
@ -175,13 +174,12 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv);
|
dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv);
|
||||||
|
dixScreenHookClose(pScreen, CMapCloseScreen);
|
||||||
|
|
||||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
|
||||||
pScreenPriv->CreateColormap = pScreen->CreateColormap;
|
pScreenPriv->CreateColormap = pScreen->CreateColormap;
|
||||||
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
|
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
|
||||||
pScreenPriv->InstallColormap = pScreen->InstallColormap;
|
pScreenPriv->InstallColormap = pScreen->InstallColormap;
|
||||||
pScreenPriv->StoreColors = pScreen->StoreColors;
|
pScreenPriv->StoreColors = pScreen->StoreColors;
|
||||||
pScreen->CloseScreen = CMapCloseScreen;
|
|
||||||
pScreen->CreateColormap = CMapCreateColormap;
|
pScreen->CreateColormap = CMapCreateColormap;
|
||||||
pScreen->DestroyColormap = CMapDestroyColormap;
|
pScreen->DestroyColormap = CMapDestroyColormap;
|
||||||
pScreen->InstallColormap = CMapInstallColormap;
|
pScreen->InstallColormap = CMapInstallColormap;
|
||||||
|
@ -220,7 +218,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
||||||
X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess);
|
X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess);
|
||||||
|
|
||||||
if (!CMapAllocateColormapPrivate(pDefMap)) {
|
if (!CMapAllocateColormapPrivate(pDefMap)) {
|
||||||
CMapUnwrapScreen(pScreen);
|
CMapCloseScreen(NULL, pScreen, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +226,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
||||||
pScrn->LoadPalette = xf86RandR12LoadPalette;
|
pScrn->LoadPalette = xf86RandR12LoadPalette;
|
||||||
|
|
||||||
if (!xf86RandR12InitGamma(pScrn, elements)) {
|
if (!xf86RandR12InitGamma(pScrn, elements)) {
|
||||||
CMapUnwrapScreen(pScreen);
|
CMapCloseScreen(NULL, pScreen, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,14 +239,6 @@ xf86HandleColormaps(ScreenPtr pScreen,
|
||||||
|
|
||||||
/**** Screen functions ****/
|
/**** Screen functions ****/
|
||||||
|
|
||||||
static Bool
|
|
||||||
CMapCloseScreen(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
CMapUnwrapScreen(pScreen);
|
|
||||||
|
|
||||||
return (*pScreen->CloseScreen) (pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
|
CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
|
||||||
{
|
{
|
||||||
|
@ -827,14 +817,17 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void CMapCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
|
||||||
CMapUnwrapScreen(ScreenPtr pScreen)
|
|
||||||
{
|
{
|
||||||
CMapScreenPtr pScreenPriv =
|
CMapScreenPtr pScreenPriv =
|
||||||
(CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
|
(CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
|
||||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||||
|
|
||||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
if (!pScrn)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dixScreenUnhookClose(pScreen, CMapCloseScreen);
|
||||||
|
|
||||||
pScreen->CreateColormap = pScreenPriv->CreateColormap;
|
pScreen->CreateColormap = pScreenPriv->CreateColormap;
|
||||||
pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
|
pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
|
||||||
pScreen->InstallColormap = pScreenPriv->InstallColormap;
|
pScreen->InstallColormap = pScreenPriv->InstallColormap;
|
||||||
|
@ -848,6 +841,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
|
||||||
free(pScreenPriv->gamma);
|
free(pScreenPriv->gamma);
|
||||||
free(pScreenPriv->PreAllocIndices);
|
free(pScreenPriv->PreAllocIndices);
|
||||||
free(pScreenPriv);
|
free(pScreenPriv);
|
||||||
|
dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue