(!1714) mi: overlay: 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
							
								
									527a0325d5
								
							
						
					
					
						commit
						1c8dc9e329
					
				|  | @ -46,7 +46,6 @@ typedef struct { | ||||||
| typedef struct { | typedef struct { | ||||||
|     CloseScreenProcPtr CloseScreen; |     CloseScreenProcPtr CloseScreen; | ||||||
|     CreateWindowProcPtr CreateWindow; |     CreateWindowProcPtr CreateWindow; | ||||||
|     DestroyWindowProcPtr DestroyWindow; |  | ||||||
|     UnrealizeWindowProcPtr UnrealizeWindow; |     UnrealizeWindowProcPtr UnrealizeWindow; | ||||||
|     RealizeWindowProcPtr RealizeWindow; |     RealizeWindowProcPtr RealizeWindow; | ||||||
|     miOverlayTransFunc MakeTransparent; |     miOverlayTransFunc MakeTransparent; | ||||||
|  | @ -69,7 +68,7 @@ static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr); | ||||||
| 
 | 
 | ||||||
| static Bool miOverlayCloseScreen(ScreenPtr); | static Bool miOverlayCloseScreen(ScreenPtr); | ||||||
| static Bool miOverlayCreateWindow(WindowPtr); | static Bool miOverlayCreateWindow(WindowPtr); | ||||||
| static Bool miOverlayDestroyWindow(WindowPtr); | static void miOverlayWindowDestroy(ScreenPtr pScreen, WindowPtr, void *arg); | ||||||
| static Bool miOverlayUnrealizeWindow(WindowPtr); | static Bool miOverlayUnrealizeWindow(WindowPtr); | ||||||
| static Bool miOverlayRealizeWindow(WindowPtr); | static Bool miOverlayRealizeWindow(WindowPtr); | ||||||
| static void miOverlayMarkWindow(WindowPtr); | static void miOverlayMarkWindow(WindowPtr); | ||||||
|  | @ -126,6 +125,7 @@ miInitOverlay(ScreenPtr pScreen, | ||||||
|         return FALSE; |         return FALSE; | ||||||
| 
 | 
 | ||||||
|     dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); |     dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); | ||||||
|  |     dixScreenHookWindowDestroy(pScreen, miOverlayWindowDestroy, NULL); | ||||||
| 
 | 
 | ||||||
|     pScreenPriv->InOverlay = inOverlayFunc; |     pScreenPriv->InOverlay = inOverlayFunc; | ||||||
|     pScreenPriv->MakeTransparent = transFunc; |     pScreenPriv->MakeTransparent = transFunc; | ||||||
|  | @ -133,13 +133,11 @@ miInitOverlay(ScreenPtr pScreen, | ||||||
| 
 | 
 | ||||||
|     pScreenPriv->CloseScreen = pScreen->CloseScreen; |     pScreenPriv->CloseScreen = pScreen->CloseScreen; | ||||||
|     pScreenPriv->CreateWindow = pScreen->CreateWindow; |     pScreenPriv->CreateWindow = pScreen->CreateWindow; | ||||||
|     pScreenPriv->DestroyWindow = pScreen->DestroyWindow; |  | ||||||
|     pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; |     pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; | ||||||
|     pScreenPriv->RealizeWindow = pScreen->RealizeWindow; |     pScreenPriv->RealizeWindow = pScreen->RealizeWindow; | ||||||
| 
 | 
 | ||||||
|     pScreen->CloseScreen = miOverlayCloseScreen; |     pScreen->CloseScreen = miOverlayCloseScreen; | ||||||
|     pScreen->CreateWindow = miOverlayCreateWindow; |     pScreen->CreateWindow = miOverlayCreateWindow; | ||||||
|     pScreen->DestroyWindow = miOverlayDestroyWindow; |  | ||||||
|     pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; |     pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; | ||||||
|     pScreen->RealizeWindow = miOverlayRealizeWindow; |     pScreen->RealizeWindow = miOverlayRealizeWindow; | ||||||
| 
 | 
 | ||||||
|  | @ -164,10 +162,10 @@ static Bool | ||||||
| miOverlayCloseScreen(ScreenPtr pScreen) | miOverlayCloseScreen(ScreenPtr pScreen) | ||||||
| { | { | ||||||
|     miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); |     miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); | ||||||
|  |     dixScreenUnhookWindowDestroy(pScreen, miOverlayWindowDestroy, NULL); | ||||||
| 
 | 
 | ||||||
|     pScreen->CloseScreen = pScreenPriv->CloseScreen; |     pScreen->CloseScreen = pScreenPriv->CloseScreen; | ||||||
|     pScreen->CreateWindow = pScreenPriv->CreateWindow; |     pScreen->CreateWindow = pScreenPriv->CreateWindow; | ||||||
|     pScreen->DestroyWindow = pScreenPriv->DestroyWindow; |  | ||||||
|     pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; |     pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; | ||||||
|     pScreen->RealizeWindow = pScreenPriv->RealizeWindow; |     pScreen->RealizeWindow = pScreenPriv->RealizeWindow; | ||||||
| 
 | 
 | ||||||
|  | @ -226,13 +224,10 @@ miOverlayCreateWindow(WindowPtr pWin) | ||||||
|     return TRUE; |     return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static Bool | static void | ||||||
| miOverlayDestroyWindow(WindowPtr pWin) | miOverlayWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg) | ||||||
| { | { | ||||||
|     ScreenPtr pScreen = pWin->drawable.pScreen; |  | ||||||
|     miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); |  | ||||||
|     miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); |     miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); | ||||||
|     Bool result = TRUE; |  | ||||||
| 
 | 
 | ||||||
|     if (pTree) { |     if (pTree) { | ||||||
|         if (pTree->prevSib) |         if (pTree->prevSib) | ||||||
|  | @ -249,14 +244,6 @@ miOverlayDestroyWindow(WindowPtr pWin) | ||||||
|         RegionUninit(&(pTree->clipList)); |         RegionUninit(&(pTree->clipList)); | ||||||
|         free(pTree); |         free(pTree); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     if (pScreenPriv->DestroyWindow) { |  | ||||||
|         pScreen->DestroyWindow = pScreenPriv->DestroyWindow; |  | ||||||
|         result = (*pScreen->DestroyWindow) (pWin); |  | ||||||
|         pScreen->DestroyWindow = miOverlayDestroyWindow; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return result; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static Bool | static Bool | ||||||
|  |  | ||||||
|  | @ -265,7 +265,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits,  /* pointer to screen bits */ | ||||||
|     pScreen->SaveScreen = miSaveScreen; |     pScreen->SaveScreen = miSaveScreen; | ||||||
|     /* GetImage, GetSpans */ |     /* GetImage, GetSpans */ | ||||||
|     pScreen->SourceValidate = miSourceValidate; |     pScreen->SourceValidate = miSourceValidate; | ||||||
|     /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ |     /* CreateWindow, PositionWindow, ChangeWindowAttributes */ | ||||||
|     /* RealizeWindow, UnrealizeWindow */ |     /* RealizeWindow, UnrealizeWindow */ | ||||||
|     pScreen->ValidateTree = miValidateTree; |     pScreen->ValidateTree = miValidateTree; | ||||||
|     pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; |     pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue