(!1714) xfree86: dri: 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
							
								
									c2652c3111
								
							
						
					
					
						commit
						4d9a8ca3c3
					
				| 
						 | 
				
			
			@ -44,7 +44,6 @@ typedef struct dri3_dmabuf_format {
 | 
			
		|||
typedef struct dri3_screen_priv {
 | 
			
		||||
    CloseScreenProcPtr          CloseScreen;
 | 
			
		||||
    ConfigNotifyProcPtr         ConfigNotify;
 | 
			
		||||
    DestroyWindowProcPtr        DestroyWindow;
 | 
			
		||||
 | 
			
		||||
    Bool                        formats_cached;
 | 
			
		||||
    CARD32                      num_formats;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -634,7 +634,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 | 
			
		|||
    return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool DRIDestroyWindow(WindowPtr pWin);
 | 
			
		||||
static void DRIWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg);
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
DRIFinishScreenInit(ScreenPtr pScreen)
 | 
			
		||||
| 
						 | 
				
			
			@ -648,8 +648,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
 | 
			
		|||
        pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
 | 
			
		||||
    pScreen->DestroyWindow = DRIDestroyWindow;
 | 
			
		||||
    dixScreenHookWindowDestroy(pScreen, DRIWindowDestroy, NULL);
 | 
			
		||||
 | 
			
		||||
    pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
 | 
			
		||||
                                                       dri_crtc_notify);
 | 
			
		||||
| 
						 | 
				
			
			@ -696,11 +695,8 @@ DRICloseScreen(ScreenPtr pScreen)
 | 
			
		|||
                pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
 | 
			
		||||
                pDRIPriv->wrap.WindowExposures = NULL;
 | 
			
		||||
            }
 | 
			
		||||
            if (pDRIPriv->DestroyWindow) {
 | 
			
		||||
                pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
 | 
			
		||||
                pDRIPriv->DestroyWindow = NULL;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            dixScreenUnhookWindowDestroy(pScreen, DRIWindowDestroy, NULL);
 | 
			
		||||
            xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
 | 
			
		||||
 | 
			
		||||
            if (pDRIInfo->wrap.CopyWindow) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1922,29 +1918,9 @@ DRITreeTraversal(WindowPtr pWin, void *data)
 | 
			
		|||
    return WT_WALKCHILDREN;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static Bool
 | 
			
		||||
DRIDestroyWindow(WindowPtr pWin)
 | 
			
		||||
static void DRIWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg)
 | 
			
		||||
{
 | 
			
		||||
    ScreenPtr pScreen = pWin->drawable.pScreen;
 | 
			
		||||
    DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 | 
			
		||||
    Bool retval = TRUE;
 | 
			
		||||
 | 
			
		||||
    DRIDrawablePrivDestroy(pWin);
 | 
			
		||||
 | 
			
		||||
    /* call lower wrapped functions */
 | 
			
		||||
    if (pDRIPriv->DestroyWindow) {
 | 
			
		||||
        /* unwrap */
 | 
			
		||||
        pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
 | 
			
		||||
 | 
			
		||||
        /* call lower layers */
 | 
			
		||||
        retval = (*pScreen->DestroyWindow) (pWin);
 | 
			
		||||
 | 
			
		||||
        /* rewrap */
 | 
			
		||||
        pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
 | 
			
		||||
        pScreen->DestroyWindow = DRIDestroyWindow;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,7 +90,6 @@ typedef struct _DRIScreenPrivRec {
 | 
			
		|||
    DrawablePtr fullscreen;     /* pointer to fullscreen drawable */
 | 
			
		||||
    drm_clip_rect_t fullscreen_rect;    /* fake rect for fullscreen mode */
 | 
			
		||||
    DRIWrappedFuncsRec wrap;
 | 
			
		||||
    DestroyWindowProcPtr DestroyWindow;
 | 
			
		||||
    DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
 | 
			
		||||
    DRIContextPrivPtr dummyCtxPriv;     /* Pointer to dummy context */
 | 
			
		||||
    Bool createDummyCtx;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue