(!1714) xv: 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
							
								
									ff29e0294e
								
							
						
					
					
						commit
						7ee9f4e397
					
				| 
						 | 
					@ -174,7 +174,6 @@ typedef struct {
 | 
				
			||||||
    int nAdaptors;
 | 
					    int nAdaptors;
 | 
				
			||||||
    XvAdaptorPtr pAdaptors;
 | 
					    XvAdaptorPtr pAdaptors;
 | 
				
			||||||
    DestroyPixmapProcPtr DestroyPixmap;
 | 
					    DestroyPixmapProcPtr DestroyPixmap;
 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					 | 
				
			||||||
} XvScreenRec, *XvScreenPtr;
 | 
					} XvScreenRec, *XvScreenPtr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern _X_EXPORT int XvScreenInit(ScreenPtr);
 | 
					extern _X_EXPORT int XvScreenInit(ScreenPtr);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
 | 
				
			||||||
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
 | 
					static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
 | 
				
			||||||
static Bool CreateResourceTypes(void);
 | 
					static Bool CreateResourceTypes(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool XvCloseScreen(ScreenPtr);
 | 
					static void XvScreenClose(ScreenPtr, void *arg);
 | 
				
			||||||
static Bool XvDestroyPixmap(PixmapPtr);
 | 
					static Bool XvDestroyPixmap(PixmapPtr);
 | 
				
			||||||
static void XvResetProc(ExtensionEntry *);
 | 
					static void XvResetProc(ExtensionEntry *);
 | 
				
			||||||
static int XvdiDestroyGrab(void *, XID);
 | 
					static int XvdiDestroyGrab(void *, XID);
 | 
				
			||||||
| 
						 | 
					@ -296,33 +296,29 @@ XvScreenInit(ScreenPtr pScreen)
 | 
				
			||||||
    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
 | 
					    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pxvs->DestroyPixmap = pScreen->DestroyPixmap;
 | 
					    pxvs->DestroyPixmap = pScreen->DestroyPixmap;
 | 
				
			||||||
    pxvs->CloseScreen = pScreen->CloseScreen;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dixScreenHookWindowDestroy(pScreen, XvWindowDestroy, NULL);
 | 
					    dixScreenHookWindowDestroy(pScreen, XvWindowDestroy, NULL);
 | 
				
			||||||
 | 
					    dixScreenHookClose(pScreen, XvScreenClose, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->DestroyPixmap = XvDestroyPixmap;
 | 
					    pScreen->DestroyPixmap = XvDestroyPixmap;
 | 
				
			||||||
    pScreen->CloseScreen = XvCloseScreen;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Success;
 | 
					    return Success;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void XvScreenClose(ScreenPtr pScreen, void *arg)
 | 
				
			||||||
XvCloseScreen(ScreenPtr pScreen)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    XvScreenPtr pxvs;
 | 
					    XvScreenPtr pxvs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
 | 
					    pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy, NULL);
 | 
					    dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy, NULL);
 | 
				
			||||||
 | 
					    dixScreenUnhookClose(pScreen, XvScreenClose, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->DestroyPixmap = pxvs->DestroyPixmap;
 | 
					    pScreen->DestroyPixmap = pxvs->DestroyPixmap;
 | 
				
			||||||
    pScreen->CloseScreen = pxvs->CloseScreen;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    free(pxvs);
 | 
					    free(pxvs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
 | 
					    dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    return (*pScreen->CloseScreen) (pScreen);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue