xfree86: dga: 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
							
								
									69f5c3c4ff
								
							
						
					
					
						commit
						623171ce3f
					
				| 
						 | 
					@ -50,6 +50,7 @@
 | 
				
			||||||
#include "dix/dix_priv.h"
 | 
					#include "dix/dix_priv.h"
 | 
				
			||||||
#include "dix/eventconvert.h"
 | 
					#include "dix/eventconvert.h"
 | 
				
			||||||
#include "dix/exevents_priv.h"
 | 
					#include "dix/exevents_priv.h"
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
#include "mi/mi_priv.h"
 | 
					#include "mi/mi_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "xf86.h"
 | 
					#include "xf86.h"
 | 
				
			||||||
| 
						 | 
					@ -83,7 +84,7 @@ static DevPrivateKeyRec DGAScreenKeyRec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
 | 
					#define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool DGACloseScreen(ScreenPtr pScreen);
 | 
					static void DGACloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
 | 
				
			||||||
static void DGADestroyColormap(ColormapPtr pmap);
 | 
					static void DGADestroyColormap(ColormapPtr pmap);
 | 
				
			||||||
static void DGAInstallColormap(ColormapPtr pmap);
 | 
					static void DGAInstallColormap(ColormapPtr pmap);
 | 
				
			||||||
static void DGAUninstallColormap(ColormapPtr pmap);
 | 
					static void DGAUninstallColormap(ColormapPtr pmap);
 | 
				
			||||||
| 
						 | 
					@ -110,7 +111,6 @@ typedef struct {
 | 
				
			||||||
    ScrnInfoPtr pScrn;
 | 
					    ScrnInfoPtr pScrn;
 | 
				
			||||||
    int numModes;
 | 
					    int numModes;
 | 
				
			||||||
    DGAModePtr modes;
 | 
					    DGAModePtr modes;
 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					 | 
				
			||||||
    DestroyColormapProcPtr DestroyColormap;
 | 
					    DestroyColormapProcPtr DestroyColormap;
 | 
				
			||||||
    InstallColormapProcPtr InstallColormap;
 | 
					    InstallColormapProcPtr InstallColormap;
 | 
				
			||||||
    UninstallColormapProcPtr UninstallColormap;
 | 
					    UninstallColormapProcPtr UninstallColormap;
 | 
				
			||||||
| 
						 | 
					@ -148,8 +148,7 @@ DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
 | 
				
			||||||
        if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec))))
 | 
					        if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec))))
 | 
				
			||||||
            return FALSE;
 | 
					            return FALSE;
 | 
				
			||||||
        dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
 | 
					        dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
 | 
				
			||||||
        pScreenPriv->CloseScreen = pScreen->CloseScreen;
 | 
					        dixScreenHookClose(pScreen, DGACloseScreen);
 | 
				
			||||||
        pScreen->CloseScreen = DGACloseScreen;
 | 
					 | 
				
			||||||
        pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
 | 
					        pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
 | 
				
			||||||
        pScreen->DestroyColormap = DGADestroyColormap;
 | 
					        pScreen->DestroyColormap = DGADestroyColormap;
 | 
				
			||||||
        pScreenPriv->InstallColormap = pScreen->InstallColormap;
 | 
					        pScreenPriv->InstallColormap = pScreen->InstallColormap;
 | 
				
			||||||
| 
						 | 
					@ -263,23 +262,24 @@ FreeMarkedVisuals(ScreenPtr pScreen)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void DGACloseScreen(CallbackListPtr *pcbl,
 | 
				
			||||||
DGACloseScreen(ScreenPtr pScreen)
 | 
					                           ScreenPtr pScreen, void *unused)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 | 
					    DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 | 
				
			||||||
 | 
					    if (!pScreenPriv)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mieqSetHandler(ET_DGAEvent, NULL);
 | 
					    mieqSetHandler(ET_DGAEvent, NULL);
 | 
				
			||||||
    pScreenPriv->pScrn->SetDGAMode(pScreenPriv->pScrn, 0, NULL);
 | 
					    pScreenPriv->pScrn->SetDGAMode(pScreenPriv->pScrn, 0, NULL);
 | 
				
			||||||
    FreeMarkedVisuals(pScreen);
 | 
					    FreeMarkedVisuals(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->CloseScreen = pScreenPriv->CloseScreen;
 | 
					    dixScreenUnhookClose(pScreen, DGACloseScreen);
 | 
				
			||||||
    pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
 | 
					    pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
 | 
				
			||||||
    pScreen->InstallColormap = pScreenPriv->InstallColormap;
 | 
					    pScreen->InstallColormap = pScreenPriv->InstallColormap;
 | 
				
			||||||
    pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
 | 
					    pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    free(pScreenPriv);
 | 
					    free(pScreenPriv);
 | 
				
			||||||
 | 
					    dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, NULL);
 | 
				
			||||||
    return ((*pScreen->CloseScreen) (pScreen));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue