]> git.sesse.net Git - rdpsrv/blob - Xserver/programs/Xserver/mfb/mfbscrinit.c
Support RDP5 logon packets.
[rdpsrv] / Xserver / programs / Xserver / mfb / mfbscrinit.c
1 /***********************************************************
2
3 Copyright (c) 1987  X Consortium
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
25
26
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28
29                         All Rights Reserved
30
31 Permission to use, copy, modify, and distribute this software and its 
32 documentation for any purpose and without fee is hereby granted, 
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in 
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.  
38
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 SOFTWARE.
46
47 ******************************************************************/
48 /* $XConsortium: mfbscrinit.c,v 5.17 94/04/17 20:28:34 dpw Exp $ */
49 /* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.0 1994/06/18 16:29:52 dawes Exp $ */
50
51 #include "X.h"
52 #include "Xproto.h"     /* for xColorItem */
53 #include "Xmd.h"
54 #include "scrnintstr.h"
55 #include "pixmapstr.h"
56 #include "resource.h"
57 #include "colormap.h"
58 #include "mfb.h"
59 #include "mistruct.h"
60 #include "dix.h"
61 #include "mi.h"
62 #include "mibstore.h"
63 #include "migc.h"
64 #include "servermd.h"
65
66 #ifdef PIXMAP_PER_WINDOW
67 int frameWindowPrivateIndex;
68 #endif
69 int mfbWindowPrivateIndex;
70 int mfbGCPrivateIndex;
71 static unsigned long mfbGeneration = 0;
72
73 static VisualRec visual = {
74 /* vid  class       bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
75    0,   StaticGray, 1,    2,   1,    0,    0,    0,    0,   0,     0
76 };
77
78 static VisualID VID;
79
80 static DepthRec depth = {
81 /* depth        numVid          vids */
82     1,          1,              &VID
83 };
84
85 miBSFuncRec mfbBSFuncRec = {
86     mfbSaveAreas,
87     mfbRestoreAreas,
88     (void (*)()) 0,
89     (PixmapPtr (*)()) 0,
90     (PixmapPtr (*)()) 0,
91 };
92
93 Bool
94 mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex)
95     ScreenPtr pScreen;
96     int *pWinIndex, *pGCIndex;
97 {
98     if (mfbGeneration != serverGeneration)
99     {
100 #ifdef PIXMAP_PER_WINDOW
101         frameWindowPrivateIndex = AllocateWindowPrivateIndex();
102 #endif
103         mfbWindowPrivateIndex = AllocateWindowPrivateIndex();
104         mfbGCPrivateIndex = miAllocateGCPrivateIndex();
105         miRegisterGCPrivateIndex(mfbGCPrivateIndex);
106         visual.vid = FakeClientID(0);
107         VID = visual.vid;
108         mfbGeneration = serverGeneration;
109     }
110     if (pWinIndex)
111         *pWinIndex = mfbWindowPrivateIndex;
112     if (pGCIndex)
113         *pGCIndex = mfbGCPrivateIndex;
114     return (AllocateWindowPrivate(pScreen, mfbWindowPrivateIndex,
115                                   sizeof(mfbPrivWin)) &&
116             AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)));
117 }
118
119 /* dts * (inch/dot) * (25.4 mm / inch) = mm */
120 Bool
121 mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
122     register ScreenPtr pScreen;
123     pointer pbits;              /* pointer to screen bitmap */
124     int xsize, ysize;           /* in pixels */
125     int dpix, dpiy;             /* dots per inch */
126     int width;                  /* pixel width of frame buffer */
127 {
128     if  (!mfbAllocatePrivates(pScreen, (int *)NULL, (int *)NULL))
129         return FALSE;
130     pScreen->defColormap = (Colormap) FakeClientID(0);
131     /* whitePixel, blackPixel */
132     pScreen->QueryBestSize = mfbQueryBestSize;
133     /* SaveScreen */
134     pScreen->GetImage = mfbGetImage;
135     pScreen->GetSpans = mfbGetSpans;
136     pScreen->CreateWindow = mfbCreateWindow;
137     pScreen->DestroyWindow = mfbDestroyWindow;
138     pScreen->PositionWindow = mfbPositionWindow;
139     pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
140     pScreen->RealizeWindow = mfbMapWindow;
141     pScreen->UnrealizeWindow = mfbUnmapWindow;
142     pScreen->PaintWindowBackground = mfbPaintWindow;
143     pScreen->PaintWindowBorder = mfbPaintWindow;
144     pScreen->CopyWindow = mfbCopyWindow;
145     pScreen->CreatePixmap = mfbCreatePixmap;
146     pScreen->DestroyPixmap = mfbDestroyPixmap;
147     pScreen->RealizeFont = mfbRealizeFont;
148     pScreen->UnrealizeFont = mfbUnrealizeFont;
149     pScreen->CreateGC = mfbCreateGC;
150     pScreen->CreateColormap = mfbCreateColormap;
151     pScreen->DestroyColormap = mfbDestroyColormap;
152     pScreen->InstallColormap = mfbInstallColormap;
153     pScreen->UninstallColormap = mfbUninstallColormap;
154     pScreen->ListInstalledColormaps = mfbListInstalledColormaps;
155     pScreen->StoreColors = (void (*)())NoopDDA;
156     pScreen->ResolveColor = mfbResolveColor;
157     pScreen->BitmapToRegion = mfbPixmapToRegion;
158     return miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
159                         1, 1, &depth, VID, 1, &visual, &mfbBSFuncRec);
160 }