Remove all traces of external RGB database (and Speedo)
Remove all references to an external RGB database (which hasn't been enabled for a very long time). Also get rid of some references to Speedo fonts.
This commit is contained in:
parent
5e363500c8
commit
dda10c9066
10
configure.ac
10
configure.ac
|
@ -454,9 +454,6 @@ AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XK
|
|||
AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
|
||||
[ XKBOUTPUT="$withval" ],
|
||||
[ XKBOUTPUT="compiled" ])
|
||||
AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]),
|
||||
[ RGBPATH="$withval" ],
|
||||
[ RGBPATH="${datadir}/X11/rgb" ])
|
||||
AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]),
|
||||
[ SERVERCONFIG="$withval" ],
|
||||
[ SERVERCONFIG="${libdir}/xserver" ])
|
||||
|
@ -1000,13 +997,7 @@ if test "x$XDMAUTH" = xyes; then
|
|||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_RGB_BUILTIN, [test "x$USE_RGB_BUILTIN" = xyes])
|
||||
if test "x$USE_RGB_BUILTIN" = xyes; then
|
||||
AC_DEFINE(USE_RGB_BUILTIN, 1, [Use built-in RGB color database])
|
||||
fi
|
||||
|
||||
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
|
||||
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
|
||||
AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
|
||||
AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path])
|
||||
AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
|
||||
|
@ -1042,7 +1033,6 @@ else
|
|||
fi
|
||||
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
|
||||
|
||||
AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly])
|
||||
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
|
||||
AC_DEFINE(XTEST, 1, [Support XTest extension])
|
||||
AC_DEFINE(XSYNC, 1, [Support XSync extension])
|
||||
|
|
|
@ -136,7 +136,6 @@ Bool screenSaverSuspended = FALSE;
|
|||
char *defaultFontPath = COMPILEDDEFAULTFONTPATH;
|
||||
char *defaultTextFont = COMPILEDDEFAULTFONT;
|
||||
char *defaultCursorFont = COMPILEDCURSORFONT;
|
||||
char *rgbPath = RGB_DB;
|
||||
char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
|
||||
FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
|
||||
every compilation of dix code */
|
||||
|
|
|
@ -100,7 +100,6 @@ optionsdir = $(libdir)/X11
|
|||
dist_options_DATA = Options
|
||||
|
||||
CPP_FILES_FLAGS = \
|
||||
-DRGBPATH=\"$(RGB_DB)\" \
|
||||
-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
|
||||
-DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
|
||||
-DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
|
||||
|
|
|
@ -699,21 +699,6 @@ configFiles(XF86ConfFilesPtr fileconf)
|
|||
}
|
||||
|
||||
|
||||
/* RgbPath */
|
||||
|
||||
pathFrom = X_DEFAULT;
|
||||
|
||||
if (xf86coFlag)
|
||||
pathFrom = X_CMDLINE;
|
||||
else if (fileconf) {
|
||||
if (fileconf->file_rgbpath) {
|
||||
rgbPath = fileconf->file_rgbpath;
|
||||
pathFrom = X_CONFIG;
|
||||
}
|
||||
}
|
||||
|
||||
xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath);
|
||||
|
||||
if (fileconf && fileconf->file_inputdevs) {
|
||||
xf86InputDeviceList = fileconf->file_inputdevs;
|
||||
xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n",
|
||||
|
|
|
@ -605,8 +605,6 @@ configureFilesSection (void)
|
|||
ptr->file_modulepath = strdup(xf86ModulePath);
|
||||
if (defaultFontPath)
|
||||
ptr->file_fontpath = strdup(defaultFontPath);
|
||||
if (rgbPath)
|
||||
ptr->file_rgbpath = strdup(rgbPath);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,6 @@ The recommended font path contains the following font path elements:
|
|||
.I __projectroot__/lib/X11/fonts/75dpi/:unscaled
|
||||
.I __projectroot__/lib/X11/fonts/100dpi/:unscaled
|
||||
.I __projectroot__/lib/X11/fonts/Type1/
|
||||
.I __projectroot__/lib/X11/fonts/Speedo/
|
||||
.I __projectroot__/lib/X11/fonts/75dpi/
|
||||
.I __projectroot__/lib/X11/fonts/100dpi/
|
||||
.fi
|
||||
|
@ -383,20 +382,6 @@ Font path elements that are found to be invalid are removed from the
|
|||
font path when the server starts up.
|
||||
.RE
|
||||
.TP 7
|
||||
.BI "RGBPath \*q" path \*q
|
||||
sets the path name for the RGB color database.
|
||||
When this entry is not specified in the config file, the server falls back
|
||||
to the compiled\-in default RGB path, which is:
|
||||
.PP
|
||||
.RS 11
|
||||
.I __projectroot__/share/X11/rgb
|
||||
.RE
|
||||
.PP
|
||||
Note that an implicit
|
||||
.I .txt
|
||||
is added to this path if the server was compiled to use text rather than
|
||||
binary format RGB color databases.
|
||||
.TP 7
|
||||
.BI "ModulePath \*q" path \*q
|
||||
sets the search path for loadable __xservername__ server modules.
|
||||
This path is a comma separated list of directories which the __xservername__ server
|
||||
|
|
|
@ -69,7 +69,6 @@ static xf86ConfigSymTabRec FilesTab[] =
|
|||
{
|
||||
{ENDSECTION, "endsection"},
|
||||
{FONTPATH, "fontpath"},
|
||||
{RGBPATH, "rgbpath"},
|
||||
{MODULEPATH, "modulepath"},
|
||||
{INPUTDEVICES, "inputdevices"},
|
||||
{LOGFILEPATH, "logfile"},
|
||||
|
@ -122,11 +121,6 @@ xf86parseFilesSection (void)
|
|||
strcat (ptr->file_fontpath, str);
|
||||
xf86conffree (val.str);
|
||||
break;
|
||||
case RGBPATH:
|
||||
if (xf86getSubToken (&(ptr->file_comment)) != STRING)
|
||||
Error (QUOTE_MSG, "RGBPath");
|
||||
ptr->file_rgbpath = val.str;
|
||||
break;
|
||||
case MODULEPATH:
|
||||
if (xf86getSubToken (&(ptr->file_comment)) != STRING)
|
||||
Error (QUOTE_MSG, "ModulePath");
|
||||
|
@ -216,8 +210,6 @@ xf86printFileSection (FILE * cf, XF86ConfFilesPtr ptr)
|
|||
fprintf (cf, "%s", ptr->file_comment);
|
||||
if (ptr->file_logfile)
|
||||
fprintf (cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
|
||||
if (ptr->file_rgbpath)
|
||||
fprintf (cf, "\tRgbPath \"%s\"\n", ptr->file_rgbpath);
|
||||
if (ptr->file_modulepath)
|
||||
{
|
||||
s = ptr->file_modulepath;
|
||||
|
@ -272,7 +264,6 @@ xf86freeFiles (XF86ConfFilesPtr p)
|
|||
return;
|
||||
|
||||
TestFree (p->file_logfile);
|
||||
TestFree (p->file_rgbpath);
|
||||
TestFree (p->file_modulepath);
|
||||
TestFree (p->file_inputdevs);
|
||||
TestFree (p->file_fontpath);
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
typedef struct
|
||||
{
|
||||
char *file_logfile;
|
||||
char *file_rgbpath;
|
||||
char *file_modulepath;
|
||||
char *file_inputdevs;
|
||||
char *file_fontpath;
|
||||
|
|
|
@ -97,7 +97,6 @@ typedef enum {
|
|||
|
||||
/* File tokens */
|
||||
FONTPATH,
|
||||
RGBPATH,
|
||||
MODULEPATH,
|
||||
INPUTDEVICES,
|
||||
LOGFILEPATH,
|
||||
|
|
|
@ -472,15 +472,6 @@ CreateFiles(TreeNode *files)
|
|||
files->child = node;
|
||||
files->update = UpdateFiles;
|
||||
|
||||
if (XF86RGB_path)
|
||||
value = XF86RGB_path;
|
||||
else
|
||||
value = file->file_rgbpath ? file->file_rgbpath : "";
|
||||
node->next = NewNode(files, NULL, NULL, files->node,
|
||||
(TreeData*)XtCalloc(1, sizeof(TreeData)));
|
||||
node = node->next;
|
||||
CreateFilesField(node, "RgbPath", value);
|
||||
|
||||
w = XtVaCreateManagedWidget("ModulePath", toggleWidgetClass, tree,
|
||||
XtNtreeParent, files->node, NULL);
|
||||
node->next = modulepath = NewNode(files, w, w, files->node, NULL);
|
||||
|
@ -523,15 +514,6 @@ UpdateFiles(TreeNode *files)
|
|||
XF86Config->conf_files->file_logfile = XtNewString(str);
|
||||
else
|
||||
XF86Config->conf_files->file_logfile = NULL;
|
||||
|
||||
/* LogFile */
|
||||
files = files->next;
|
||||
XtVaGetValues(files->data->files.text, XtNstring, &str, NULL);
|
||||
XtFree(XF86Config->conf_files->file_rgbpath);
|
||||
if (*str)
|
||||
XF86Config->conf_files->file_rgbpath = XtNewString(str);
|
||||
else
|
||||
XF86Config->conf_files->file_rgbpath = NULL;
|
||||
}
|
||||
|
||||
/* FontPath */
|
||||
|
|
|
@ -213,7 +213,6 @@ Usage(void)
|
|||
" -modulepath <module-path> "__XSERVERNAME__" modules location.\n"
|
||||
" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n"
|
||||
" -fontpath <font-path> Font path for fonts.\n"
|
||||
" -rgbpath <rgb-path> Where the rgb.txt file is located.\n"
|
||||
#ifdef HAS_NCURSES
|
||||
" -textmode Use this option for the text only interface.\n"
|
||||
#endif
|
||||
|
@ -270,10 +269,7 @@ main(int argc, char *argv[])
|
|||
} else if (strcmp(argv[i], "-fontpath") == 0) {
|
||||
if (i + 1 < argc)
|
||||
XF86Font_path = argv[++i];
|
||||
} else if (strcmp(argv[i], "-rgbpath") == 0) {
|
||||
if (i + 1 < argc)
|
||||
XF86RGB_path = argv[++i];
|
||||
}
|
||||
}
|
||||
#ifdef HAS_NCURSES
|
||||
else if (strcmp(argv[i], "-textmode") == 0)
|
||||
textmode = True;
|
||||
|
|
|
@ -73,9 +73,6 @@ startx(void)
|
|||
if (XF86Font_path && ((len = sizeof(commandline) - c_pos) > 0))
|
||||
c_pos += XmuSnprintf(commandline + c_pos,len,
|
||||
" -fontpath %s",XF86Font_path);
|
||||
if (XF86RGB_path && ((len = sizeof(commandline) - c_pos) > 0))
|
||||
c_pos += XmuSnprintf(commandline + c_pos,len,
|
||||
" -rgbpath %s",XF86RGB_path);
|
||||
|
||||
if (system(commandline) != 0) {
|
||||
fprintf(stderr, "Failed to run \"X -configure\".\n");
|
||||
|
|
|
@ -84,10 +84,6 @@ __xservername__ binary.
|
|||
Specifies the path to the fonts that should be used by the server started
|
||||
by xorgcfg.
|
||||
.TP 8
|
||||
.I -rgbpath
|
||||
Specifies the path to the rgb.txt file that should be used by the server
|
||||
started by xorgcfg, if any.
|
||||
.TP 8
|
||||
.I -textmode
|
||||
If xorgcfg was compiled with support for ncurses, this option makes xorgcfg
|
||||
enter a text mode interface.
|
||||
|
|
|
@ -1898,22 +1898,10 @@ static char *XF86Config_firstchunk_text =
|
|||
"\n"
|
||||
"Section \"Files\"\n"
|
||||
"\n"
|
||||
"# The location of the RGB database. Note, this is the name of the\n"
|
||||
"# file minus the extension (like \".txt\" or \".db\"). There is normally\n"
|
||||
"# no need to change the default.\n"
|
||||
"\n"
|
||||
"# RgbPath \"" TREEROOTSHARE "/rgb\"\n"
|
||||
"\n"
|
||||
"# Multiple FontPath entries are allowed (which are concatenated together),\n"
|
||||
"# 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 directory\n"
|
||||
"# to the end of this list (or comment it out).\n"
|
||||
#endif
|
||||
"# \n"
|
||||
"\n";
|
||||
|
||||
static char *XF86Config_fontpaths[] =
|
||||
|
@ -1923,7 +1911,6 @@ static char *XF86Config_fontpaths[] =
|
|||
"/misc/",
|
||||
"/75dpi/:unscaled",
|
||||
"/100dpi/:unscaled",
|
||||
"/Speedo/",
|
||||
"/Type1/",
|
||||
"/TrueType/",
|
||||
"/freefont/",
|
||||
|
|
|
@ -42,12 +42,6 @@ XCOMM **********************************************************************
|
|||
|
||||
Section "Files"
|
||||
|
||||
XCOMM The location of the RGB database. Note, this is the name of the
|
||||
XCOMM file minus the extension (like ".txt" or ".db"). There is normally
|
||||
XCOMM no need to change the default.
|
||||
|
||||
RgbPath RGBPATH
|
||||
|
||||
XCOMM Multiple FontPath entries are allowed (which are concatenated together),
|
||||
XCOMM as well as specifying multiple comma-separated entries in one FontPath
|
||||
XCOMM command (or a combination of both methods)
|
||||
|
|
|
@ -600,24 +600,6 @@ winFixupPaths (void)
|
|||
winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath);
|
||||
|
||||
#ifdef RELOCATE_PROJECTROOT
|
||||
if (1) {
|
||||
const char *libx11dir = "/usr/X11R6/lib/X11";
|
||||
size_t libx11dir_len = strlen(libx11dir);
|
||||
|
||||
if (strncmp(libx11dir, rgbPath, libx11dir_len) == 0)
|
||||
{
|
||||
size_t newsize = strlen(rgbPath) - libx11dir_len + basedirlen;
|
||||
char *compose = malloc(newsize + 1);
|
||||
strcpy(compose, basedir);
|
||||
strcat(compose, rgbPath + libx11dir_len);
|
||||
compose[newsize] = 0;
|
||||
rgbPath = xstrdup (compose);
|
||||
free (compose);
|
||||
|
||||
winMsg (X_DEFAULT, "RgbPath set to \"%s\"\n", rgbPath);
|
||||
}
|
||||
}
|
||||
|
||||
if (getenv("XKEYSYMDB") == NULL)
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
|
|
|
@ -65,7 +65,6 @@ WinCmdlineRec g_cmdline = {
|
|||
NULL, /* configFile */
|
||||
#endif
|
||||
NULL, /* fontPath */
|
||||
NULL, /* rgbPath */
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
NULL, /* keyboard */
|
||||
#endif
|
||||
|
@ -673,20 +672,6 @@ winConfigFiles ()
|
|||
}
|
||||
winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath);
|
||||
|
||||
/* RGBPath */
|
||||
from = X_DEFAULT;
|
||||
if (g_cmdline.rgbPath)
|
||||
{
|
||||
from = X_CMDLINE;
|
||||
rgbPath = g_cmdline.rgbPath;
|
||||
}
|
||||
else if (filesptr != NULL && filesptr->file_rgbpath)
|
||||
{
|
||||
from = X_CONFIG;
|
||||
rgbPath = xstrdup (filesptr->file_rgbpath);
|
||||
}
|
||||
winMsg (from, "RgbPath set to \"%s\"\n", rgbPath);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
|
@ -702,14 +687,6 @@ winConfigFiles ()
|
|||
winMsg (X_CMDLINE, "FontPath set to \"%s\"\n", defaultFontPath);
|
||||
}
|
||||
|
||||
/* RGBPath */
|
||||
if (g_cmdline.rgbPath)
|
||||
{
|
||||
from = X_CMDLINE;
|
||||
rgbPath = g_cmdline.rgbPath;
|
||||
winMsg (X_CMDLINE, "RgbPath set to \"%s\"\n", rgbPath);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -190,7 +190,6 @@ typedef struct
|
|||
char *configFile;
|
||||
#endif
|
||||
char *fontPath;
|
||||
char *rgbPath;
|
||||
/* input devices - keyboard */
|
||||
#ifdef XWIN_XF86CONFIG
|
||||
char *keyboard;
|
||||
|
|
|
@ -1277,16 +1277,6 @@ ddxProcessArgument (int argc, char *argv[], int i)
|
|||
return 0; /* Let DIX parse this again */
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for the '-co' argument
|
||||
*/
|
||||
if (IS_OPTION ("-co"))
|
||||
{
|
||||
CHECK_ARGS (1);
|
||||
g_cmdline.rgbPath = argv[++i];
|
||||
return 0; /* Let DIX parse this again */
|
||||
}
|
||||
|
||||
/*
|
||||
* Look for the '-query' argument
|
||||
*/
|
||||
|
|
|
@ -326,12 +326,6 @@
|
|||
/* Support UNIX socket connections */
|
||||
#undef UNIXCONN
|
||||
|
||||
/* Use builtin rgb color database */
|
||||
#undef USE_RGB_BUILTIN
|
||||
|
||||
/* Use rgb.txt directly */
|
||||
#undef USE_RGB_TXT
|
||||
|
||||
/* Define to use byteswap macros from <sys/endian.h> */
|
||||
#undef USE_SYS_ENDIAN_H
|
||||
|
||||
|
@ -464,9 +458,6 @@
|
|||
/* Define to 1 if unsigned long is 64 bits. */
|
||||
#undef _XSERVER64
|
||||
|
||||
/* Define to location of RGB database */
|
||||
#undef RGB_DB
|
||||
|
||||
/* System is BSD-like */
|
||||
#undef CSRG_BASED
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ extern Bool screenSaverSuspended;
|
|||
#endif
|
||||
|
||||
extern char *defaultFontPath;
|
||||
extern char *rgbPath;
|
||||
extern int monitorResolution;
|
||||
extern Bool loadableFonts;
|
||||
extern int defaultColorVisualClass;
|
||||
|
|
|
@ -75,9 +75,6 @@ SOFTWARE.
|
|||
#ifndef COMPILEDDEFAULTFONTPATH
|
||||
#define COMPILEDDEFAULTFONTPATH "/usr/lib/X11/fonts/misc/"
|
||||
#endif
|
||||
#ifndef RGB_DB
|
||||
#define RGB_DB "/usr/lib/X11/rgb"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following constants contain default values for all of the variables
|
||||
|
|
|
@ -109,12 +109,6 @@
|
|||
/* Support UNIX socket connections */
|
||||
#undef UNIXCONN
|
||||
|
||||
/* Use builtin rgb color database */
|
||||
#undef USE_RGB_BUILTIN
|
||||
|
||||
/* Use rgb.txt directly */
|
||||
#undef USE_RGB_TXT
|
||||
|
||||
/* unaligned word accesses behave as expected */
|
||||
#undef WORKING_UNALIGNED_INT
|
||||
|
||||
|
|
169
os/oscolor.c
169
os/oscolor.c
|
@ -49,13 +49,20 @@ SOFTWARE.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#define USE_RGB_BUILTIN 1
|
||||
|
||||
#if USE_RGB_BUILTIN
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include "os.h"
|
||||
|
||||
typedef struct _builtinColor {
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
unsigned short name;
|
||||
} BuiltinColor;
|
||||
|
||||
/* These have to come after the struct definition because despair. */
|
||||
#include "oscolor.h"
|
||||
#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0]))
|
||||
|
||||
static unsigned char
|
||||
OsToLower (unsigned char a)
|
||||
{
|
||||
|
@ -90,17 +97,6 @@ OsStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2)
|
|||
return c2 - c1;
|
||||
}
|
||||
|
||||
typedef struct _builtinColor {
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
unsigned short name;
|
||||
} BuiltinColor;
|
||||
|
||||
#include "oscolor.h"
|
||||
|
||||
#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0]))
|
||||
|
||||
Bool
|
||||
OsInitColors(void)
|
||||
{
|
||||
|
@ -141,146 +137,3 @@ OsLookupColor(int screen,
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* This file builds the server's internal database mapping color names to
|
||||
* RGB tuples by reading in an rgb.txt file. This is still slightly foolish,
|
||||
* rgb.txt hasn't changed in years, we should really include a precompiled
|
||||
* version into the server.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "os.h"
|
||||
#include "opaque.h"
|
||||
|
||||
#define HASHSIZE 63
|
||||
|
||||
typedef struct _dbEntry * dbEntryPtr;
|
||||
typedef struct _dbEntry {
|
||||
dbEntryPtr link;
|
||||
unsigned short red;
|
||||
unsigned short green;
|
||||
unsigned short blue;
|
||||
char name[1]; /* some compilers complain if [0] */
|
||||
} dbEntry;
|
||||
|
||||
extern void CopyISOLatin1Lowered(
|
||||
unsigned char * /*dest*/,
|
||||
unsigned char * /*source*/,
|
||||
int /*length*/);
|
||||
|
||||
static dbEntryPtr hashTab[HASHSIZE];
|
||||
|
||||
static dbEntryPtr
|
||||
lookup(char *name, int len, Bool create)
|
||||
{
|
||||
unsigned int h = 0, g;
|
||||
dbEntryPtr entry, *prev = NULL;
|
||||
char *str = name;
|
||||
|
||||
if (!(name = (char*)xalloc(len +1))) return NULL;
|
||||
CopyISOLatin1Lowered((unsigned char *)name, (unsigned char *)str, len);
|
||||
name[len] = '\0';
|
||||
|
||||
for(str = name; *str; str++) {
|
||||
h = (h << 4) + *str;
|
||||
if ((g = h) & 0xf0000000) h ^= (g >> 24);
|
||||
h &= g;
|
||||
}
|
||||
h %= HASHSIZE;
|
||||
|
||||
if ( (entry = hashTab[h]) )
|
||||
{
|
||||
for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link )
|
||||
if (! strcmp(name, entry->name) ) break;
|
||||
}
|
||||
else
|
||||
prev = &(hashTab[h]);
|
||||
|
||||
if (!entry && create && (entry = (dbEntryPtr)xalloc(sizeof(dbEntry) +len)))
|
||||
{
|
||||
*prev = entry;
|
||||
entry->link = NULL;
|
||||
strcpy( entry->name, name );
|
||||
}
|
||||
|
||||
xfree(name);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
Bool
|
||||
OsInitColors(void)
|
||||
{
|
||||
FILE *rgb;
|
||||
char *path;
|
||||
char line[BUFSIZ];
|
||||
char name[BUFSIZ];
|
||||
int red, green, blue, lineno = 0;
|
||||
dbEntryPtr entry;
|
||||
|
||||
static Bool was_here = FALSE;
|
||||
|
||||
if (!was_here)
|
||||
{
|
||||
path = (char*)xalloc(strlen(rgbPath) +5);
|
||||
strcpy(path, rgbPath);
|
||||
strcat(path, ".txt");
|
||||
if (!(rgb = fopen(path, "r")))
|
||||
{
|
||||
ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
|
||||
xfree(path);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(fgets(line, sizeof(line), rgb))
|
||||
{
|
||||
lineno++;
|
||||
if (sscanf(line,"%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4)
|
||||
{
|
||||
if (red >= 0 && red <= 0xff &&
|
||||
green >= 0 && green <= 0xff &&
|
||||
blue >= 0 && blue <= 0xff)
|
||||
{
|
||||
if ((entry = lookup(name, strlen(name), TRUE)))
|
||||
{
|
||||
entry->red = (red * 65535) / 255;
|
||||
entry->green = (green * 65535) / 255;
|
||||
entry->blue = (blue * 65535) / 255;
|
||||
}
|
||||
}
|
||||
else
|
||||
ErrorF("Value out of range: %s:%d\n", path, lineno);
|
||||
}
|
||||
else if (*line && *line != '#' && *line != '!')
|
||||
ErrorF("Syntax Error: %s:%d\n", path, lineno);
|
||||
}
|
||||
|
||||
fclose(rgb);
|
||||
xfree(path);
|
||||
|
||||
was_here = TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
OsLookupColor(int screen, char *name, unsigned int len,
|
||||
unsigned short *pred, unsigned short *pgreen, unsigned short *pblue)
|
||||
{
|
||||
dbEntryPtr entry;
|
||||
|
||||
if ((entry = lookup(name, len, FALSE)))
|
||||
{
|
||||
*pred = entry->red;
|
||||
*pgreen = entry->green;
|
||||
*pblue = entry->blue;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* USE_RGB_BUILTIN */
|
||||
|
|
|
@ -577,7 +577,6 @@ void UseMsg(void)
|
|||
ErrorF("-c turns off key-click\n");
|
||||
ErrorF("c # key-click volume (0-100)\n");
|
||||
ErrorF("-cc int default color visual class\n");
|
||||
ErrorF("-co file color database file\n");
|
||||
#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
|
||||
ErrorF("-config file read options from file\n");
|
||||
#endif
|
||||
|
@ -783,13 +782,6 @@ ProcessCommandLine(int argc, char *argv[])
|
|||
else
|
||||
UseMsg();
|
||||
}
|
||||
else if ( strcmp( argv[i], "-co") == 0)
|
||||
{
|
||||
if(++i < argc)
|
||||
rgbPath = argv[i];
|
||||
else
|
||||
UseMsg();
|
||||
}
|
||||
else if ( strcmp( argv[i], "-core") == 0)
|
||||
{
|
||||
CoreDump = TRUE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user