|
|
1.1 ! root 1: /*********************************************************** ! 2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, ! 3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts. ! 4: ! 5: All Rights Reserved ! 6: ! 7: Permission to use, copy, modify, and distribute this software and its ! 8: documentation for any purpose and without fee is hereby granted, ! 9: provided that the above copyright notice appear in all copies and that ! 10: both that copyright notice and this permission notice appear in ! 11: supporting documentation, and that the names of Digital or MIT not be ! 12: used in advertising or publicity pertaining to distribution of the ! 13: software without specific, written prior permission. ! 14: ! 15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ! 16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ! 17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ! 18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, ! 19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ! 20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ! 21: SOFTWARE. ! 22: ! 23: ******************************************************************/ ! 24: /* $Header: mfbscrinit.c,v 1.52 87/09/07 19:08:52 toddb Exp $ */ ! 25: ! 26: #include "X.h" ! 27: #include "Xproto.h" /* for xColorItem */ ! 28: #include "Xmd.h" ! 29: #include "scrnintstr.h" ! 30: #include "pixmapstr.h" ! 31: #include "resource.h" ! 32: #include "colormap.h" ! 33: #include "mfb.h" ! 34: #include "mistruct.h" ! 35: #include "dix.h" ! 36: ! 37: #include "servermd.h" ! 38: ! 39: static void ! 40: mfbFreeVisual(p, id) ! 41: pointer p; ! 42: int id; ! 43: { ! 44: Xfree(p); ! 45: } ! 46: ! 47: /* dts * (inch/dot) * (25.4 mm / inch) = mm */ ! 48: Bool ! 49: mfbScreenInit(index, pScreen, pbits, xsize, ysize, dpix, dpiy) ! 50: int index; ! 51: register ScreenPtr pScreen; ! 52: pointer pbits; /* pointer to screen bitmap */ ! 53: int xsize, ysize; /* in pixels */ ! 54: int dpix, dpiy; /* dots per inch */ ! 55: { ! 56: DepthPtr pDepth; ! 57: VisualPtr pVisual; ! 58: long *pVids; ! 59: register PixmapPtr pPixmap; ! 60: ! 61: pScreen->myNum = index; ! 62: pScreen->width = xsize; ! 63: pScreen->height = ysize; ! 64: pScreen->mmWidth = (xsize * 254) / (dpix * 10); ! 65: pScreen->mmHeight = (ysize * 254) / (dpiy * 10); ! 66: pScreen->numDepths = 1; ! 67: pScreen->allowedDepths = pDepth = (DepthPtr) Xalloc(sizeof(DepthRec)); ! 68: ! 69: pScreen->rootDepth = 1; ! 70: pScreen->rootVisual = FakeClientID(0); ! 71: pScreen->defColormap = (Colormap) FakeClientID(0); ! 72: pScreen->minInstalledCmaps = 1; ! 73: pScreen->maxInstalledCmaps = 1; ! 74: pScreen->whitePixel = 1; ! 75: pScreen->blackPixel = 0; ! 76: pScreen->backingStoreSupport = NotUseful; ! 77: pScreen->saveUnderSupport = NotUseful; ! 78: ! 79: /* cursmin and cursmax are device specific */ ! 80: ! 81: pScreen->numVisuals = 1; ! 82: pScreen->visuals = pVisual = (VisualPtr) Xalloc(sizeof (VisualRec)); ! 83: ! 84: pPixmap = (PixmapPtr )Xalloc(sizeof(PixmapRec)); ! 85: pPixmap->drawable.type = DRAWABLE_PIXMAP; ! 86: pPixmap->drawable.depth = 1; ! 87: pPixmap->drawable.pScreen = pScreen; ! 88: pPixmap->drawable.serialNumber = 0; ! 89: pPixmap->width = xsize; ! 90: pPixmap->height = ysize; ! 91: pPixmap->refcnt = 1; ! 92: pPixmap->devPrivate = pbits; ! 93: pPixmap->devKind = PixmapBytePad(xsize, 1); ! 94: pScreen->devPrivate = (pointer)pPixmap; ! 95: ! 96: /* anything that mfb doesn't know about is assumed to be done ! 97: elsewhere. (we put in no-op only for things that we KNOW ! 98: are really no-op. ! 99: */ ! 100: pScreen->CreateWindow = mfbCreateWindow; ! 101: pScreen->DestroyWindow = mfbDestroyWindow; ! 102: pScreen->PositionWindow = mfbPositionWindow; ! 103: pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes; ! 104: pScreen->RealizeWindow = mfbMapWindow; ! 105: pScreen->UnrealizeWindow = mfbUnmapWindow; ! 106: ! 107: pScreen->RealizeFont = mfbRealizeFont; ! 108: pScreen->UnrealizeFont = mfbUnrealizeFont; ! 109: pScreen->GetImage = mfbGetImage; ! 110: pScreen->GetSpans = mfbGetSpans; ! 111: pScreen->CreateGC = mfbCreateGC; ! 112: pScreen->CreatePixmap = mfbCreatePixmap; ! 113: pScreen->DestroyPixmap = mfbDestroyPixmap; ! 114: pScreen->ValidateTree = miValidateTree; ! 115: ! 116: pScreen->InstallColormap = mfbInstallColormap; ! 117: pScreen->UninstallColormap = mfbUninstallColormap; ! 118: pScreen->ListInstalledColormaps = mfbListInstalledColormaps; ! 119: pScreen->StoreColors = NoopDDA; ! 120: ! 121: pScreen->RegionCreate = miRegionCreate; ! 122: pScreen->RegionCopy = miRegionCopy; ! 123: pScreen->RegionDestroy = miRegionDestroy; ! 124: pScreen->Intersect = miIntersect; ! 125: pScreen->Inverse = miInverse; ! 126: pScreen->Union = miUnion; ! 127: pScreen->Subtract = miSubtract; ! 128: pScreen->RegionReset = miRegionReset; ! 129: pScreen->TranslateRegion = miTranslateRegion; ! 130: pScreen->RectIn = miRectIn; ! 131: pScreen->PointInRegion = miPointInRegion; ! 132: pScreen->WindowExposures = miWindowExposures; ! 133: pScreen->RegionNotEmpty = miRegionNotEmpty; ! 134: pScreen->RegionEmpty = miRegionEmpty; ! 135: pScreen->RegionExtents = miRegionExtents; ! 136: ! 137: pScreen->BlockHandler = NoopDDA; ! 138: pScreen->WakeupHandler = NoopDDA; ! 139: pScreen->blockData = (pointer)0; ! 140: pScreen->wakeupData = (pointer)0; ! 141: ! 142: pVisual->vid = pScreen->rootVisual; ! 143: pVisual->screen = index; ! 144: pVisual->class = StaticGray; ! 145: pVisual->redMask = 0; ! 146: pVisual->greenMask = 0; ! 147: pVisual->blueMask = 0; ! 148: pVisual->bitsPerRGBValue = 1; ! 149: pVisual->ColormapEntries = 2; ! 150: ! 151: pDepth->depth = 1; ! 152: pDepth->numVids = 1; ! 153: pDepth->vids = pVids = (long *) Xalloc(sizeof (long)); ! 154: pVids[0] = pScreen->rootVisual; /* our one and only visual */ ! 155: AddResource( ! 156: pScreen->rootVisual, RT_VISUALID, pVisual, mfbFreeVisual, RC_CORE); ! 157: ! 158: /* we MIGHT return 0 if we had been keeping track of potential ! 159: allocation failures. one day someone will clean this up. ! 160: */ ! 161: return 1; ! 162: } ! 163:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.