panoramiX: 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
							
								
									0a516b5690
								
							
						
					
					
						commit
						69f5c3c4ff
					
				| 
						 | 
					@ -32,6 +32,7 @@ Equipment Corporation.
 | 
				
			||||||
#include <X11/extensions/panoramiXproto.h>
 | 
					#include <X11/extensions/panoramiXproto.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "dix/dix_priv.h"
 | 
					#include "dix/dix_priv.h"
 | 
				
			||||||
 | 
					#include "dix/screen_hooks_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "misc.h"
 | 
					#include "misc.h"
 | 
				
			||||||
#include "cursor.h"
 | 
					#include "cursor.h"
 | 
				
			||||||
| 
						 | 
					@ -123,7 +124,6 @@ typedef struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
    CreateGCProcPtr CreateGC;
 | 
					    CreateGCProcPtr CreateGC;
 | 
				
			||||||
    CloseScreenProcPtr CloseScreen;
 | 
					 | 
				
			||||||
} PanoramiXScreenRec, *PanoramiXScreenPtr;
 | 
					} PanoramiXScreenRec, *PanoramiXScreenPtr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 | 
					static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 | 
				
			||||||
| 
						 | 
					@ -148,21 +148,23 @@ static const GCFuncs XineramaGCFuncs = {
 | 
				
			||||||
    pGCPriv->wrapFuncs = (pGC)->funcs;\
 | 
					    pGCPriv->wrapFuncs = (pGC)->funcs;\
 | 
				
			||||||
    (pGC)->funcs = &XineramaGCFuncs;
 | 
					    (pGC)->funcs = &XineramaGCFuncs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static void XineramaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unsused)
 | 
				
			||||||
XineramaCloseScreen(ScreenPtr pScreen)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    dixScreenUnhookClose(pScreen, XineramaCloseScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
 | 
					    PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
 | 
				
			||||||
        dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
 | 
					        dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->CloseScreen = pScreenPriv->CloseScreen;
 | 
					    if (!pScreenPriv)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pScreen->CreateGC = pScreenPriv->CreateGC;
 | 
					    pScreen->CreateGC = pScreenPriv->CreateGC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (pScreen->myNum == 0)
 | 
					    if (pScreen->myNum == 0)
 | 
				
			||||||
        RegionUninit(&PanoramiXScreenRegion);
 | 
					        RegionUninit(&PanoramiXScreenRegion);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    free(pScreenPriv);
 | 
					    free(pScreenPriv);
 | 
				
			||||||
 | 
					    dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, NULL);
 | 
				
			||||||
    return (*pScreen->CloseScreen) (pScreen);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
| 
						 | 
					@ -484,11 +486,10 @@ PanoramiXExtensionInit(void)
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            pScreenPriv->CreateGC = pScreen->CreateGC;
 | 
					            dixScreenHookClose(pScreen, XineramaCloseScreen);
 | 
				
			||||||
            pScreenPriv->CloseScreen = pScreen->CloseScreen;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            pScreenPriv->CreateGC = pScreen->CreateGC;
 | 
				
			||||||
            pScreen->CreateGC = XineramaCreateGC;
 | 
					            pScreen->CreateGC = XineramaCreateGC;
 | 
				
			||||||
            pScreen->CloseScreen = XineramaCloseScreen;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        XRC_DRAWABLE = CreateNewResourceClass();
 | 
					        XRC_DRAWABLE = CreateNewResourceClass();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue