diff options
Diffstat (limited to 'mi/miscrinit.c')
-rw-r--r-- | mi/miscrinit.c | 149 |
1 files changed, 114 insertions, 35 deletions
diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 1561c1844..ee199d24d 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.15 2001/12/14 20:00:26 dawes Exp $ */ #include "X.h" #include "servermd.h" @@ -33,9 +34,12 @@ from The Open Group. #include "mi.h" #include "scrnintstr.h" #include "pixmapstr.h" -#include "mibstore.h" #include "dix.h" #include "miline.h" +#ifdef MITSHM +#define _XSHM_SERVER_ +#include "XShm.h" +#endif /* We use this structure to propogate some information from miScreenInit to * miCreateScreenResources. miScreenInit allocates the structure, fills it @@ -67,25 +71,64 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, { if (!pPixmap) return FALSE; - pPixmap->drawable.depth = depth; - pPixmap->drawable.bitsPerPixel = bitsPerPixel; - pPixmap->drawable.id = 0; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pPixmap->drawable.x = 0; - pPixmap->drawable.y = 0; - pPixmap->drawable.width = width; - pPixmap->drawable.height = height; - pPixmap->devKind = devKind; - pPixmap->refcnt = 1; - pPixmap->devPrivate.ptr = pPixData; + + /* + * If all arguments are specified, reinitialize everything (including + * validated state). + */ + if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) && + (devKind > 0) && pPixData) { + pPixmap->drawable.depth = depth; + pPixmap->drawable.bitsPerPixel = bitsPerPixel; + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = width; + pPixmap->drawable.height = height; + pPixmap->devKind = devKind; + pPixmap->refcnt = 1; + pPixmap->devPrivate.ptr = pPixData; + } else { + /* + * Only modify specified fields, keeping all others intact. + */ + + if (width > 0) + pPixmap->drawable.width = width; + + if (height > 0) + pPixmap->drawable.height = height; + + if (depth > 0) + pPixmap->drawable.depth = depth; + + if (bitsPerPixel > 0) + pPixmap->drawable.bitsPerPixel = bitsPerPixel; + else if ((bitsPerPixel < 0) && (depth > 0)) + pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth); + + /* + * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for + * other purposes. + */ + if (devKind > 0) + pPixmap->devKind = devKind; + else if ((devKind < 0) && ((width > 0) || (depth > 0))) + pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width, + pPixmap->drawable.depth); + + if (pPixData) + pPixmap->devPrivate.ptr = pPixData; + } return TRUE; } /*ARGSUSED*/ Bool -miCloseScreen (index, pScreen) - int index; +miCloseScreen (iScreen, pScreen) + int iScreen; ScreenPtr pScreen; { return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate)); @@ -122,7 +165,8 @@ miCreateScreenResources(pScreen) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, - pScreen->height, pScreen->rootDepth, pScreen->rootDepth, + pScreen->height, pScreen->rootDepth, + BitsPerPixel(pScreen->rootDepth), PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), pScrInitParms->pbits)) return FALSE; @@ -158,16 +202,9 @@ miScreenDevPrivateInit(pScreen, width, pbits) return TRUE; } -/* - * If you pass in bsfuncs, then you must preinitialize the missing - * screen procs before calling miScreenInit, so that the backing store - * code can correctly wrap them. - */ - Bool miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - rootDepth, numDepths, depths, rootVisual, numVisuals, visuals, - bsfuncs) + rootDepth, numDepths, depths, rootVisual, numVisuals, visuals) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bits */ int xsize, ysize; /* in pixels */ @@ -179,7 +216,6 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, VisualID rootVisual; /* root visual */ int numVisuals; /* number of visuals supported */ VisualRec *visuals; /* supported visuals */ - miBSFuncPtr bsfuncs; /* backing store functions */ { pScreen->width = xsize; pScreen->height = ysize; @@ -192,11 +228,13 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, /* defColormap */ pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 1; - pScreen->backingStoreSupport = Always; + pScreen->backingStoreSupport = NotUseful; pScreen->saveUnderSupport = NotUseful; /* whitePixel, blackPixel */ pScreen->ModifyPixmapHeader = miModifyPixmapHeader; pScreen->CreateScreenResources = miCreateScreenResources; + pScreen->GetScreenPixmap = miGetScreenPixmap; + pScreen->SetScreenPixmap = miSetScreenPixmap; pScreen->numVisuals = numVisuals; pScreen->visuals = visuals; if (width) @@ -208,21 +246,23 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ - pScreen->PointerNonInterestBox = (void (*)()) 0; - pScreen->SourceValidate = (void (*)()) 0; + pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0; + pScreen->SourceValidate = (SourceValidateProcPtr) 0; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree; - pScreen->PostValidateTree = (void (*)()) 0; + pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; pScreen->WindowExposures = miWindowExposures; /* PaintWindowBackground, PaintWindowBorder, CopyWindow */ pScreen->ClearToBackground = miClearToBackground; - pScreen->ClipNotify = (void (*)()) 0; + pScreen->ClipNotify = (ClipNotifyProcPtr) 0; + pScreen->RestackWindow = (RestackWindowProcPtr) 0; /* CreatePixmap, DestroyPixmap */ /* RealizeFont, UnrealizeFont */ /* CreateGC */ /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */ /* ListInstalledColormaps, StoreColors, ResolveColor */ +#ifdef NEED_SCREEN_REGIONS pScreen->RegionCreate = miRegionCreate; pScreen->RegionInit = miRegionInit; pScreen->RegionCopy = miRegionCopy; @@ -237,19 +277,22 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, pScreen->RectIn = miRectIn; pScreen->PointInRegion = miPointInRegion; pScreen->RegionNotEmpty = miRegionNotEmpty; + pScreen->RegionBroken = miRegionBroken; + pScreen->RegionBreak = miRegionBreak; pScreen->RegionEmpty = miRegionEmpty; pScreen->RegionExtents = miRegionExtents; pScreen->RegionAppend = miRegionAppend; pScreen->RegionValidate = miRegionValidate; +#endif /* NEED_SCREEN_REGIONS */ /* BitmapToRegion */ +#ifdef NEED_SCREEN_REGIONS pScreen->RectsToRegion = miRectsToRegion; +#endif /* NEED_SCREEN_REGIONS */ pScreen->SendGraphicsExpose = miSendGraphicsExpose; - pScreen->BlockHandler = (void (*)())NoopDDA; - pScreen->WakeupHandler = (void (*)())NoopDDA; + pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA; + pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA; pScreen->blockData = (pointer)0; pScreen->wakeupData = (pointer)0; - if (bsfuncs) - miInitializeBackingStore (pScreen, bsfuncs); pScreen->MarkWindow = miMarkWindow; pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; pScreen->ChangeSaveUnder = miChangeSaveUnder; @@ -258,20 +301,41 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, pScreen->ResizeWindow = miSlideAndSizeWindow; pScreen->GetLayerWindow = miGetLayerWindow; pScreen->HandleExposures = miHandleValidateExposures; - pScreen->ReparentWindow = (void (*)())0; + pScreen->ReparentWindow = (ReparentWindowProcPtr) 0; pScreen->ChangeBorderWidth = miChangeBorderWidth; #ifdef SHAPE pScreen->SetShape = miSetShape; #endif pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; + pScreen->SaveDoomedAreas = 0; + pScreen->RestoreAreas = 0; + pScreen->ExposeCopy = 0; + pScreen->TranslateBackingStore = 0; + pScreen->ClearBackingStore = 0; + pScreen->DrawGuarantee = 0; + miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); return miScreenDevPrivateInit(pScreen, width, pbits); } +int +miAllocateGCPrivateIndex() +{ + static int privateIndex = -1; + static unsigned long miGeneration = 0; + + if (miGeneration != serverGeneration) + { + privateIndex = AllocateGCPrivateIndex(); + miGeneration = serverGeneration; + } + return privateIndex; +} + int miZeroLineScreenIndex; -int miZeroLineGeneration; +unsigned int miZeroLineGeneration = 0; void miSetZeroLineBias(pScreen, bias) @@ -286,3 +350,18 @@ miSetZeroLineBias(pScreen, bias) if (miZeroLineScreenIndex >= 0) pScreen->devPrivates[miZeroLineScreenIndex].uval = bias; } + +PixmapPtr +miGetScreenPixmap(pScreen) + ScreenPtr pScreen; +{ + return (PixmapPtr)(pScreen->devPrivate); +} + +void +miSetScreenPixmap(pPix) + PixmapPtr pPix; +{ + if (pPix) + pPix->drawable.pScreen->devPrivate = (pointer)pPix; +} |