Init.c (3818B)
1 /* 2 3 Copyright 1993 by Davor Matic 4 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. 12 13 */ 14 15 #ifdef HAVE_XNEST_CONFIG_H 16 #include <xnest-config.h> 17 #endif 18 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> 29 #include "dixfontstr.h" 30 31 #include "Xnest.h" 32 33 #include "Display.h" 34 #include "Screen.h" 35 #include "Pointer.h" 36 #include "Keyboard.h" 37 #include "Handlers.h" 38 #include "Events.h" 39 #include "Init.h" 40 #include "Args.h" 41 #include "Drawable.h" 42 #include "XNGC.h" 43 #include "XNFont.h" 44 #ifdef DPMSExtension 45 #include "dpmsproc.h" 46 #endif 47 48 Bool xnestDoFullGeneration = True; 49 50 #ifdef GLXEXT 51 void 52 GlxExtensionInit(void) 53 { 54 } 55 #endif 56 57 void 58 InitOutput(ScreenInfo * screen_info, int argc, char *argv[]) 59 { 60 int i, j; 61 62 xnestOpenDisplay(argc, argv); 63 64 screen_info->imageByteOrder = ImageByteOrder(xnestDisplay); 65 screen_info->bitmapScanlineUnit = BitmapUnit(xnestDisplay); 66 screen_info->bitmapScanlinePad = BitmapPad(xnestDisplay); 67 screen_info->bitmapBitOrder = BitmapBitOrder(xnestDisplay); 68 69 screen_info->numPixmapFormats = 0; 70 for (i = 0; i < xnestNumPixmapFormats; i++) 71 for (j = 0; j < xnestNumDepths; j++) 72 if ((xnestPixmapFormats[i].depth == 1) || 73 (xnestPixmapFormats[i].depth == xnestDepths[j])) { 74 screen_info->formats[screen_info->numPixmapFormats].depth = 75 xnestPixmapFormats[i].depth; 76 screen_info->formats[screen_info->numPixmapFormats].bitsPerPixel = 77 xnestPixmapFormats[i].bits_per_pixel; 78 screen_info->formats[screen_info->numPixmapFormats].scanlinePad = 79 xnestPixmapFormats[i].scanline_pad; 80 screen_info->numPixmapFormats++; 81 break; 82 } 83 84 xnestFontPrivateIndex = xfont2_allocate_font_private_index(); 85 86 if (!xnestNumScreens) 87 xnestNumScreens = 1; 88 89 for (i = 0; i < xnestNumScreens; i++) 90 AddScreen(xnestOpenScreen, argc, argv); 91 92 xnestNumScreens = screen_info->numScreens; 93 94 xnestDoFullGeneration = xnestFullGeneration; 95 } 96 97 static void 98 xnestNotifyConnection(int fd, int ready, void *data) 99 { 100 xnestCollectEvents(); 101 } 102 103 void 104 InitInput(int argc, char *argv[]) 105 { 106 int rc; 107 108 rc = AllocDevicePair(serverClient, "Xnest", 109 &xnestPointerDevice, 110 &xnestKeyboardDevice, 111 xnestPointerProc, xnestKeyboardProc, FALSE); 112 113 if (rc != Success) 114 FatalError("Failed to init Xnest default devices.\n"); 115 116 mieqInit(); 117 118 SetNotifyFd(XConnectionNumber(xnestDisplay), xnestNotifyConnection, X_NOTIFY_READ, NULL); 119 120 RegisterBlockAndWakeupHandlers(xnestBlockHandler, xnestWakeupHandler, NULL); 121 } 122 123 void 124 CloseInput(void) 125 { 126 mieqFini(); 127 } 128 129 void 130 ddxGiveUp(enum ExitCode error) 131 { 132 xnestDoFullGeneration = True; 133 xnestCloseDisplay(); 134 } 135 136 #ifdef __APPLE__ 137 void 138 DarwinHandleGUI(int argc, char *argv[]) 139 { 140 } 141 #endif 142 143 void 144 OsVendorInit(void) 145 { 146 return; 147 } 148 149 void 150 OsVendorFatalError(const char *f, va_list args) 151 { 152 return; 153 } 154 155 #if defined(DDXBEFORERESET) 156 void 157 ddxBeforeReset(void) 158 { 159 return; 160 } 161 #endif 162 163 #if INPUTTHREAD 164 /** This function is called in Xserver/os/inputthread.c when starting 165 the input thread. */ 166 void 167 ddxInputThreadInit(void) 168 { 169 } 170 #endif