composite: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new window destructor hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
f208c7a971
commit
c3d780d07f
|
@ -44,6 +44,7 @@
|
|||
#include <dix-config.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/screen_hooks_priv.h"
|
||||
#include "os/osdep.h"
|
||||
|
||||
#include "compint.h"
|
||||
|
@ -76,12 +77,13 @@ compCloseScreen(ScreenPtr pScreen)
|
|||
pScreen->ClipNotify = cs->ClipNotify;
|
||||
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
|
||||
pScreen->RealizeWindow = cs->RealizeWindow;
|
||||
pScreen->DestroyWindow = cs->DestroyWindow;
|
||||
pScreen->CreateWindow = cs->CreateWindow;
|
||||
pScreen->CopyWindow = cs->CopyWindow;
|
||||
pScreen->PositionWindow = cs->PositionWindow;
|
||||
pScreen->SourceValidate = cs->SourceValidate;
|
||||
|
||||
dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy);
|
||||
|
||||
free(cs);
|
||||
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
|
||||
ret = (*pScreen->CloseScreen) (pScreen);
|
||||
|
@ -368,6 +370,8 @@ compScreenInit(ScreenPtr pScreen)
|
|||
if (!disableBackingStore)
|
||||
pScreen->backingStoreSupport = WhenMapped;
|
||||
|
||||
dixScreenHookWindowDestroy(pScreen, compWindowDestroy);
|
||||
|
||||
cs->PositionWindow = pScreen->PositionWindow;
|
||||
pScreen->PositionWindow = compPositionWindow;
|
||||
|
||||
|
@ -377,9 +381,6 @@ compScreenInit(ScreenPtr pScreen)
|
|||
cs->CreateWindow = pScreen->CreateWindow;
|
||||
pScreen->CreateWindow = compCreateWindow;
|
||||
|
||||
cs->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = compDestroyWindow;
|
||||
|
||||
cs->RealizeWindow = pScreen->RealizeWindow;
|
||||
pScreen->RealizeWindow = compRealizeWindow;
|
||||
|
||||
|
|
|
@ -127,7 +127,6 @@ typedef struct _CompScreen {
|
|||
PositionWindowProcPtr PositionWindow;
|
||||
CopyWindowProcPtr CopyWindow;
|
||||
CreateWindowProcPtr CreateWindow;
|
||||
DestroyWindowProcPtr DestroyWindow;
|
||||
RealizeWindowProcPtr RealizeWindow;
|
||||
UnrealizeWindowProcPtr UnrealizeWindow;
|
||||
ClipNotifyProcPtr ClipNotify;
|
||||
|
@ -308,8 +307,7 @@ void
|
|||
Bool
|
||||
compCreateWindow(WindowPtr pWin);
|
||||
|
||||
Bool
|
||||
compDestroyWindow(WindowPtr pWin);
|
||||
void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
|
||||
|
||||
void
|
||||
compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);
|
||||
|
|
|
@ -596,16 +596,12 @@ compCreateWindow(WindowPtr pWin)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
compDestroyWindow(WindowPtr pWin)
|
||||
void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
CompWindowPtr cw;
|
||||
CompSubwindowsPtr csw;
|
||||
Bool ret;
|
||||
|
||||
pScreen->DestroyWindow = cs->DestroyWindow;
|
||||
while ((cw = GetCompWindow(pWin)))
|
||||
FreeResource(cw->clients->id, X11_RESTYPE_NONE);
|
||||
while ((csw = GetCompSubwindows(pWin)))
|
||||
|
@ -617,16 +613,12 @@ compDestroyWindow(WindowPtr pWin)
|
|||
compSetParentPixmap(pWin);
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
}
|
||||
ret = (*pScreen->DestroyWindow) (pWin);
|
||||
cs->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = compDestroyWindow;
|
||||
|
||||
/* Did we just destroy the overlay window? */
|
||||
if (pWin == cs->pOverlayWin)
|
||||
cs->pOverlayWin = NULL;
|
||||
|
||||
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue