summaryrefslogtreecommitdiff
path: root/mfb
diff options
context:
space:
mode:
Diffstat (limited to 'mfb')
-rw-r--r--mfb/mfb.h14
-rw-r--r--mfb/mfbbitblt.c18
-rw-r--r--mfb/mfbfillarc.c3
-rw-r--r--mfb/mfbfillrct.c3
-rw-r--r--mfb/mfbfillsp.c9
-rw-r--r--mfb/mfbgc.c10
-rw-r--r--mfb/mfbimggblt.c3
-rw-r--r--mfb/mfbline.c6
-rw-r--r--mfb/mfbpixmap.c2
-rw-r--r--mfb/mfbpntwin.c5
-rw-r--r--mfb/mfbpolypnt.c3
-rw-r--r--mfb/mfbscrinit.c38
-rw-r--r--mfb/mfbwindow.c14
-rw-r--r--mfb/mfbzerarc.c3
14 files changed, 65 insertions, 66 deletions
diff --git a/mfb/mfb.h b/mfb/mfb.h
index 001f43e53..42f3002f2 100644
--- a/mfb/mfb.h
+++ b/mfb/mfb.h
@@ -705,8 +705,8 @@ extern Bool mfbCloseScreen(
extern Bool mfbAllocatePrivates(
ScreenPtr /*pScreen*/,
- int * /*pWinIndex*/,
- int * /*pGCIndex*/
+ DevPrivateKey *pWinKey,
+ DevPrivateKey *pGCIndex
);
extern Bool mfbScreenInit(
@@ -891,14 +891,10 @@ typedef struct {
typedef mfbPrivGC *mfbPrivGCPtr;
#endif
-/* XXX these should be static, but it breaks the ABI */
-extern int mfbGCPrivateIndex; /* index into GC private array */
-extern int mfbGetGCPrivateIndex(void);
-extern int mfbWindowPrivateIndex; /* index into Window private array */
-extern int mfbGetWindowPrivateIndex(void);
+extern DevPrivateKey mfbGetGCPrivateKey(void);
+extern DevPrivateKey mfbGetWindowPrivateKey(void);
#ifdef PIXMAP_PER_WINDOW
-extern int frameWindowPrivateIndex; /* index into Window private array */
-extern int frameGetWindowPrivateIndex(void);
+extern DevPrivateKey frameGetWindowPrivateKey(void);
#endif
#ifndef MFB_PROTOTYPES_ONLY
diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c
index 270fd96a7..3efee45b1 100644
--- a/mfb/mfbbitblt.c
+++ b/mfb/mfbbitblt.c
@@ -397,8 +397,7 @@ int dstx, dsty;
* must register a function for n-to-1 copy operations
*/
-static unsigned long copyPlaneGeneration;
-static int copyPlaneScreenIndex = -1;
+static DevPrivateKey copyPlaneScreenKey = &copyPlaneScreenKey;
typedef RegionPtr (*CopyPlaneFuncPtr)(
DrawablePtr /* pSrcDrawable */,
@@ -417,14 +416,7 @@ mfbRegisterCopyPlaneProc (pScreen, proc)
ScreenPtr pScreen;
CopyPlaneFuncPtr proc;
{
- if (copyPlaneGeneration != serverGeneration)
- {
- copyPlaneScreenIndex = AllocateScreenPrivateIndex();
- if (copyPlaneScreenIndex < 0)
- return FALSE;
- copyPlaneGeneration = serverGeneration;
- }
- pScreen->devPrivates[copyPlaneScreenIndex].fptr = (CopyPlaneFuncPtr)proc;
+ dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc);
return TRUE;
}
@@ -469,9 +461,9 @@ unsigned long plane;
if (pSrcDrawable->depth != 1)
{
- if (copyPlaneScreenIndex >= 0 &&
- (copyPlane = (CopyPlaneFuncPtr)
- pSrcDrawable->pScreen->devPrivates[copyPlaneScreenIndex].fptr)
+ if ((copyPlane = (CopyPlaneFuncPtr)
+ dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates,
+ copyPlaneScreenKey))
)
{
return (*copyPlane) (pSrcDrawable, pDstDrawable,
diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c
index 30ec00dc3..cbf47a0eb 100644
--- a/mfb/mfbfillarc.c
+++ b/mfb/mfbfillarc.c
@@ -289,7 +289,8 @@ mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs)
RegionPtr cclip;
int rop;
- priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
rop = priv->rop;
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
return;
diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c
index f9209d096..506776b3f 100644
--- a/mfb/mfbfillrct.c
+++ b/mfb/mfbfillrct.c
@@ -96,7 +96,8 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
if (!(pGC->planemask & 1))
return;
- priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
alu = priv->ropFillArea;
pfn = priv->FillArea;
ppix = pGC->pRotatedPixmap;
diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c
index 112f5327c..e9be737da 100644
--- a/mfb/mfbfillsp.c
+++ b/mfb/mfbfillsp.c
@@ -624,7 +624,8 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
if (pGC->fillStyle == FillTiled)
rop = pGC->alu;
else
- rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip;
+ rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->ropOpStip;
flip = 0;
switch(rop)
@@ -769,7 +770,8 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
{
pTile = pGC->stipple;
tlwidth = pTile->devKind / PGSZB;
- rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip;
+ rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->ropOpStip;
}
xSrc = pDrawable->x;
@@ -926,7 +928,8 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
ppt, pwidth, fSorted);
pTile = pGC->stipple;
- rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
+ rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop;
tlwidth = pTile->devKind / PGSZB;
xSrc = pDrawable->x;
ySrc = pDrawable->y;
diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c
index c60e97676..7492d7c04 100644
--- a/mfb/mfbgc.c
+++ b/mfb/mfbgc.c
@@ -381,7 +381,8 @@ matchCommon (
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)
return 0;
- priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
for (i = 0; i < numberCommonOps; i++) {
cop = &mfbCommonOps[i];
if ((pGC->fgPixel & 1) != cop->fg)
@@ -420,7 +421,8 @@ mfbCreateGC(pGC)
/* mfb wants to translate before scan convesion */
pGC->miTranslate = 1;
- pPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr);
+ pPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel);
pGC->fExpose = TRUE;
pGC->pRotatedPixmap = NullPixmap;
@@ -508,8 +510,8 @@ mfbValidateGC(pGC, changes, pDrawable)
new_rotate = (oldOrg.x != pGC->lastWinOrg.x) ||
(oldOrg.y != pGC->lastWinOrg.y);
- devPriv = ((mfbPrivGCPtr) (pGC->devPrivates[mfbGCPrivateIndex].ptr));
-
+ devPriv = (mfbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
/*
if the client clip is different or moved OR
the subwindowMode has changed OR
diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c
index e5c186b89..2778b625c 100644
--- a/mfb/mfbimggblt.c
+++ b/mfb/mfbimggblt.c
@@ -184,7 +184,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
but that is usually not a cheap thing to do.
*/
- pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
oldFillArea = pPrivGC->FillArea;
if (pGC->bgPixel & 1)
diff --git a/mfb/mfbline.c b/mfb/mfbline.c
index 863a6187b..65baa5efd 100644
--- a/mfb/mfbline.c
+++ b/mfb/mfbline.c
@@ -146,7 +146,8 @@ mfbLineSS (pDrawable, pGC, mode, npt, pptInit)
return;
cclip = pGC->pCompositeClip;
- alu = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
+ alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
@@ -525,7 +526,8 @@ mfbLineSD( pDrawable, pGC, mode, npt, pptInit)
return;
cclip = pGC->pCompositeClip;
- fgrop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop;
+ fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c
index b13e3af0f..1f3f011fb 100644
--- a/mfb/mfbpixmap.c
+++ b/mfb/mfbpixmap.c
@@ -113,7 +113,7 @@ mfbDestroyPixmap(pPixmap)
{
if(--pPixmap->refcnt)
return TRUE;
- dixFreePrivates(*DEVPRIV_PTR(pPixmap));
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
diff --git a/mfb/mfbpntwin.c b/mfb/mfbpntwin.c
index b18797a40..725d6beb8 100644
--- a/mfb/mfbpntwin.c
+++ b/mfb/mfbpntwin.c
@@ -56,6 +56,7 @@ SOFTWARE.
#include "regionstr.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
+#include "privates.h"
#include "mfb.h"
#include "maskbits.h"
@@ -69,8 +70,8 @@ mfbPaintWindow(pWin, pRegion, what)
{
register mfbPrivWin *pPrivWin;
- pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
-
+ pPrivWin = (mfbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
+ mfbGetWindowPrivateKey());
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c
index 1c4045126..146cfdce0 100644
--- a/mfb/mfbpolypnt.c
+++ b/mfb/mfbpolypnt.c
@@ -88,7 +88,8 @@ mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
if (!(pGC->planemask & 1))
return;
- pGCPriv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr;
+ pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
rop = pGCPriv->rop;
mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c
index 13ea5d365..515e9e3ce 100644
--- a/mfb/mfbscrinit.c
+++ b/mfb/mfbscrinit.c
@@ -68,13 +68,13 @@ SOFTWARE.
#include "servermd.h"
#ifdef PIXMAP_PER_WINDOW
-int frameWindowPrivateIndex;
-int frameGetWindowPrivateIndex(void) { return frameWindowPrivateIndex; }
+static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey;
+DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; }
#endif
-int mfbWindowPrivateIndex;
-int mfbGetWindowPrivateIndex(void) { return mfbWindowPrivateIndex; }
-int mfbGCPrivateIndex;
-int mfbGetGCPrivateIndex(void) { return mfbGCPrivateIndex; }
+static DevPrivateKey mfbWindowPrivateKey = &mfbWindowPrivateKey;
+DevPrivateKey mfbGetWindowPrivateKey(void) { return mfbWindowPrivateKey; }
+static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey;
+DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; }
static unsigned long mfbGeneration = 0;
static VisualRec visual = {
@@ -90,30 +90,23 @@ static DepthRec depth = {
};
Bool
-mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
- ScreenPtr pScreen;
- int *pWinIndex, *pGCIndex;
+mfbAllocatePrivates(ScreenPtr pScreen,
+ DevPrivateKey *pWinIndex, DevPrivateKey *pGCIndex)
{
if (mfbGeneration != serverGeneration)
{
-#ifdef PIXMAP_PER_WINDOW
- frameWindowPrivateIndex = AllocateWindowPrivateIndex();
-#endif
- mfbWindowPrivateIndex = AllocateWindowPrivateIndex();
- mfbGCPrivateIndex = miAllocateGCPrivateIndex();
visual.vid = FakeClientID(0);
VID = visual.vid;
mfbGeneration = serverGeneration;
}
if (pWinIndex)
- *pWinIndex = mfbWindowPrivateIndex;
+ *pWinIndex = mfbWindowPrivateKey;
if (pGCIndex)
- *pGCIndex = mfbGCPrivateIndex;
+ *pGCIndex = mfbGCPrivateKey;
pScreen->GetWindowPixmap = mfbGetWindowPixmap;
pScreen->SetWindowPixmap = mfbSetWindowPixmap;
- return (AllocateWindowPrivate(pScreen, mfbWindowPrivateIndex,
- sizeof(mfbPrivWin)) &&
- AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)));
+ return (dixRequestPrivate(mfbWindowPrivateKey, sizeof(mfbPrivWin)) &&
+ dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC)));
}
@@ -126,7 +119,7 @@ mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
int dpix, dpiy; /* dots per inch */
int width; /* pixel width of frame buffer */
{
- if (!mfbAllocatePrivates(pScreen, (int *)NULL, (int *)NULL))
+ if (!mfbAllocatePrivates(pScreen, NULL, NULL))
return FALSE;
pScreen->defColormap = (Colormap) FakeClientID(0);
/* whitePixel, blackPixel */
@@ -167,7 +160,8 @@ mfbGetWindowPixmap(pWin)
WindowPtr pWin;
{
#ifdef PIXMAP_PER_WINDOW
- return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
+ return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates,
+ frameWindowPrivateKey);
#else
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -181,7 +175,7 @@ mfbSetWindowPixmap(pWin, pPix)
PixmapPtr pPix;
{
#ifdef PIXMAP_PER_WINDOW
- pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
+ dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix);
#else
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
#endif
diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c
index b138d5805..c522b07a3 100644
--- a/mfb/mfbwindow.c
+++ b/mfb/mfbwindow.c
@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/X.h>
#include "scrnintstr.h"
#include "windowstr.h"
+#include "privates.h"
#include "mfb.h"
#include "mistruct.h"
#include "regionstr.h"
@@ -66,7 +67,8 @@ mfbCreateWindow(pWin)
{
register mfbPrivWin *pPrivWin;
- pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
+ pPrivWin = (mfbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
+ mfbGetWindowPrivateKey());
pPrivWin->pRotatedBorder = NullPixmap;
pPrivWin->pRotatedBackground = NullPixmap;
pPrivWin->fastBackground = FALSE;
@@ -83,8 +85,8 @@ mfbDestroyWindow(pWin)
{
register mfbPrivWin *pPrivWin;
- pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
-
+ pPrivWin = (mfbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
+ mfbGetWindowPrivateKey());
if (pPrivWin->pRotatedBorder)
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
if (pPrivWin->pRotatedBackground)
@@ -116,7 +118,8 @@ mfbPositionWindow(pWin, x, y)
register mfbPrivWin *pPrivWin;
int reset = 0;
- pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
+ pPrivWin = (mfbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
+ mfbGetWindowPrivateKey());
if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground)
{
mfbXRotatePixmap(pPrivWin->pRotatedBackground,
@@ -227,7 +230,8 @@ mfbChangeWindowAttributes(pWin, mask)
register mfbPrivWin *pPrivWin;
WindowPtr pBgWin;
- pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
+ pPrivWin = (mfbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
+ mfbGetWindowPrivateKey());
/*
* When background state changes from ParentRelative and
* we had previously rotated the fast border pixmap to match
diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c
index 964e2f100..624e45fee 100644
--- a/mfb/mfbzerarc.c
+++ b/mfb/mfbzerarc.c
@@ -92,7 +92,8 @@ mfbZeroArcSS(
PixelType pmask;
register PixelType *paddr;
- if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop ==
+ if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop ==
RROP_BLACK)
pixel = 0;
else