summaryrefslogtreecommitdiff
path: root/xserver/mfb/mfbscrinit.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/mfb/mfbscrinit.c
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/mfb/mfbscrinit.c')
-rw-r--r--xserver/mfb/mfbscrinit.c52
1 files changed, 12 insertions, 40 deletions
diff --git a/xserver/mfb/mfbscrinit.c b/xserver/mfb/mfbscrinit.c
index 0707c1a74..20ac16037 100644
--- a/xserver/mfb/mfbscrinit.c
+++ b/xserver/mfb/mfbscrinit.c
@@ -68,13 +68,11 @@ 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 mfbGCPrivateKey = &mfbGCPrivateKey;
+DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; }
static unsigned long mfbGeneration = 0;
static VisualRec visual = {
@@ -89,41 +87,20 @@ static DepthRec depth = {
1, 1, &VID
};
-
-BSFuncRec mfbBSFuncRec = {
- mfbSaveAreas,
- mfbRestoreAreas,
- (BackingStoreSetClipmaskRgnProcPtr) 0,
- (BackingStoreGetImagePixmapProcPtr) 0,
- (BackingStoreGetSpansPixmapProcPtr) 0,
-};
-
-
Bool
-mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
- ScreenPtr pScreen;
- int *pWinIndex, *pGCIndex;
+mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
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;
- if (pGCIndex)
- *pGCIndex = mfbGCPrivateIndex;
+ if (pGCKey)
+ *pGCKey = mfbGCPrivateKey;
pScreen->GetWindowPixmap = mfbGetWindowPixmap;
pScreen->SetWindowPixmap = mfbSetWindowPixmap;
- return (AllocateWindowPrivate(pScreen, mfbWindowPrivateIndex,
- sizeof(mfbPrivWin)) &&
- AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)));
+ return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC));
}
@@ -136,7 +113,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))
return FALSE;
pScreen->defColormap = (Colormap) FakeClientID(0);
/* whitePixel, blackPixel */
@@ -145,13 +122,9 @@ mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
pScreen->GetImage = mfbGetImage;
pScreen->GetSpans = mfbGetSpans;
pScreen->CreateWindow = mfbCreateWindow;
- pScreen->DestroyWindow = mfbDestroyWindow;
pScreen->PositionWindow = mfbPositionWindow;
- pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
pScreen->RealizeWindow = mfbMapWindow;
pScreen->UnrealizeWindow = mfbUnmapWindow;
- pScreen->PaintWindowBackground = mfbPaintWindow;
- pScreen->PaintWindowBorder = mfbPaintWindow;
pScreen->CopyWindow = mfbCopyWindow;
pScreen->CreatePixmap = mfbCreatePixmap;
pScreen->DestroyPixmap = mfbDestroyPixmap;
@@ -169,7 +142,6 @@ mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
1, 1, &depth, VID, 1, &visual))
return FALSE;
- pScreen->BackingStoreFuncs = mfbBSFuncRec;
return TRUE;
}
@@ -178,7 +150,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;
@@ -192,7 +165,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
@@ -200,7 +173,6 @@ mfbSetWindowPixmap(pWin, pPix)
void mfbFillInScreen(ScreenPtr pScreen)
{
- pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
pScreen->RealizeWindow = mfbMapWindow;
pScreen->UnrealizeWindow = mfbUnmapWindow;
pScreen->DestroyPixmap = mfbDestroyPixmap;