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