xfree86: cursor: 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
866afe931a
commit
da21e09c2d
|
@ -4,6 +4,7 @@
|
|||
#endif
|
||||
|
||||
#include "dix/cursor_priv.h"
|
||||
#include "dix/screen_hooks_priv.h"
|
||||
#include "mi/mipointer_priv.h"
|
||||
|
||||
#include "xf86.h"
|
||||
|
@ -46,7 +47,7 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
|
|||
static void xf86CursorInstallColormap(ColormapPtr);
|
||||
static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr,
|
||||
Bool);
|
||||
static Bool xf86CursorCloseScreen(ScreenPtr);
|
||||
static void xf86CursorCloseScreen(CallbackListPtr *, ScreenPtr, void *);
|
||||
static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
|
||||
ScreenPtr);
|
||||
|
||||
|
@ -85,8 +86,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
|
|||
ScreenPriv->PalettedCursor = FALSE;
|
||||
ScreenPriv->pInstalledMap = NULL;
|
||||
|
||||
ScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = xf86CursorCloseScreen;
|
||||
dixScreenHookClose(pScreen, xf86CursorCloseScreen);
|
||||
ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
|
||||
pScreen->QueryBestSize = xf86CursorQueryBestSize;
|
||||
ScreenPriv->RecolorCursor = pScreen->RecolorCursor;
|
||||
|
@ -124,10 +124,15 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
|
|||
|
||||
/***** Screen functions *****/
|
||||
|
||||
static Bool
|
||||
xf86CursorCloseScreen(ScreenPtr pScreen)
|
||||
static void xf86CursorCloseScreen(CallbackListPtr *pcbl,
|
||||
ScreenPtr pScreen, void *unused)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
if (!pScrn)
|
||||
return;
|
||||
|
||||
dixScreenUnhookClose(pScreen, xf86CursorCloseScreen);
|
||||
|
||||
miPointerScreenPtr PointPriv =
|
||||
(miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
||||
miPointerScreenKey);
|
||||
|
@ -141,7 +146,6 @@ xf86CursorCloseScreen(ScreenPtr pScreen)
|
|||
if (ScreenPriv->CurrentCursor)
|
||||
FreeCursor(ScreenPriv->CurrentCursor, None);
|
||||
|
||||
pScreen->CloseScreen = ScreenPriv->CloseScreen;
|
||||
pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
|
||||
pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
|
||||
if (ScreenPriv->InstallColormap)
|
||||
|
@ -155,8 +159,7 @@ xf86CursorCloseScreen(ScreenPtr pScreen)
|
|||
|
||||
free(ScreenPriv->transparentData);
|
||||
free(ScreenPriv);
|
||||
|
||||
return (*pScreen->CloseScreen) (pScreen);
|
||||
dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue