diff options
Diffstat (limited to 'hw/xfree86/utils/xorgconfig/xorgconfig.c')
-rw-r--r-- | hw/xfree86/utils/xorgconfig/xorgconfig.c | 148 |
1 files changed, 105 insertions, 43 deletions
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c index 7f4c18d6a..a8fef000b 100644 --- a/hw/xfree86/utils/xorgconfig/xorgconfig.c +++ b/hw/xfree86/utils/xorgconfig/xorgconfig.c @@ -94,6 +94,7 @@ * Chisato Yamauchi(cyamauch@phyas.aichi-edu.ac.jp) */ /* $XConsortium: xf86config.c /main/21 1996/10/28 05:43:57 kaleb $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/xf86config/xorgconfig.c,v 1.6 2004/08/13 23:57:38 alanc Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -169,6 +170,11 @@ static int getuid() { return 0; } #define TREEROOT PROJECTROOT #define TREEROOTLX TREEROOT "/lib/X11" #define TREEROOTCFG TREEROOT "/etc/X11" +#ifdef XDOCDIR +# define TREEROOTDOC XDOCDIR +#else +# define TREEROOTDOC TREEROOTLX "/doc" +#endif #define MODULEPATH TREEROOT "/lib/modules" #ifndef XCONFIGFILE @@ -256,7 +262,7 @@ CONFIGNAME " file is supplied with "__XSERVERNAME__"; it is configured for a sta "configuration, or let this program produce a base " CONFIGNAME " file for your\n" "configuration and fine-tune it.\n" #if 0 -" Refer to " TREEROOTLX "/doc/README.Config\n" +" Refer to " TREEROOTDOC "/README.Config\n" "for a detailed overview of the configuration process.\n" "\n" "(what should we change this section to?)\n" @@ -372,7 +378,7 @@ int M_OSMOUSE, M_WSMOUSE, M_AUTO, M_NETMOUSE_PS2, M_NETSCROLL_PS2, M_THINKINGMOUSE_PS2, M_ACECAD, M_GLIDEPOINT, M_INTELLIMOUSE, M_LOGITECH, M_MMHITTAB, M_MMSERIES, - M_MOUSEMAN, M_THINKINGMOUSE; + M_MOUSEMAN, M_THINKINGMOUSE, M_VUID; struct { char *name; @@ -398,6 +404,11 @@ struct { {"Auto", &M_AUTO, "Auto detect" }, +#ifdef sun + {"VUID", &M_VUID, + "Solaris VUID" + }, +#endif {"SysMouse", &M_SYSMOUSE, "SysMouse" }, @@ -464,6 +475,14 @@ struct { }, }; +#ifdef WSCONS_SUPPORT +# define DEF_MOUSEDEV "/dev/wsmouse"; +#elif defined(__FreeBSD__) +# define DEF_MOUSEDEV "/dev/sysmouse"; +#else +# define DEF_MOUSEDEV "/dev/mouse"; +#endif + #ifndef __UNIXOS2__ static char *mouseintro_text = "First specify a mouse protocol type. Choose one from the following list:\n" @@ -471,13 +490,7 @@ static char *mouseintro_text = static char *mousedev_text = "Now give the full device name that the mouse is connected to, for example\n" -"/dev/tty00. Just pressing enter will use the default, /dev/mouse.\n" -#ifdef WSCONS_SUPPORT -"On systems with wscons, the default is /dev/wsmouse.\n" -#endif -#ifdef __FreeBSD__ -"On FreeBSD, the default is /dev/sysmouse.\n" -#endif +"/dev/tty00. Just pressing enter will use the default, %s.\n" "\n"; static char *mousecomment_text = @@ -529,6 +542,7 @@ mouse_configuration(void) { #if !defined(__UNIXOS2__) && !defined(QNX4) int i, j; char s[80]; + char *def_mousedev = DEF_MOUSEDEV; #define MOUSETYPE_COUNT sizeof(mouse_info)/sizeof(mouse_info[0]) for (i = 0; i < MOUSETYPE_COUNT; i++) @@ -621,22 +635,24 @@ mouse_configuration(void) { config_emulate3buttons = 0; printf("\n"); - printf("%s", mousedev_text); +#if (defined(sun) && defined(__i386)) + /* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse, + but PS/2 mice default to /dev/kdmouse */ + if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) { + def_mousedev = "/dev/kdmouse"; + } +#endif + + printf(mousedev_text, def_mousedev); printf("Mouse device: "); getstring(s); - if (strlen(s) == 0) -#ifdef WSCONS_SUPPORT - config_pointerdevice = "/dev/wsmouse"; -#elif defined(__FreeBSD__) - config_pointerdevice = "/dev/sysmouse"; -#else - config_pointerdevice = "/dev/mouse"; -#endif - else { + if (strlen(s) == 0) { + config_pointerdevice = def_mousedev; + } else { config_pointerdevice = Malloc(strlen(s) + 1); strcpy(config_pointerdevice, s); - } - printf("\n"); + } + printf("\n"); #else /* __UNIXOS2__ */ /* set some reasonable defaults for OS/2 */ @@ -706,7 +722,7 @@ keyboard_configuration(void) rulesfile = XKB_RULES_DIR "/xfree98"; #else config_xkbrules = __XKBDEFRULES__; /* static */ - rulesfile = XKB_RULES_DIR "/"; + rulesfile = XKB_RULES_DIR "/" __XKBDEFRULES__; #endif rules = XkbRF_Load(rulesfile, "", True, False); @@ -839,7 +855,7 @@ static char *monitorintro_text = "\n" "The valid range for horizontal sync and vertical sync should be documented\n" "in the manual of your monitor. If in doubt, check the monitor database\n" -TREEROOTLX "/doc/Monitors to see if your monitor is there.\n" +TREEROOTDOC "/Monitors to see if your monitor is there.\n" "\n"; static char *hsyncintro_text = @@ -1852,10 +1868,10 @@ depth_configuration(void) */ static char *XF86Config_firstchunk_text = -"# File generated by xf86config.\n" +"# File generated by xorgconfig.\n" "\n" "#\n" -"# Copyright (c) 2004, by the "XVENDORNAMESHORT"\n" +"# Copyright 2004 "XVENDORNAME"\n" "#\n" "# Permission is hereby granted, free of charge, to any person obtaining a\n" "# copy of this software and associated documentation files (the \"Software\"),\n" @@ -1870,19 +1886,19 @@ static char *XF86Config_firstchunk_text = "# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" "# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" "# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n" -"# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n" +"# "XVENDORNAME" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n" "# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\n" "# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n" "# SOFTWARE.\n" "# \n" -"# Except as contained in this notice, the name of "XVENDORNAMESHORT" shall\n" +"# Except as contained in this notice, the name of "XVENDORNAME" shall\n" "# not be used in advertising or otherwise to promote the sale, use or other\n" -"# dealings in this Software without prior written authorization from the\n" -"# "XVENDORNAMESHORT".\n" +"# dealings in this Software without prior written authorization from\n" +"# "XVENDORNAME".\n" "#\n" "\n" "# **********************************************************************\n" -"# Refer to the XF86Config(4/5) man page for details about the format of \n" +"# Refer to the " CONFIGNAME "(" FILEMANSUFFIX ") man page for details about the format of \n" "# this file.\n" "# **********************************************************************\n" "\n" @@ -1903,9 +1919,17 @@ static char *XF86Config_firstchunk_text = " Option \"omit xfree86-dga\" # don't initialise the DGA extension\n" " EndSubSection\n" "\n" -"# This loads the Type1 and FreeType font modules\n" +"# This loads the font modules\n" +#ifdef HAS_TYPE1 " Load \"type1\"\n" +#else +"# Load \"type1\"\n" +#endif +#ifdef HAS_SPEEDO " Load \"speedo\"\n" +#else +"# Load \"speedo\"\n" +#endif " Load \"freetype\"\n" "# Load \"xtt\"\n" "\n" @@ -1932,9 +1956,11 @@ static char *XF86Config_firstchunk_text = "# as well as specifying multiple comma-separated entries in one FontPath\n" "# command (or a combination of both methods)\n" "# \n" +#if 0 "# If you don't have a floating point coprocessor and emacs, Mosaic or other\n" "# programs take long to start up, try moving the Type1 and Speedo directory\n" "# to the end of this list (or comment them out).\n" +#endif "# \n" "\n"; @@ -2025,7 +2051,11 @@ static char *XF86Config_fontpathchunk_text = "Section \"InputDevice\"\n" "\n" " Identifier \"Keyboard1\"\n" +#ifdef USE_DEPRECATED_KEYBOARD_DRIVER " Driver \"Keyboard\"\n" +#else +" Driver \"kbd\"\n" +#endif "\n" "# For most OSs the protocol can be omitted (it defaults to \"Standard\").\n" "# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),\n" @@ -2061,8 +2091,8 @@ static char *keyboardchunk3_text = "# control keys, use:\n" "# Option \"XkbOptions\" \"ctrl:swapcaps\"\n" "\n" -"# These are the default XKB settings for "XVENDORNAMESHORT"\n" -"# Option \"XkbRules\" \"__XKBDEFRULES__\"\n" +"# These are the default XKB settings for "__XSERVERNAME__"\n" +"# Option \"XkbRules\" \""__XKBDEFRULES__"\"\n" "# Option \"XkbModel\" \"pc101\"\n" "# Option \"XkbLayout\" \"us\"\n" "# Option \"XkbVariant\" \"\"\n" @@ -2114,7 +2144,7 @@ static char *xinputsection_text = "# Other input device sections \n" "# this is optional and is required only if you\n" "# are using extended input devices. This is for example only. Refer\n" -"# to the XF86Config man page for a description of the options.\n" +"# to the " CONFIGNAME " man page for a description of the options.\n" "# **********************************************************************\n" "#\n" "# Section \"InputDevice\" \n" @@ -2384,7 +2414,7 @@ static char *devicesection_text = "\n" "EndSection\n" "\n" -"# Device configured by xf86config:\n" +"# Device configured by xorgconfig:\n" "\n"; static char *screensection_text1 = @@ -2448,12 +2478,43 @@ write_fontpath_section(FILE *f) int i; char cur[256+20],*colon, *hash; +#ifdef COMPILEDDEFAULTFONTPATH + static const char dfp[] = COMPILEDDEFAULTFONTPATH; + const char *thisdir; + const char *nextdir; + int len; + + for (thisdir = dfp; thisdir != NULL; thisdir = nextdir) { + nextdir = strchr(thisdir, ','); + if (nextdir == NULL) { + len = strlen(thisdir); + } else { + len = nextdir - thisdir; + nextdir++; + } + if (len > sizeof(cur)) + continue; + strncpy(cur, thisdir, len); + cur[len] = '\0'; + colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */ + if (colon) *colon = 0; + hash = exists_dir(cur) ? "" : "#"; + if (colon) *colon = ':'; + fprintf(f,"%s FontPath \"%s\"\n", hash, cur); + } +#endif + for (i=0; XF86Config_fontpaths[i]; i++) { strcpy(cur,TREEROOTLX); strcat(cur,XF86Config_fontpaths[i]); /* remove a ':' */ colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */ if (colon) *colon = 0; +#ifdef COMPILEDDEFAULTFONTPATH + /* skip if we already added it as part of the default font path */ + if (strstr(dfp, cur) != NULL) + continue; +#endif hash = exists_dir(cur) ? "" : "#"; fprintf(f,"%s FontPath \"%s%s\"\n", hash, @@ -2701,7 +2762,7 @@ ask_XF86Config_location(void) { char *filename = NULL; printf( -"I am going to write the XF86Config file now. Make sure you don't accidently\n" +"I am going to write the " CONFIGNAME " file now. Make sure you don't accidently\n" "overwrite a previously configured one.\n\n"); #ifndef __EMX__ @@ -2778,22 +2839,23 @@ ask_XF86Config_location(void) { static char *notinstalled_text = "The directory " TREEROOT " does not exist. This probably means that you have\n" -"not yet installed an X11R6-based version of "__XSERVERNAME__". Please install\n" -"XFree86 3.1+ before running this program, following the instructions in\n" -"the INSTALL or README that comes with the "__XSERVERNAME__" distribution for your OS.\n" +"not yet installed the version of "__XSERVERNAME__" that this program was built\n" +"to configure. Please install "__XSERVERNAME__" "XVERSIONSTRING" before running this program,\n" +"following the instructions in the INSTALL or README that comes with the\n" +__XSERVERNAME__" distribution for your OS.\n" "For a minimal installation it is sufficient to only install base binaries,\n" "libraries, configuration files and a server that you want to use.\n" "\n"; #ifndef __UNIXOS2__ static char *oldxfree86_text = -"The directory '/usr/X386/bin' exists. You probably have an old version of\n" -"__XSERVERNAME__ installed (XFree86 3.1 installs in '" TREEROOT "' instead of\n" -"'/usr/X386').\n" +"The directory '/usr/X386/bin' exists. You probably have a very old version of\n" +"XFree86 installed, but this program was built to configure "__XSERVERNAME__" "XVERSIONSTRING"\n" +"installed in '" TREEROOT "' instead of '/usr/X386'.\n" "\n" "It is important that the directory '" TREEROOT "' is present in your\n" "search path, *before* any occurrence of '/usr/X386/bin'. If you have installed\n" -"X program binaries that are not in the base __XSERVERNAME__ distribution in\n" +"X program binaries that are not in the base "__XSERVERNAME__" distribution in\n" "'/usr/X386/bin', you can keep the directory in your path as long as it is\n" "after '" TREEROOT "'.\n" "\n"; |