First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xnest / Init.c
blob5bf0300c66b54542d7ff802c154c3da7e8eff415
1 /*
3 Copyright 1993 by Davor Matic
5 Permission to use, copy, modify, distribute, and sell this software
6 and its documentation for any purpose is hereby granted without fee,
7 provided that the above copyright notice appear in all copies and that
8 both that copyright notice and this permission notice appear in
9 supporting documentation. Davor Matic makes no representations about
10 the suitability of this software for any purpose. It is provided "as
11 is" without express or implied warranty.
15 #ifdef HAVE_XNEST_CONFIG_H
16 #include <xnest-config.h>
17 #endif
19 #include <X11/X.h>
20 #include <X11/Xproto.h>
21 #include "screenint.h"
22 #include "input.h"
23 #include "misc.h"
24 #include "scrnintstr.h"
25 #include "windowstr.h"
26 #include "servermd.h"
27 #include "mi.h"
28 #include <X11/fonts/fontstruct.h>
30 #include "Xnest.h"
32 #include "Display.h"
33 #include "Screen.h"
34 #include "Pointer.h"
35 #include "Keyboard.h"
36 #include "Handlers.h"
37 #include "Init.h"
38 #include "Args.h"
39 #include "Drawable.h"
40 #include "XNGC.h"
41 #include "XNFont.h"
42 #ifdef DPMSExtension
43 #include "dpmsproc.h"
44 #endif
46 Bool xnestDoFullGeneration = True;
48 xEvent *xnestEvents = NULL;
50 void
51 InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
53 int i, j;
55 xnestOpenDisplay(argc, argv);
57 screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
58 screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
59 screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
60 screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
62 screenInfo->numPixmapFormats = 0;
63 for (i = 0; i < xnestNumPixmapFormats; i++)
64 for (j = 0; j < xnestNumDepths; j++)
65 if ((xnestPixmapFormats[i].depth == 1) ||
66 (xnestPixmapFormats[i].depth == xnestDepths[j])) {
67 screenInfo->formats[screenInfo->numPixmapFormats].depth =
68 xnestPixmapFormats[i].depth;
69 screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
70 xnestPixmapFormats[i].bits_per_pixel;
71 screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
72 xnestPixmapFormats[i].scanline_pad;
73 screenInfo->numPixmapFormats++;
74 break;
77 xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
78 xnestGCPrivateIndex = AllocateGCPrivateIndex();
79 xnestFontPrivateIndex = AllocateFontPrivateIndex();
81 if (!xnestNumScreens) xnestNumScreens = 1;
83 for (i = 0; i < xnestNumScreens; i++)
84 AddScreen(xnestOpenScreen, argc, argv);
86 xnestNumScreens = screenInfo->numScreens;
88 xnestDoFullGeneration = xnestFullGeneration;
91 void
92 InitInput(int argc, char *argv[])
94 xnestPointerDevice = AddInputDevice(xnestPointerProc, TRUE);
95 xnestKeyboardDevice = AddInputDevice(xnestKeyboardProc, TRUE);
97 if (!xnestEvents)
98 xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
99 if (!xnestEvents)
100 FatalError("couldn't allocate room for events\n");
102 RegisterPointerDevice(xnestPointerDevice);
103 RegisterKeyboardDevice(xnestKeyboardDevice);
105 mieqInit();
107 AddEnabledDevice(XConnectionNumber(xnestDisplay));
109 RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
113 * DDX - specific abort routine. Called by AbortServer().
115 void AbortDDX()
117 xnestDoFullGeneration = True;
118 xnestCloseDisplay();
121 /* Called by GiveUp(). */
122 void ddxGiveUp()
124 AbortDDX();
127 #ifdef __DARWIN__
128 void
129 DarwinHandleGUI(int argc, char *argv[])
133 void GlxExtensionInit();
134 void GlxWrapInitVisuals(void *procPtr);
136 void
137 DarwinGlxExtensionInit()
139 GlxExtensionInit();
142 void
143 DarwinGlxWrapInitVisuals(
144 void *procPtr)
146 GlxWrapInitVisuals(procPtr);
148 #endif
150 void OsVendorInit()
152 return;
155 void OsVendorFatalError()
157 return;
160 void ddxBeforeReset(void)
162 return;
165 /* this is just to get the server to link on AIX */
166 #ifdef AIXV3
167 int SelectWaitTime = 10000; /* usec */
168 #endif