xv: 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
							
								
									c335d5a92e
								
							
						
					
					
						commit
						f208c7a971
					
				| 
						 | 
					@ -173,7 +173,6 @@ typedef struct {
 | 
				
			||||||
    int version, revision;
 | 
					    int version, revision;
 | 
				
			||||||
    int nAdaptors;
 | 
					    int nAdaptors;
 | 
				
			||||||
    XvAdaptorPtr pAdaptors;
 | 
					    XvAdaptorPtr pAdaptors;
 | 
				
			||||||
    DestroyWindowProcPtr DestroyWindow;
 | 
					 | 
				
			||||||
    DestroyPixmapProcPtr DestroyPixmap;
 | 
					    DestroyPixmapProcPtr DestroyPixmap;
 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					    CloseScreenProcPtr CloseScreen;
 | 
				
			||||||
} XvScreenRec, *XvScreenPtr;
 | 
					} XvScreenRec, *XvScreenPtr;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,6 +81,7 @@ SOFTWARE.
 | 
				
			||||||
#include <X11/extensions/Xv.h>
 | 
					#include <X11/extensions/Xv.h>
 | 
				
			||||||
#include <X11/extensions/Xvproto.h>
 | 
					#include <X11/extensions/Xvproto.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
#include "Xext/xvdix_priv.h"
 | 
					#include "Xext/xvdix_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "misc.h"
 | 
					#include "misc.h"
 | 
				
			||||||
| 
						 | 
					@ -143,7 +144,6 @@ static Bool CreateResourceTypes(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool XvCloseScreen(ScreenPtr);
 | 
					static Bool XvCloseScreen(ScreenPtr);
 | 
				
			||||||
static Bool XvDestroyPixmap(PixmapPtr);
 | 
					static Bool XvDestroyPixmap(PixmapPtr);
 | 
				
			||||||
static Bool XvDestroyWindow(WindowPtr);
 | 
					 | 
				
			||||||
static void XvResetProc(ExtensionEntry *);
 | 
					static void XvResetProc(ExtensionEntry *);
 | 
				
			||||||
static int XvdiDestroyGrab(void *, XID);
 | 
					static int XvdiDestroyGrab(void *, XID);
 | 
				
			||||||
static int XvdiDestroyEncoding(void *, XID);
 | 
					static int XvdiDestroyEncoding(void *, XID);
 | 
				
			||||||
| 
						 | 
					@ -152,6 +152,7 @@ static int XvdiDestroyPortNotify(void *, XID);
 | 
				
			||||||
static int XvdiDestroyVideoNotifyList(void *, XID);
 | 
					static int XvdiDestroyVideoNotifyList(void *, XID);
 | 
				
			||||||
static int XvdiDestroyPort(void *, XID);
 | 
					static int XvdiDestroyPort(void *, XID);
 | 
				
			||||||
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
 | 
					static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
 | 
				
			||||||
 | 
					static void XvStopAdaptors(DrawablePtr pDrawable);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
** XvExtensionInit
 | 
					** XvExtensionInit
 | 
				
			||||||
| 
						 | 
					@ -257,6 +258,11 @@ CreateResourceTypes(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    XvStopAdaptors(&pWin->drawable);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
XvScreenInit(ScreenPtr pScreen)
 | 
					XvScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -291,11 +297,11 @@ XvScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
 | 
					    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pxvs->DestroyPixmap = pScreen->DestroyPixmap;
 | 
					    pxvs->DestroyPixmap = pScreen->DestroyPixmap;
 | 
				
			||||||
    pxvs->DestroyWindow = pScreen->DestroyWindow;
 | 
					 | 
				
			||||||
    pxvs->CloseScreen = pScreen->CloseScreen;
 | 
					    pxvs->CloseScreen = pScreen->CloseScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->DestroyPixmap = XvDestroyPixmap;
 | 
					    pScreen->DestroyPixmap = XvDestroyPixmap;
 | 
				
			||||||
    pScreen->DestroyWindow = XvDestroyWindow;
 | 
					 | 
				
			||||||
    pScreen->CloseScreen = XvCloseScreen;
 | 
					    pScreen->CloseScreen = XvCloseScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
| 
						 | 
					@ -304,13 +310,13 @@ XvScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
XvCloseScreen(ScreenPtr pScreen)
 | 
					XvCloseScreen(ScreenPtr pScreen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					 | 
				
			||||||
    XvScreenPtr pxvs;
 | 
					    XvScreenPtr pxvs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
 | 
					    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->DestroyPixmap = pxvs->DestroyPixmap;
 | 
					    pScreen->DestroyPixmap = pxvs->DestroyPixmap;
 | 
				
			||||||
    pScreen->DestroyWindow = pxvs->DestroyWindow;
 | 
					 | 
				
			||||||
    pScreen->CloseScreen = pxvs->CloseScreen;
 | 
					    pScreen->CloseScreen = pxvs->CloseScreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    free(pxvs);
 | 
					    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
 | 
					static int
 | 
				
			||||||
XvdiDestroyPort(void *pPort, XID id)
 | 
					XvdiDestroyPort(void *pPort, XID id)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue