diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 0ead1c80a..38b599583 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -173,7 +173,6 @@ typedef struct { int version, revision; int nAdaptors; XvAdaptorPtr pAdaptors; - DestroyWindowProcPtr DestroyWindow; DestroyPixmapProcPtr DestroyPixmap; CloseScreenProcPtr CloseScreen; } XvScreenRec, *XvScreenPtr; diff --git a/Xext/xvmain.c b/Xext/xvmain.c index bc4a7489d..4c455c537 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -81,6 +81,7 @@ SOFTWARE. #include #include +#include "dix/screen_hooks_priv.h" #include "Xext/xvdix_priv.h" #include "misc.h" @@ -143,7 +144,6 @@ static Bool CreateResourceTypes(void); static Bool XvCloseScreen(ScreenPtr); static Bool XvDestroyPixmap(PixmapPtr); -static Bool XvDestroyWindow(WindowPtr); static void XvResetProc(ExtensionEntry *); static int XvdiDestroyGrab(void *, XID); static int XvdiDestroyEncoding(void *, XID); @@ -152,6 +152,7 @@ static int XvdiDestroyPortNotify(void *, XID); static int XvdiDestroyVideoNotifyList(void *, XID); static int XvdiDestroyPort(void *, XID); static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int); +static void XvStopAdaptors(DrawablePtr pDrawable); /* ** XvExtensionInit @@ -257,6 +258,11 @@ CreateResourceTypes(void) } +static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin) +{ + XvStopAdaptors(&pWin->drawable); +} + int XvScreenInit(ScreenPtr pScreen) { @@ -291,11 +297,11 @@ XvScreenInit(ScreenPtr pScreen) dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs); pxvs->DestroyPixmap = pScreen->DestroyPixmap; - pxvs->DestroyWindow = pScreen->DestroyWindow; pxvs->CloseScreen = pScreen->CloseScreen; + dixScreenHookWindowDestroy(pScreen, XvWindowDestroy); + pScreen->DestroyPixmap = XvDestroyPixmap; - pScreen->DestroyWindow = XvDestroyWindow; pScreen->CloseScreen = XvCloseScreen; return Success; @@ -304,13 +310,13 @@ XvScreenInit(ScreenPtr pScreen) static Bool XvCloseScreen(ScreenPtr pScreen) { - XvScreenPtr pxvs; pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); + dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy); + pScreen->DestroyPixmap = pxvs->DestroyPixmap; - pScreen->DestroyWindow = pxvs->DestroyWindow; pScreen->CloseScreen = pxvs->CloseScreen; free(pxvs); @@ -385,21 +391,6 @@ XvDestroyPixmap(PixmapPtr pPix) } -static Bool -XvDestroyWindow(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - Bool status; - - XvStopAdaptors(&pWin->drawable); - - SCREEN_PROLOGUE(pScreen, DestroyWindow); - status = (*pScreen->DestroyWindow) (pWin); - SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow); - - return status; - -} static int XvdiDestroyPort(void *pPort, XID id)