diff options
Diffstat (limited to 'composite')
-rw-r--r-- | composite/compalloc.c | 10 | ||||
-rw-r--r-- | composite/compext.c | 10 | ||||
-rw-r--r-- | composite/compinit.c | 30 | ||||
-rw-r--r-- | composite/compint.h | 16 |
4 files changed, 25 insertions, 41 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c index f555411bf..dbb7f3a05 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -137,7 +137,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) cw->oldy = COMP_ORIGIN_INVALID; cw->damageRegistered = FALSE; cw->damaged = FALSE; - pWin->devPrivates[CompWindowPrivateIndex].ptr = cw; + dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw); } ccw->next = cw->clients; cw->clients = ccw; @@ -212,7 +212,7 @@ compFreeClientWindow (WindowPtr pWin, XID id) REGION_UNINIT (pScreen, &cw->borderClip); - pWin->devPrivates[CompWindowPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL); xfree (cw); } else if (cw->update == CompositeRedirectAutomatic && @@ -297,7 +297,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) } csw->update = CompositeRedirectAutomatic; csw->clients = 0; - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = csw; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw); } /* * Redirect all existing windows @@ -312,7 +312,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) if (!csw->clients) { xfree (csw); - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0); } xfree (ccw); return ret; @@ -385,7 +385,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id) */ if (!csw->clients) { - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL); xfree (csw); } } diff --git a/composite/compext.c b/composite/compext.c index 944f8d844..8d2a2d790 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -50,7 +50,7 @@ #define SERVER_COMPOSITE_MINOR 4 static CARD8 CompositeReqCode; -static int CompositeClientPrivateIndex; +static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; static RESTYPE CompositeClientOverlayType; @@ -63,7 +63,8 @@ typedef struct _CompositeClient { int minor_version; } CompositeClientRec, *CompositeClientPtr; -#define GetCompositeClient(pClient) ((CompositeClientPtr) (pClient)->devPrivates[CompositeClientPrivateIndex].ptr) +#define GetCompositeClient(pClient) ((CompositeClientPtr) \ + dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey)) static void CompositeClientCallback (CallbackListPtr *list, @@ -712,9 +713,8 @@ CompositeExtensionInit (void) if (!CompositeClientOverlayType) return; - CompositeClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (CompositeClientPrivateIndex, - sizeof (CompositeClientRec))) + if (!dixRequestPrivate(CompositeClientPrivateKey, + sizeof(CompositeClientRec))) return; if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0)) return; diff --git a/composite/compinit.c b/composite/compinit.c index c557eebc4..757d92913 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -46,10 +46,9 @@ #include "compint.h" -int CompScreenPrivateIndex; -int CompWindowPrivateIndex; -int CompSubwindowsPrivateIndex; -static int CompGeneration; +DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKey; +DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKey; +DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKey; static Bool @@ -87,7 +86,7 @@ compCloseScreen (int index, ScreenPtr pScreen) cs->pOverlayWin = NULL; xfree (cs); - pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0; + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); return ret; @@ -375,25 +374,6 @@ compScreenInit (ScreenPtr pScreen) { CompScreenPtr cs; - if (CompGeneration != serverGeneration) - { - CompScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (CompScreenPrivateIndex == -1) - return FALSE; - CompWindowPrivateIndex = AllocateWindowPrivateIndex (); - if (CompWindowPrivateIndex == -1) - return FALSE; - CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex (); - if (CompSubwindowsPrivateIndex == -1) - return FALSE; - CompGeneration = serverGeneration; - } - if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0)) - return FALSE; - - if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0)) - return FALSE; - if (GetCompScreen (pScreen)) return TRUE; cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec)); @@ -461,7 +441,7 @@ compScreenInit (ScreenPtr pScreen) cs->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = compCloseScreen; - pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs; + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs); RegisterRealChildHeadProc(CompositeRealChildHead); diff --git a/composite/compint.h b/composite/compint.h index 38b1777a2..79699e4c1 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -64,6 +64,7 @@ #include "globals.h" #include "picturestr.h" #include "extnsionst.h" +#include "privates.h" #include "mi.h" #include "damage.h" #include "damageextint.h" @@ -159,13 +160,16 @@ typedef struct _CompScreen { } CompScreenRec, *CompScreenPtr; -extern int CompScreenPrivateIndex; -extern int CompWindowPrivateIndex; -extern int CompSubwindowsPrivateIndex; +extern DevPrivateKey CompScreenPrivateKey; +extern DevPrivateKey CompWindowPrivateKey; +extern DevPrivateKey CompSubwindowsPrivateKey; -#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr)) -#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr)) -#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr)) +#define GetCompScreen(s) ((CompScreenPtr) \ + dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey)) +#define GetCompWindow(w) ((CompWindowPtr) \ + dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey)) +#define GetCompSubwindows(w) ((CompSubwindowsPtr) \ + dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey)) extern RESTYPE CompositeClientWindowType; extern RESTYPE CompositeClientSubwindowsType; |