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.
13 */
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 void
49 InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
50 {
51 int i, j;
53 xnestOpenDisplay(argc, argv);
55 screenInfo->imageByteOrder = ImageByteOrder(xnestDisplay);
56 screenInfo->bitmapScanlineUnit = BitmapUnit(xnestDisplay);
57 screenInfo->bitmapScanlinePad = BitmapPad(xnestDisplay);
58 screenInfo->bitmapBitOrder = BitmapBitOrder(xnestDisplay);
60 screenInfo->numPixmapFormats = 0;
61 for (i = 0; i < xnestNumPixmapFormats; i++)
62 for (j = 0; j < xnestNumDepths; j++)
63 if ((xnestPixmapFormats[i].depth == 1) ||
64 (xnestPixmapFormats[i].depth == xnestDepths[j])) {
65 screenInfo->formats[screenInfo->numPixmapFormats].depth =
66 xnestPixmapFormats[i].depth;
67 screenInfo->formats[screenInfo->numPixmapFormats].bitsPerPixel =
68 xnestPixmapFormats[i].bits_per_pixel;
69 screenInfo->formats[screenInfo->numPixmapFormats].scanlinePad =
70 xnestPixmapFormats[i].scanline_pad;
71 screenInfo->numPixmapFormats++;
72 break;
73 }
75 xnestFontPrivateIndex = AllocateFontPrivateIndex();
77 if (!xnestNumScreens) xnestNumScreens = 1;
79 for (i = 0; i < xnestNumScreens; i++)
80 AddScreen(xnestOpenScreen, argc, argv);
82 xnestNumScreens = screenInfo->numScreens;
84 xnestDoFullGeneration = xnestFullGeneration;
85 }
87 void
88 InitInput(int argc, char *argv[])
89 {
90 int rc;
91 rc = AllocDevicePair(serverClient, "Xnest",
92 &xnestPointerDevice,
93 &xnestKeyboardDevice,
94 xnestPointerProc,
95 xnestKeyboardProc,
96 FALSE);
98 if (rc != Success)
99 FatalError("Failed to init Xnest default devices.\n");
101 mieqInit();
103 AddEnabledDevice(XConnectionNumber(xnestDisplay));
105 RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL);
106 }
108 void
109 CloseInput(void)
110 {
111 mieqFini();
112 }
114 /*
115 * DDX - specific abort routine. Called by AbortServer().
116 */
117 void SigAbortDDX(int signo, enum ExitCode error)
118 {
119 xnestDoFullGeneration = True;
120 xnestCloseDisplay();
121 }
123 void AbortDDX(enum ExitCode error)
124 {
125 SigAbortDDX(0, error);
126 }
128 /* Called by GiveUp(). */
129 void ddxGiveUp(enum ExitCode error)
130 {
131 AbortDDX(error);
132 }
134 #ifdef __APPLE__
135 void
136 DarwinHandleGUI(int argc, char *argv[])
137 {
138 }
139 #endif
141 void OsVendorInit(void)
142 {
143 return;
144 }
146 void OsVendorFatalError(void)
147 {
148 return;
149 }
151 #if defined(DDXBEFORERESET)
152 void ddxBeforeReset(void)
153 {
154 return;
155 }
156 #endif