diff options
-rw-r--r-- | setxkbmap.c | 345 |
1 files changed, 175 insertions, 170 deletions
diff --git a/setxkbmap.c b/setxkbmap.c index a90117a..ddf3440 100644 --- a/setxkbmap.c +++ b/setxkbmap.c @@ -67,22 +67,6 @@ #define FROM_CMD_LINE 4 /* specified at the cmdline */ #define NUM_SOURCES 5 -/* Indices used into svSrc, svNValue */ -#define RULES_NDX 0 /* rules file */ -#define CONFIG_NDX 1 /* config file (if used) */ -#define DISPLAY_NDX 2 /* X display name */ -#define LOCALE_NDX 3 /* machine's locale */ -#define MODEL_NDX 4 -#define LAYOUT_NDX 5 -#define VARIANT_NDX 6 -#define KEYCODES_NDX 7 -#define TYPES_NDX 8 -#define COMPAT_NDX 9 -#define SYMBOLS_NDX 10 -#define GEOMETRY_NDX 11 -#define KEYMAP_NDX 12 -#define NUM_STRING_VALS 13 - /***====================================================================***/ static Bool print = False; static Bool query = False; @@ -99,26 +83,47 @@ static char *srcName[NUM_SOURCES] = { "undefined", "X server", "rules file", "config file", "command line" }; -/** - * human-readable versions for RULES_NDX, CONFIG_NDX, etc. Used for error - * reporting. - */ -static char *svName[NUM_STRING_VALS] = { - "rules file", "config file", "X display", "locale", - "keyboard model", "keyboard layout", "layout variant", - "keycodes", "types", "compatibility map", "symbols", "geometry", - "keymap" +struct setting { + char const * name; /* Human-readable setting name. Used for error reporting. */ + char * value; /* Holds the value. */ + int src; /* Holds the source. */ +}; + +typedef struct setting setting_t; + +struct settings { + setting_t rules; /* Rules file */ + setting_t config; /* Config file (if used) */ + setting_t display; /* X display name */ + setting_t locale; /* Machine's locale */ + setting_t model; + setting_t layout; + setting_t variant; + setting_t keycodes; + setting_t types; + setting_t compat; + setting_t symbols; + setting_t geometry; + setting_t keymap; +}; + +typedef struct settings settings_t; + +static settings_t settings = { + { "rules file", NULL, UNDEFINED }, + { "config file", NULL, UNDEFINED }, + { "X display", NULL, UNDEFINED }, + { "locale", NULL, UNDEFINED }, + { "keyboard model", NULL, UNDEFINED }, + { "keyboard layout", NULL, UNDEFINED }, + { "layout variant", NULL, UNDEFINED }, + { "keycodes", NULL, UNDEFINED }, + { "types", NULL, UNDEFINED }, + { "compatibility map", NULL, UNDEFINED }, + { "symbols", NULL, UNDEFINED }, + { "geometry", NULL, UNDEFINED }, + { "keymap", NULL, UNDEFINED } }; -/** - * Holds the source for each of RULES, CONFIG, DISPLAY, etc. - * i.e. if svSrc[LAYOUT_NDX] == FROM_SERVER, then the layout has been fetched - * from the server. - */ -static int svSrc[NUM_STRING_VALS]; -/** - * Holds the value for each of RULES, CONFIG, DISPLAY, etc. - */ -static char *svValue[NUM_STRING_VALS]; static XkbConfigRtrnRec cfgResult; @@ -163,8 +168,8 @@ static int deviceSpec = XkbUseCoreKbd; Bool addToList(int *sz, int *num, char ***listIn, char *newVal); void usage(int argc, char **argv); void dumpNames(Bool wantRules, Bool wantCNames); -void trySetString(int which, char *newVal, int src); -Bool setOptString(int *arg, int argc, char **argv, int which, int src); +void trySetString(setting_t * setting, char *newVal, int src); +Bool setOptString(int *arg, int argc, char **argv, setting_t * setting, int src); int parseArgs(int argc, char **argv); Bool getDisplay(int argc, char **argv); Bool getServerValues(void); @@ -256,14 +261,14 @@ dumpNames(Bool wantRules, Bool wantCNames) { if (wantRules) { - if (svValue[RULES_NDX]) - MSG1("rules: %s\n", svValue[RULES_NDX]); - if (svValue[MODEL_NDX]) - MSG1("model: %s\n", svValue[MODEL_NDX]); - if (svValue[LAYOUT_NDX]) - MSG1("layout: %s\n", svValue[LAYOUT_NDX]); - if (svValue[VARIANT_NDX]) - MSG1("variant: %s\n", svValue[VARIANT_NDX]); + if (settings.rules.value) + MSG1("rules: %s\n", settings.rules.value); + if (settings.model.value) + MSG1("model: %s\n", settings.model.value); + if (settings.layout.value) + MSG1("layout: %s\n", settings.layout.value); + if (settings.variant.value) + MSG1("variant: %s\n", settings.variant.value); if (options) { char *opt_str = stringFromOptions(NULL, numOptions, options); @@ -273,18 +278,18 @@ dumpNames(Bool wantRules, Bool wantCNames) } if (wantCNames) { - if (svValue[KEYMAP_NDX]) - MSG1("keymap: %s\n", svValue[KEYMAP_NDX]); - if (svValue[KEYCODES_NDX]) - MSG1("keycodes: %s\n", svValue[KEYCODES_NDX]); - if (svValue[TYPES_NDX]) - MSG1("types: %s\n", svValue[TYPES_NDX]); - if (svValue[COMPAT_NDX]) - MSG1("compat: %s\n", svValue[COMPAT_NDX]); - if (svValue[SYMBOLS_NDX]) - MSG1("symbols: %s\n", svValue[SYMBOLS_NDX]); - if (svValue[GEOMETRY_NDX]) - MSG1("geometry: %s\n", svValue[GEOMETRY_NDX]); + if (settings.keymap.value) + MSG1("keymap: %s\n", settings.keymap.value); + if (settings.keycodes.value) + MSG1("keycodes: %s\n", settings.keycodes.value); + if (settings.types.value) + MSG1("types: %s\n", settings.types.value); + if (settings.compat.value) + MSG1("compat: %s\n", settings.compat.value); + if (settings.symbols.value) + MSG1("symbols: %s\n", settings.symbols.value); + if (settings.geometry.value) + MSG1("geometry: %s\n", settings.geometry.value); } return; } @@ -299,33 +304,33 @@ dumpNames(Bool wantRules, Bool wantCNames) * @param which What value is it (one of RULES_NDX, CONFIG_NDX, ...) */ void -trySetString(int which, char *newVal, int src) +trySetString(setting_t * setting, char *newVal, int src) { - if (svValue[which] != NULL) + if (setting->value != NULL) { - if (svSrc[which] == src) + if (setting->src == src) { VMSG2(0, "Warning! More than one %s from %s\n", - svName[which], srcName[src]); + setting->name, srcName[src]); VMSG2(0, " Using \"%s\", ignoring \"%s\"\n", - svValue[which], newVal); + setting->value, newVal); return; } - else if (svSrc[which] > src) + else if (setting->src > src) { - VMSG1(5, "Warning! Multiple definitions of %s\n", svName[which]); + VMSG1(5, "Warning! Multiple definitions of %s\n", setting->name); VMSG2(5, " Using %s, ignoring %s\n", - srcName[svSrc[which]], srcName[src]); + srcName[setting->src], srcName[src]); return; } } - svSrc[which] = src; - svValue[which] = newVal; + setting->src = src; + setting->value = newVal; return; } Bool -setOptString(int *arg, int argc, char **argv, int which, int src) +setOptString(int *arg, int argc, char **argv, setting_t * setting, int src) { int ndx; char *opt; @@ -334,31 +339,31 @@ setOptString(int *arg, int argc, char **argv, int which, int src) opt = argv[ndx]; if (ndx >= argc - 1) { - VMSG1(0, "No %s specified on the command line\n", svName[which]); + VMSG1(0, "No %s specified on the command line\n", setting->name); VMSG1(0, "Trailing %s option ignored\n", opt); return True; } ndx++; *arg = ndx; - if (svValue[which] != NULL) + if (setting->value != NULL) { - if (svSrc[which] == src) + if (setting->src == src) { - VMSG2(0, "More than one %s on %s\n", svName[which], srcName[src]); - VMSG2(0, "Using \"%s\", ignoring \"%s\"\n", svValue[which], + VMSG2(0, "More than one %s on %s\n", setting->name, srcName[src]); + VMSG2(0, "Using \"%s\", ignoring \"%s\"\n", setting->value, argv[ndx]); return True; } - else if (svSrc[which] > src) + else if (setting->src > src) { - VMSG1(5, "Multiple definitions of %s\n", svName[which]); - VMSG2(5, "Using %s, ignoring %s\n", srcName[svSrc[which]], + VMSG1(5, "Multiple definitions of %s\n", setting->name); + VMSG2(5, "Using %s, ignoring %s\n", srcName[setting->src], srcName[src]); return True; } } - svSrc[which] = src; - svValue[which] = argv[ndx]; + setting->src = src; + setting->value = argv[ndx]; return True; } @@ -385,17 +390,17 @@ parseArgs(int argc, char **argv) { /* Allow a call like "setxkbmap us" to work. Layout is default, if -layout is given, then try parsing variant, then options */ - if (!svSrc[LAYOUT_NDX]) - trySetString(LAYOUT_NDX, argv[i], FROM_CMD_LINE); - else if (!svSrc[VARIANT_NDX]) - trySetString(VARIANT_NDX, argv[i], FROM_CMD_LINE); + if (!settings.layout.src) + trySetString(&settings.layout, argv[i], FROM_CMD_LINE); + else if (!settings.variant.src) + trySetString(&settings.variant, argv[i], FROM_CMD_LINE); else ok = addToList(&szOptions, &numOptions, &options, argv[i]); } else if (streq(argv[i], "-compat")) - ok = setOptString(&i, argc, argv, COMPAT_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.compat, FROM_CMD_LINE); else if (streq(argv[i], "-config")) - ok = setOptString(&i, argc, argv, CONFIG_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.config, FROM_CMD_LINE); else if (streq(argv[i], "-device")) { if ( ++i < argc ) { @@ -406,9 +411,9 @@ parseArgs(int argc, char **argv) } } else if (streq(argv[i], "-display")) - ok = setOptString(&i, argc, argv, DISPLAY_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.display, FROM_CMD_LINE); else if (streq(argv[i], "-geometry")) - ok = setOptString(&i, argc, argv, GEOMETRY_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.geometry, FROM_CMD_LINE); else if (streq(argv[i], "-help") || streq(argv[i], "-?")) { usage(argc, argv); @@ -425,13 +430,13 @@ parseArgs(int argc, char **argv) else if (strpfx(argv[i], "-I")) /* no space between -I and path */ ok = addToList(&szInclPath, &numInclPath, &inclPath, &argv[i][2]); else if (streq(argv[i], "-keycodes")) - ok = setOptString(&i, argc, argv, KEYCODES_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.keycodes, FROM_CMD_LINE); else if (streq(argv[i], "-keymap")) - ok = setOptString(&i, argc, argv, KEYMAP_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.keymap, FROM_CMD_LINE); else if (streq(argv[i], "-layout")) - ok = setOptString(&i, argc, argv, LAYOUT_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.layout, FROM_CMD_LINE); else if (streq(argv[i], "-model")) - ok = setOptString(&i, argc, argv, MODEL_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.model, FROM_CMD_LINE); else if (streq(argv[i], "-option")) { if ((i == argc - 1) || (argv[i + 1][0] == '\0') @@ -452,13 +457,13 @@ parseArgs(int argc, char **argv) else if (streq(argv[i], "-query")) query = True; else if (streq(argv[i], "-rules")) - ok = setOptString(&i, argc, argv, RULES_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.rules, FROM_CMD_LINE); else if (streq(argv[i], "-symbols")) - ok = setOptString(&i, argc, argv, SYMBOLS_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.symbols, FROM_CMD_LINE); else if (streq(argv[i], "-synch")) synch = True; else if (streq(argv[i], "-types")) - ok = setOptString(&i, argc, argv, TYPES_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.types, FROM_CMD_LINE); else if (streq(argv[i], "-verbose") || (streq(argv[i], "-v"))) { if ((i < argc - 1) && (isdigit(argv[i + 1][0]))) @@ -478,7 +483,7 @@ parseArgs(int argc, char **argv) VMSG1(7, "Setting verbose level to %d\n", verbose); } else if (streq(argv[i], "-variant")) - ok = setOptString(&i, argc, argv, VARIANT_NDX, FROM_CMD_LINE); + ok = setOptString(&i, argc, argv, &settings.variant, FROM_CMD_LINE); else { ERR1("Error! Option \"%s\" not recognized\n", argv[i]); @@ -487,25 +492,25 @@ parseArgs(int argc, char **argv) } present = 0; - if (svValue[TYPES_NDX]) + if (settings.types.value) present++; - if (svValue[COMPAT_NDX]) + if (settings.compat.value) present++; - if (svValue[SYMBOLS_NDX]) + if (settings.symbols.value) present++; - if (svValue[KEYCODES_NDX]) + if (settings.keycodes.value) present++; - if (svValue[GEOMETRY_NDX]) + if (settings.geometry.value) present++; - if (svValue[CONFIG_NDX]) + if (settings.config.value) present++; - if (svValue[MODEL_NDX]) + if (settings.model.value) present++; - if (svValue[LAYOUT_NDX]) + if (settings.layout.value) present++; - if (svValue[VARIANT_NDX]) + if (settings.variant.value) present++; - if (svValue[KEYMAP_NDX] && present) + if (settings.keymap.value && present) { ERR("No other components can be specified when a keymap is present\n"); return False; @@ -526,14 +531,14 @@ getDisplay(int argc, char **argv) major = XkbMajorVersion; minor = XkbMinorVersion; dpy = - XkbOpenDisplay(svValue[DISPLAY_NDX], NULL, NULL, &major, &minor, + XkbOpenDisplay(settings.display.value, NULL, NULL, &major, &minor, &why); if (!dpy) { - if (svValue[DISPLAY_NDX] == NULL) - svValue[DISPLAY_NDX] = getenv("DISPLAY"); - if (svValue[DISPLAY_NDX] == NULL) - svValue[DISPLAY_NDX] = "default display"; + if (settings.display.value == NULL) + settings.display.value = getenv("DISPLAY"); + if (settings.display.value == NULL) + settings.display.value = "default display"; switch (why) { case XkbOD_BadLibraryVersion: @@ -543,16 +548,16 @@ getDisplay(int argc, char **argv) major, minor); break; case XkbOD_ConnectionRefused: - ERR1("Cannot open display \"%s\"\n", svValue[DISPLAY_NDX]); + ERR1("Cannot open display \"%s\"\n", settings.display.value); break; case XkbOD_NonXkbServer: - ERR1("XKB extension not present on %s\n", svValue[DISPLAY_NDX]); + ERR1("XKB extension not present on %s\n", settings.display.value); break; case XkbOD_BadServerVersion: ERR3("%s was compiled with XKB version %d.%02d\n", argv[0], XkbMajorVersion, XkbMinorVersion); ERR3("Server %s uses incompatible version %d.%02d\n", - svValue[DISPLAY_NDX], major, minor); + settings.display.value, major, minor); break; default: ERR1("Unknown error %d from XkbOpenDisplay\n", why); @@ -592,13 +597,13 @@ getServerValues(void) tmp, vd.model, vd.layout); } if (tmp) - trySetString(RULES_NDX, tmp, FROM_SERVER); + trySetString(&settings.rules, tmp, FROM_SERVER); if (vd.model) - trySetString(MODEL_NDX, vd.model, FROM_SERVER); + trySetString(&settings.model, vd.model, FROM_SERVER); if (vd.layout) - trySetString(LAYOUT_NDX, vd.layout, FROM_SERVER); + trySetString(&settings.layout, vd.layout, FROM_SERVER); if (vd.variant) - trySetString(VARIANT_NDX, vd.variant, FROM_SERVER); + trySetString(&settings.variant, vd.variant, FROM_SERVER); if ((vd.options) && (!clearOptions)) { addStringToOptions(vd.options, &szOptions, &numOptions, &options); @@ -738,22 +743,22 @@ applyConfig(char *name) } if (cfgResult.rules_file) { - trySetString(RULES_NDX, cfgResult.rules_file, FROM_CONFIG); + trySetString(&settings.rules, cfgResult.rules_file, FROM_CONFIG); cfgResult.rules_file = NULL; } if (cfgResult.model) { - trySetString(MODEL_NDX, cfgResult.model, FROM_CONFIG); + trySetString(&settings.model, cfgResult.model, FROM_CONFIG); cfgResult.model = NULL; } if (cfgResult.layout) { - trySetString(LAYOUT_NDX, cfgResult.layout, FROM_CONFIG); + trySetString(&settings.layout, cfgResult.layout, FROM_CONFIG); cfgResult.layout = NULL; } if (cfgResult.variant) { - trySetString(VARIANT_NDX, cfgResult.variant, FROM_CONFIG); + trySetString(&settings.variant, cfgResult.variant, FROM_CONFIG); cfgResult.variant = NULL; } if (cfgResult.options) @@ -764,32 +769,32 @@ applyConfig(char *name) } if (cfgResult.keymap) { - trySetString(KEYMAP_NDX, cfgResult.keymap, FROM_CONFIG); + trySetString(&settings.keymap, cfgResult.keymap, FROM_CONFIG); cfgResult.keymap = NULL; } if (cfgResult.keycodes) { - trySetString(KEYCODES_NDX, cfgResult.keycodes, FROM_CONFIG); + trySetString(&settings.keycodes, cfgResult.keycodes, FROM_CONFIG); cfgResult.keycodes = NULL; } if (cfgResult.geometry) { - trySetString(GEOMETRY_NDX, cfgResult.geometry, FROM_CONFIG); + trySetString(&settings.geometry, cfgResult.geometry, FROM_CONFIG); cfgResult.geometry = NULL; } if (cfgResult.symbols) { - trySetString(SYMBOLS_NDX, cfgResult.symbols, FROM_CONFIG); + trySetString(&settings.symbols, cfgResult.symbols, FROM_CONFIG); cfgResult.symbols = NULL; } if (cfgResult.types) { - trySetString(TYPES_NDX, cfgResult.types, FROM_CONFIG); + trySetString(&settings.types, cfgResult.types, FROM_CONFIG); cfgResult.types = NULL; } if (cfgResult.compat) { - trySetString(COMPAT_NDX, cfgResult.compat, FROM_CONFIG); + trySetString(&settings.compat, cfgResult.compat, FROM_CONFIG); cfgResult.compat = NULL; } if (verbose > 5) @@ -812,30 +817,30 @@ applyRules(void) int i; char *rfName; - if (svSrc[MODEL_NDX] || svSrc[LAYOUT_NDX] || svSrc[VARIANT_NDX] + if (settings.model.src || settings.layout.src || settings.variant.src || options) { char buf[PATH_MAX]; XkbComponentNamesRec rnames; - if (svSrc[VARIANT_NDX] < svSrc[LAYOUT_NDX]) - svValue[VARIANT_NDX] = NULL; + if (settings.variant.src < settings.layout.src) + settings.variant.value = NULL; - rdefs.model = svValue[MODEL_NDX]; - rdefs.layout = svValue[LAYOUT_NDX]; - rdefs.variant = svValue[VARIANT_NDX]; + rdefs.model = settings.model.value; + rdefs.layout = settings.layout.value; + rdefs.variant = settings.variant.value; if (options) rdefs.options = stringFromOptions(rdefs.options, numOptions, options); - if (svSrc[RULES_NDX]) - rfName = svValue[RULES_NDX]; + if (settings.rules.src) + rfName = settings.rules.value; else rfName = DFLT_XKB_RULES_FILE; if (rfName[0] == '/') { - rules = XkbRF_Load(rfName, svValue[LOCALE_NDX], True, True); + rules = XkbRF_Load(rfName, settings.locale.value, True, True); } else { @@ -850,7 +855,7 @@ applyRules(void) inclPath[i], rfName); continue; } - rules = XkbRF_Load(buf, svValue[LOCALE_NDX], True, True); + rules = XkbRF_Load(buf, settings.locale.value, True, True); } } if (!rules) @@ -863,32 +868,32 @@ applyRules(void) XkbRF_GetComponents(rules, &rdefs, &rnames); if (rnames.keycodes) { - trySetString(KEYCODES_NDX, rnames.keycodes, FROM_RULES); + trySetString(&settings.keycodes, rnames.keycodes, FROM_RULES); rnames.keycodes = NULL; } if (rnames.symbols) { - trySetString(SYMBOLS_NDX, rnames.symbols, FROM_RULES); + trySetString(&settings.symbols, rnames.symbols, FROM_RULES); rnames.symbols = NULL; } if (rnames.types) { - trySetString(TYPES_NDX, rnames.types, FROM_RULES); + trySetString(&settings.types, rnames.types, FROM_RULES); rnames.types = NULL; } if (rnames.compat) { - trySetString(COMPAT_NDX, rnames.compat, FROM_RULES); + trySetString(&settings.compat, rnames.compat, FROM_RULES); rnames.compat = NULL; } if (rnames.geometry) { - trySetString(GEOMETRY_NDX, rnames.geometry, FROM_RULES); + trySetString(&settings.geometry, rnames.geometry, FROM_RULES); rnames.geometry = NULL; } if (rnames.keymap) { - trySetString(KEYMAP_NDX, rnames.keymap, FROM_RULES); + trySetString(&settings.keymap, rnames.keymap, FROM_RULES); rnames.keymap = NULL; } if (verbose > 6) @@ -962,33 +967,33 @@ void printKeymap(void) { MSG("xkb_keymap {\n"); - if (svValue[KEYCODES_NDX]) - MSG1("\txkb_keycodes { include \"%s\"\t};\n", svValue[KEYCODES_NDX]); - if (svValue[TYPES_NDX]) - MSG1("\txkb_types { include \"%s\"\t};\n", svValue[TYPES_NDX]); - if (svValue[COMPAT_NDX]) - MSG1("\txkb_compat { include \"%s\"\t};\n", svValue[COMPAT_NDX]); - if (svValue[SYMBOLS_NDX]) - MSG1("\txkb_symbols { include \"%s\"\t};\n", svValue[SYMBOLS_NDX]); - if (svValue[GEOMETRY_NDX]) - MSG1("\txkb_geometry { include \"%s\"\t};\n", svValue[GEOMETRY_NDX]); + if (settings.keycodes.value) + MSG1("\txkb_keycodes { include \"%s\"\t};\n", settings.keycodes.value); + if (settings.types.value) + MSG1("\txkb_types { include \"%s\"\t};\n", settings.types.value); + if (settings.compat.value) + MSG1("\txkb_compat { include \"%s\"\t};\n", settings.compat.value); + if (settings.symbols.value) + MSG1("\txkb_symbols { include \"%s\"\t};\n", settings.symbols.value); + if (settings.geometry.value) + MSG1("\txkb_geometry { include \"%s\"\t};\n", settings.geometry.value); MSG("};\n"); } Bool applyComponentNames(void) { - if (!checkName(svValue[TYPES_NDX], "types")) + if (!checkName(settings.types.value, "types")) return False; - if (!checkName(svValue[COMPAT_NDX], "compat")) + if (!checkName(settings.compat.value, "compat")) return False; - if (!checkName(svValue[SYMBOLS_NDX], "symbols")) + if (!checkName(settings.symbols.value, "symbols")) return False; - if (!checkName(svValue[KEYCODES_NDX], "keycodes")) + if (!checkName(settings.keycodes.value, "keycodes")) return False; - if (!checkName(svValue[GEOMETRY_NDX], "geometry")) + if (!checkName(settings.geometry.value, "geometry")) return False; - if (!checkName(svValue[KEYMAP_NDX], "keymap")) + if (!checkName(settings.keymap.value, "keymap")) return False; if (verbose > 5) @@ -1000,12 +1005,12 @@ applyComponentNames(void) if (dpy && !print && !query) { XkbComponentNamesRec cmdNames; - cmdNames.types = svValue[TYPES_NDX]; - cmdNames.compat = svValue[COMPAT_NDX]; - cmdNames.symbols = svValue[SYMBOLS_NDX]; - cmdNames.keycodes = svValue[KEYCODES_NDX]; - cmdNames.geometry = svValue[GEOMETRY_NDX]; - cmdNames.keymap = svValue[KEYMAP_NDX]; + cmdNames.types = settings.types.value; + cmdNames.compat = settings.compat.value; + cmdNames.symbols = settings.symbols.value; + cmdNames.keycodes = settings.keycodes.value; + cmdNames.geometry = settings.geometry.value; + cmdNames.keymap = settings.keymap.value; xkb = XkbGetKeyboardByName(dpy, deviceSpec, &cmdNames, XkbGBN_AllComponentsMask, XkbGBN_AllComponentsMask & @@ -1016,9 +1021,9 @@ applyComponentNames(void) return False; } /* update the XKB root property */ - if (svValue[RULES_NDX] && (rdefs.model || rdefs.layout)) + if (settings.rules.value && (rdefs.model || rdefs.layout)) { - if (!XkbRF_SetNamesProp(dpy, svValue[RULES_NDX], &rdefs)) + if (!XkbRF_SetNamesProp(dpy, settings.rules.value, &rdefs)) { VMSG(0, "Error updating the XKB names property\n"); } @@ -1041,12 +1046,12 @@ main(int argc, char **argv) { if ((!parseArgs(argc, argv)) || (!getDisplay(argc, argv))) exit(-1); - svValue[LOCALE_NDX] = setlocale(LC_ALL, svValue[LOCALE_NDX]); - svSrc[LOCALE_NDX] = FROM_SERVER; - VMSG1(7, "locale is %s\n", svValue[LOCALE_NDX]); + settings.locale.value = setlocale(LC_ALL, settings.locale.value); + settings.locale.src = FROM_SERVER; + VMSG1(7, "locale is %s\n", settings.locale.value); if (dpy) getServerValues(); - if (svValue[CONFIG_NDX] && (!applyConfig(svValue[CONFIG_NDX]))) + if (settings.config.value && (!applyConfig(settings.config.value))) exit(-3); if (!applyRules()) exit(-4); |