(!1714) miext: shadow: 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
							
								
									b99c4ccae8
								
							
						
					
					
						commit
						0790f2c92a
					
				| 
						 | 
					@ -23,8 +23,10 @@
 | 
				
			||||||
#include <dix-config.h>
 | 
					#include <dix-config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <X11/X.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include    <X11/X.h>
 | 
					 | 
				
			||||||
#include    "scrnintstr.h"
 | 
					#include    "scrnintstr.h"
 | 
				
			||||||
#include    "windowstr.h"
 | 
					#include    "windowstr.h"
 | 
				
			||||||
#include    "dixfontstr.h"
 | 
					#include    "dixfontstr.h"
 | 
				
			||||||
| 
						 | 
					@ -93,19 +95,17 @@ shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
 | 
				
			||||||
    wrap(pBuf, pScreen, GetImage);
 | 
					    wrap(pBuf, pScreen, GetImage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void shadowCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
 | 
				
			||||||
shadowCloseScreen(ScreenPtr pScreen)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    shadowBuf(pScreen);
 | 
					    dixScreenUnhookClose(pScreen, shadowCloseScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    shadowBuf(pScreen);
 | 
				
			||||||
    unwrap(pBuf, pScreen, GetImage);
 | 
					    unwrap(pBuf, pScreen, GetImage);
 | 
				
			||||||
    unwrap(pBuf, pScreen, CloseScreen);
 | 
					 | 
				
			||||||
    unwrap(pBuf, pScreen, BlockHandler);
 | 
					    unwrap(pBuf, pScreen, BlockHandler);
 | 
				
			||||||
    shadowRemove(pScreen, pBuf->pPixmap);
 | 
					    shadowRemove(pScreen, pBuf->pPixmap);
 | 
				
			||||||
    DamageDestroy(pBuf->pDamage);
 | 
					    DamageDestroy(pBuf->pDamage);
 | 
				
			||||||
    dixDestroyPixmap(pBuf->pPixmap, 0);
 | 
					    dixDestroyPixmap(pBuf->pPixmap, 0);
 | 
				
			||||||
    free(pBuf);
 | 
					    free(pBuf);
 | 
				
			||||||
    return pScreen->CloseScreen(pScreen);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
| 
						 | 
					@ -130,7 +130,8 @@ shadowSetup(ScreenPtr pScreen)
 | 
				
			||||||
        return FALSE;
 | 
					        return FALSE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wrap(pBuf, pScreen, CloseScreen);
 | 
					    dixScreenHookClose(pScreen, shadowCloseScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wrap(pBuf, pScreen, GetImage);
 | 
					    wrap(pBuf, pScreen, GetImage);
 | 
				
			||||||
    wrap(pBuf, pScreen, BlockHandler);
 | 
					    wrap(pBuf, pScreen, BlockHandler);
 | 
				
			||||||
    pBuf->update = 0;
 | 
					    pBuf->update = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,6 @@ typedef struct _shadowBuf {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* screen wrappers */
 | 
					    /* screen wrappers */
 | 
				
			||||||
    GetImageProcPtr GetImage;
 | 
					    GetImageProcPtr GetImage;
 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					 | 
				
			||||||
    ScreenBlockHandlerProcPtr BlockHandler;
 | 
					    ScreenBlockHandlerProcPtr BlockHandler;
 | 
				
			||||||
} shadowBufRec;
 | 
					} shadowBufRec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue