xf86init.c

来自「基于组件方式开发操作系统的OSKIT源代码」· C语言 代码 · 共 868 行 · 第 1/2 页

C
868
字号
  (xf86Info.pMouse)->public.devicePrivate = xf86Info.mouseLocal;#if 0 /* Is this needed?? */  ((LocalDevicePtr) xf86Info.mouseLocal)->dev = xf86Info.pMouse;#endif#else  (xf86Info.pMouse)->public.devicePrivate = (pointer) xf86Info.mouseDev;#endif  #ifdef XINPUT  InitExtInput();#endif  miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);#ifdef XINPUT  xf86XinputFinalizeInit(xf86Info.pMouse);  xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);#else  mieqInit (xf86Info.pKeyboard, xf86Info.pMouse);#endif}/* * OsVendorInit -- *      OS/Vendor-specific initialisations.  Called from OsInit(), which *      is called by dix before establishing the well known sockets. */ extern Bool OsDelayInitColors;voidOsVendorInit(){#ifdef SIGCHLD  signal(SIGCHLD, SIG_DFL);	/* Need to wait for child processes */#endif#ifdef USE_XF86_SERVERLOCK  extern void xf86LockServer();  static Bool been_here = FALSE;  if (!been_here) {    xf86LockServer();    been_here = TRUE;  }#endif  OsDelayInitColors = TRUE;}#endif /* !OSKIT */#ifdef DPMSExtension/* * DPMSSet -- *	Device dependent DPMS mode setting hook.  This is called whenever *	the DPMS mode is to be changed. */voidDPMSSet(CARD16 level){    int i;    /* For each screen, set the power saver level */    for (i = 0; i < screenInfo.numScreens; i++) {	(XF86SCRNINFO(screenInfo.screens[i])->DPMSSet)(level);    }    DPMSPowerLevel = level;}#if 0/* * DPMSGet -- *	Device dependent DPMS mode getting hook.  This returns the current *	DPMS mode, or -1 if DPMS is not supported. * *	This should hook in to the appropriate driver-level function, which *	will be added to the ScrnInfoRec. * *	NOTES: *	 1. the calling interface should be changed to specify which *	    screen to check. *	 2. It isn't clear that this function is ever used. */CARD16DPMSGet(CARD16 *level){    int i;    /* For each screen, set the power saver level */    for (i = 0; i < screenInfo.numScreens; i++) {	 ;    }}#endif/* * DPMSSupported -- *	Return TRUE if any screen supports DPMS. */BoolDPMSSupported(void){    int i;    /* For each screen, check if DPMS is supported */    for (i = 0; i < screenInfo.numScreens; i++) {	if (XF86SCRNINFO(screenInfo.screens[i])->DPMSSet != (void (*)())NoopDDA)	    return TRUE;    }    return FALSE;}#endif /* DPMSExtension */#ifndef OSKIT/* * ddxGiveUp -- *      Device dependent cleanup. Called by by dix before normal server death. *      For SYSV386 we must switch the terminal back to normal mode. No error- *      checking here, since there should be restored as much as possible. */voidddxGiveUp(){#ifdef USE_XF86_SERVERLOCK  xf86UnlockServer();#endif  xf86CloseConsole();  /* If an unexpected signal was caught, dump a core for debugging */  if (xf86Info.caughtSignal)    abort();}/* * AbortDDX -- *      DDX - specific abort routine.  Called by AbortServer(). The attempt is *      made to restore all original setting of the displays. Also all devices *      are closed. */voidAbortDDX(){  int i;#if 0  if (xf86Exiting)    return;#endif  xf86Exiting = TRUE;  /*   * try to deinitialize all input devices   */  if (xf86Info.pMouse) (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_CLOSE);  if (xf86Info.pKeyboard) (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);  /*   * try to restore the original video state   */#ifdef HAS_USL_VTS  /* Need the sleep when starting X from within another X session */  sleep(1);#endif  if (xf86VTSema && xf86ScreensOpen)    for ( i=0;          i < xf86MaxScreens && xf86Screens[i] && xf86Screens[i]->configured;          i++ )      (xf86Screens[i]->EnterLeaveVT)(LEAVE, i);  /*   * This is needed for a abnormal server exit, since the normal exit stuff   * MUST also be performed (i.e. the vt must be left in a defined state)   */  ddxGiveUp();}voidOsVendorFatalError(){  ErrorF("\nWhen reporting a problem related to a server crash, please send\n"	 "the full server output, not just the last messages\n\n");}/* * ddxProcessArgument -- *	Process device-dependent command line args. Returns 0 if argument is *      not device dependent, otherwise Count of number of elements of argv *      that are part of a device dependent commandline option. *//* ARGSUSED */intddxProcessArgument (argc, argv, i)     int argc;     char *argv[];     int i;{  if (getuid() == 0 && !strcmp(argv[i], "-xf86config"))  {    if (!argv[i+1])      return 0;    if (strlen(argv[i+1]) >= PATH_MAX)      FatalError("XF86Config path name too long\n");    strcpy(xf86ConfigFile, argv[i+1]);    return 2;  }  if (!strcmp(argv[i],"-probeonly"))  {    xf86ProbeOnly = TRUE;    return 1;  }  if (!strcmp(argv[i],"-flipPixels"))  {    xf86FlipPixels = TRUE;    return 1;  }#ifdef XF86VIDMODE  if (!strcmp(argv[i],"-disableVidMode"))  {    xf86VidModeEnabled = FALSE;    return 1;  }  if (!strcmp(argv[i],"-allowNonLocalXvidtune"))  {    xf86VidModeAllowNonLocal = TRUE;    return 1;  }#endif#ifdef XF86MISC  if (!strcmp(argv[i],"-disableModInDev"))  {    xf86MiscModInDevEnabled = FALSE;    return 1;  }  if (!strcmp(argv[i],"-allowNonLocalModInDev"))  {    xf86MiscModInDevAllowNonLocal = TRUE;    return 1;  }  if (!strcmp(argv[i],"-allowMouseOpenFail"))  {    xf86AllowMouseOpenFail = TRUE;    return 1;  }#endif  if (!strcmp(argv[i],"-bestRefresh"))  {    xf86BestRefresh = TRUE;    return 1;  }#ifdef DO_CHECK_BETA  if (!strcmp(argv[i],"-extendExpiry"))  {    extraDays = atoi(argv[i + 1]);    expKey = argv[i + 2];    return 3;  }#endif  if (!strcmp(argv[i],"-verbose"))  {    if (!xf86Verbose++)      xf86Verbose = 2;    return 1;  }  if (!strcmp(argv[i],"-quiet"))  {    xf86Verbose = 0;    return 1;  }  if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))  {    xf86PrintBanner();    xf86PrintConfig();    exit(0);  }  /* Notice the -fp flag, but allow it to pass to the dix layer */  if (!strcmp(argv[i], "-fp"))  {    xf86fpFlag = TRUE;    return 0;  }  /* Notice the -co flag, but allow it to pass to the dix layer */  if (!strcmp(argv[i], "-co"))  {    xf86coFlag = TRUE;    return 0;  }  /* Notice the -s flag, but allow it to pass to the dix layer */  if (!strcmp(argv[i], "-s"))  {    xf86sFlag = TRUE;    return 0;  }#ifndef XF86MONOVGA  if (!strcmp(argv[i], "-bpp"))  {    int bpp;    if (++i >= argc)      return 0;    if (sscanf(argv[i], "%d", &bpp) == 1)    {      xf86bpp = bpp;      return 2;    }    else    {      ErrorF("Invalid bpp\n");      return 0;    }  }  if (!strcmp(argv[i], "-weight"))  {    int red, green, blue;    if (++i >= argc)      return 0;    if (sscanf(argv[i], "%1d%1d%1d", &red, &green, &blue) == 3)    {      xf86weight.red = red;      xf86weight.green = green;      xf86weight.blue = blue;      return 2;    }    else    {      ErrorF("Invalid weighting\n");      return 0;    }  }  if (!strcmp(argv[i], "-gamma")  || !strcmp(argv[i], "-rgamma") ||       !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))  {    double gamma;    if (++i >= argc)      return 0;    if (sscanf(argv[i], "%lf", &gamma) == 1) {       if (gamma < 0.1 || gamma > 10) {	  ErrorF("gamma out of range, only  0.1 < gamma_value < 10  is valid\n");	  return 0;       }       if (!strcmp(argv[i-1], "-gamma")) 	  xf86rGamma = xf86gGamma = xf86bGamma = 1.0 / gamma;       else if (!strcmp(argv[i-1], "-rgamma")) xf86rGamma = 1.0 / gamma;       else if (!strcmp(argv[i-1], "-ggamma")) xf86gGamma = 1.0 / gamma;       else if (!strcmp(argv[i-1], "-bgamma")) xf86bGamma = 1.0 / gamma;       return 2;    }  }#endif /* XF86MONOVGA */  return xf86ProcessArgument(argc, argv, i);}/* * ddxUseMsg -- *	Print out correct use of device dependent commandline options. *      Maybe the user now knows what really to do ... */voidddxUseMsg(){  ErrorF("\n");  ErrorF("\n");  ErrorF("Device Dependent Usage\n");  if (getuid() == 0)    ErrorF("-xf86config file       specify a configuration file\n");  ErrorF("-probeonly             probe for devices, then exit\n");  ErrorF("-verbose               verbose startup messages\n");  ErrorF("-quiet                 minimal startup messages\n");#ifndef XF86MONOVGA  ErrorF("-bpp n                 set number of bits per pixel. Default: 8\n");  ErrorF("-gamma f               set gamma value (0.1 < f < 10.0) Default: 1.0\n");  ErrorF("-rgamma f              set gamma value for red phase\n");  ErrorF("-ggamma f              set gamma value for green phase\n");  ErrorF("-bgamma f              set gamma value for blue phase\n");  ErrorF("-weight nnn            set RGB weighting at 16 bpp.  Default: 565\n");#endif /* XF86MONOVGA */  ErrorF("-flipPixels            swap default black/white Pixel values\n");#ifdef XF86VIDMODE  ErrorF("-disableVidMode        disable mode adjustments with xvidtune\n");  ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");#endif#ifdef XF86MISC  ErrorF("-disableModInDev       disable dynamic modification of input device settings\n");  ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n");  ErrorF("                       from non-local clients\n");  ErrorF("-allowMouseOpenFail    start server even if the mouse can't be initialized\n");#endif  ErrorF("-bestRefresh           Chose modes with the best refresh rate\n");  ErrorF(   "-showconfig            show which drivers are included in the server\n");  xf86UseMsg();  ErrorF("\n");}#ifndef OSNAME#define OSNAME "unknown"#endif#ifndef OSVENDOR#define OSVENDOR ""#endifstatic voidxf86PrintBanner(){  ErrorF("\nXFree86 Version%s/ X Window System\n",XF86_VERSION);  ErrorF("(protocol Version %d, revision %d, vendor release %d)\n",         X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE );  ErrorF("Release Date: %s\n", XF86_DATE);  ErrorF("\tIf the server is older than 6-12 months, or if your card is "	 "newer\n"	 "\tthan the above date, look for a newer version before "	 "reporting\n"	 "\tproblems.  (see http://www.XFree86.Org/FAQ)\n");  ErrorF("Operating System: %s %s\n", OSNAME, OSVENDOR);}#endif /* !OSKIT */static voidxf86PrintConfig(){  int i;  ErrorF("Configured drivers:\n");  for (i = 0; i < xf86MaxScreens; i++)    if (xf86Screens[i])      (xf86Screens[i]->PrintIdent)();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?