/*********************************************************** Copyright 1991, 1998 The Open Group All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $Xorg: init.c,v 1.3 2000/08/17 19:48:20 cpqbld Exp $ */ #include #include #include #include #include #include #include #include #include "X.h" #include "scrnintstr.h" #include "servermd.h" #include "input.h" /* XXX */ #include #ifdef __alpha #include #endif #include #include "ws.h" extern int wsMouseProc(); extern int wsKeybdProc(); extern void wsClick(); extern void wsChangePointerControl(); extern void mcfbFillInMissingPixmapDepths(); extern KeybdCtrl defaultKeyboardControl; ws_event_queue *queue; static int NumFormats; static int bitsPerDepth[33]; Bool fbInitProc(); extern int num_accelerator_types; extern wsAcceleratorTypes types[]; ws_screen_descriptor screenDesc[MAXSCREENS]; Bool commandLineMatch( argc, argv, pat, pmatch) int argc; /* may NOT be changed */ char * argv[]; /* may NOT be changed */ char * pat; { int ic; for ( ic=0; ic= MAXFORMATS) FatalError ("MAXFORMATS is too small for this machine\n"); screenInfo->formats[NumFormats].depth = i; screenInfo->formats[NumFormats].bitsPerPixel = j; screenInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; NumFormats++; } } screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; screenInfo->numPixmapFormats = NumFormats; wsScreenPrivateIndex = AllocateScreenPrivateIndex(); #ifdef __alpha if (getsysinfo(GSI_CPU, (caddr_t)&ws_cpu, sizeof(ws_cpu), 0, 0) == -1) { fprintf(stderr,"INIT: cannot get cputype.\n"); exit(1); } #else ws_cpu = wsinfo.cpu; #endif for(i = 0; i < wsinfo.num_screens_exist; i++) { int j, DECaccelerator = FALSE; screenDesc[si].screen = i; if (ioctl(wsFd, GET_SCREEN_INFO, &screenDesc[si]) == -1) { FatalError("GET_SCREEN_INFO failed, errno %d (%s)\n", errno, strerror(errno)); } if (si >= MAXSCREENS) { ErrorF ("Server configured for %d screens, can't configure screen %d\n", MAXSCREENS, si); break; } for (j = 0; j < num_accelerator_types; j++) { if (strcmp (screenDesc[si].moduleID, types[j].moduleID) == 0) { DECaccelerator = TRUE; break; } } if(DECaccelerator) j = AddScreen(types[j].createProc, argc, argv); else j = AddScreen(fbInitProc, argc, argv); /* * AddScreen either returns -1 (error) or # of screens installed * (current index). screenDesc[] is exactly parallel to * screenInfo.screens[] since the initProc() arg will be called * with AddScreen's index, which in turn gets used for screenDesc[]. */ if (j == -1) { ErrorF("Could not AddScreen, ID = %s\n", screenDesc[si].moduleID); } else si = j+1; } #ifdef XINPUT ExtInitOutput(screenInfo, argc, argv); #endif } void InitInput(argc, argv) int argc; char *argv[]; { DevicePtr p, k; static int inited = FALSE; p = AddInputDevice(wsMouseProc, TRUE); k = AddInputDevice(wsKeybdProc, TRUE); RegisterPointerDevice(p); RegisterKeyboardDevice(k); #ifdef XINPUT ExtInitInput(argc, argv); #endif if (!inited) { inited = TRUE; if (ioctl(wsFd, GET_AND_MAP_EVENT_QUEUE, &queue) == -1) { FatalError("GET_AND_MAP_EVENT_QUEUE failed, errno %d (%s)\n", errno, strerror(errno)); } } SetTimeSinceLastInputEvent (); } #endif /* PRINT_ONLY_SERVER */