render: 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
d61de13690
commit
a9d35bcdd2
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "dix/cursor_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
#include "dix/screen_hooks_priv.h"
|
||||
|
||||
#include "servermd.h"
|
||||
#include "scrnintstr.h"
|
||||
|
@ -61,7 +62,6 @@ typedef struct _AnimCur {
|
|||
} AnimCurRec, *AnimCurPtr;
|
||||
|
||||
typedef struct _AnimScrPriv {
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
CursorLimitsProcPtr CursorLimits;
|
||||
DisplayCursorProcPtr DisplayCursor;
|
||||
SetCursorPositionProcPtr SetCursorPosition;
|
||||
|
@ -85,13 +85,11 @@ static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
|
|||
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
||||
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
|
||||
|
||||
static Bool
|
||||
AnimCurCloseScreen(ScreenPtr pScreen)
|
||||
static void AnimCurScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
|
||||
{
|
||||
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
|
||||
Bool ret;
|
||||
|
||||
Unwrap(as, pScreen, CloseScreen);
|
||||
dixScreenUnhookClose(pScreen, AnimCurScreenClose);
|
||||
|
||||
Unwrap(as, pScreen, CursorLimits);
|
||||
Unwrap(as, pScreen, DisplayCursor);
|
||||
|
@ -99,8 +97,6 @@ AnimCurCloseScreen(ScreenPtr pScreen)
|
|||
Unwrap(as, pScreen, RealizeCursor);
|
||||
Unwrap(as, pScreen, UnrealizeCursor);
|
||||
Unwrap(as, pScreen, RecolorCursor);
|
||||
ret = (*pScreen->CloseScreen) (pScreen);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -287,7 +283,7 @@ AnimCurInit(ScreenPtr pScreen)
|
|||
|
||||
as = GetAnimCurScreen(pScreen);
|
||||
|
||||
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
|
||||
dixScreenHookClose(pScreen, AnimCurScreenClose);
|
||||
|
||||
Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
|
||||
Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
|
||||
|
|
|
@ -77,15 +77,11 @@ picture_window_destructor(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pW
|
|||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
PictureCloseScreen(ScreenPtr pScreen)
|
||||
static void PictureScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
|
||||
{
|
||||
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
||||
Bool ret;
|
||||
int n;
|
||||
|
||||
pScreen->CloseScreen = ps->CloseScreen;
|
||||
ret = (*pScreen->CloseScreen) (pScreen);
|
||||
PictureResetFilters(pScreen);
|
||||
for (n = 0; n < ps->nformats; n++)
|
||||
if (ps->formats[n].type == PictTypeIndexed)
|
||||
|
@ -94,7 +90,7 @@ PictureCloseScreen(ScreenPtr pScreen)
|
|||
SetPictureScreen(pScreen, 0);
|
||||
free(ps->formats);
|
||||
free(ps);
|
||||
return ret;
|
||||
dixScreenUnhookClose(pScreen, PictureScreenClose);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -685,12 +681,11 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
|||
|
||||
ps->subpixel = SubPixelUnknown;
|
||||
|
||||
ps->CloseScreen = pScreen->CloseScreen;
|
||||
ps->StoreColors = pScreen->StoreColors;
|
||||
pScreen->CloseScreen = PictureCloseScreen;
|
||||
pScreen->StoreColors = PictureStoreColors;
|
||||
|
||||
dixScreenHookWindowDestroy(pScreen, picture_window_destructor);
|
||||
dixScreenHookClose(pScreen, PictureScreenClose);
|
||||
|
||||
if (!PictureSetDefaultFilters(pScreen)) {
|
||||
PictureResetFilters(pScreen);
|
||||
|
|
|
@ -294,8 +294,6 @@ typedef struct _PictureScreen {
|
|||
GlyphsProcPtr Glyphs; /* unused */
|
||||
CompositeRectsProcPtr CompositeRects;
|
||||
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
|
||||
StoreColorsProcPtr StoreColors;
|
||||
|
||||
InitIndexedProcPtr InitIndexed;
|
||||
|
|
Loading…
Reference in New Issue