diff options
Diffstat (limited to 'mi/mioverlay.c')
-rw-r--r-- | mi/mioverlay.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/mi/mioverlay.c b/mi/mioverlay.c index 1dd28b85b..a0adac54d 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -10,6 +10,7 @@ #include "mi.h" #include "gcstruct.h" #include "regionstr.h" +#include "privates.h" #include "mivalidate.h" #include "mioverlay.h" #include "migc.h" @@ -53,9 +54,8 @@ typedef struct { Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; -static unsigned long miOverlayGeneration = 0; -static int miOverlayWindowIndex = -1; -static int miOverlayScreenIndex = -1; +static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKey; +static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKey; static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); @@ -85,10 +85,10 @@ static void miOverlaySetShape(WindowPtr); #endif static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); -#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) \ - ((miOverlayScreenPtr)((pScreen)->devPrivates[miOverlayScreenIndex].ptr)) -#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) \ - ((miOverlayWindowPtr)((pWin)->devPrivates[miOverlayWindowIndex].ptr)) +#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey)) +#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey)) #define MIOVERLAY_GET_WINDOW_TREE(pWin) \ (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree) @@ -112,22 +112,13 @@ miInitOverlay( if(!inOverlayFunc || !transFunc) return FALSE; - if(miOverlayGeneration != serverGeneration) { - if(((miOverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((miOverlayWindowIndex = AllocateWindowPrivateIndex()) < 0)) - return FALSE; - - miOverlayGeneration = serverGeneration; - } - - if(!AllocateWindowPrivate(pScreen, miOverlayWindowIndex, - sizeof(miOverlayWindowRec))) + if(!dixRequestPrivate(miOverlayWindowKey, sizeof(miOverlayWindowRec))) return FALSE; if(!(pScreenPriv = xalloc(sizeof(miOverlayScreenRec)))) return FALSE; - pScreen->devPrivates[miOverlayScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; |