add xkb some settings (rules, model, layout, variant, options) to the

commandline options and parse them even with configfile support is
    turned off
This commit is contained in:
Alexander Gottwald 2004-02-16 01:22:13 +00:00
parent c56096266e
commit c4045f54e2
3 changed files with 128 additions and 10 deletions

View file

@ -64,6 +64,11 @@ WinCmdlineRec g_cmdline = {
#ifdef XKB
FALSE, /* noXkbExtension */
NULL, /* xkbMap */
NULL, /* xkbRules */
NULL, /* xkbModel */
NULL, /* xkbLayout */
NULL, /* xkbVariant */
NULL, /* xkbOptions */
#endif
NULL, /* screenname */
NULL, /* mousename */
@ -429,34 +434,84 @@ winConfigKeyboard (DeviceIntPtr pDevice)
}
else
{
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL)))
if (g_cmdline.xkbRules)
{
s = g_cmdline.xkbRules;
from = X_CMDLINE;
}
else
{
s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL);
from = X_CONFIG;
}
if (s)
{
g_winInfo.xkb.rules = NULL_IF_EMPTY (s);
winMsg (X_CONFIG, "XKB: rules: \"%s\"\n", s);
winMsg (from, "XKB: rules: \"%s\"\n", s);
}
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL)))
if (g_cmdline.xkbModel)
{
s = g_cmdline.xkbModel;
from = X_CMDLINE;
}
else
{
s = winSetStrOption (kbd->inp_option_lst, "XkbModel", NULL);
from = X_CONFIG;
}
if (s)
{
g_winInfo.xkb.model = NULL_IF_EMPTY (s);
winMsg (X_CONFIG, "XKB: model: \"%s\"\n", s);
winMsg (from, "XKB: model: \"%s\"\n", s);
}
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL)))
if (g_cmdline.xkbLayout)
{
s = g_cmdline.xkbLayout;
from = X_CMDLINE;
}
else
{
s = winSetStrOption (kbd->inp_option_lst, "XkbLayout", NULL);
from = X_CONFIG;
}
if (s)
{
g_winInfo.xkb.layout = NULL_IF_EMPTY (s);
winMsg (X_CONFIG, "XKB: layout: \"%s\"\n", s);
winMsg (from, "XKB: layout: \"%s\"\n", s);
}
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL)))
if (g_cmdline.xkbVariant)
{
s = g_cmdline.xkbVariant;
from = X_CMDLINE;
}
else
{
s = winSetStrOption (kbd->inp_option_lst, "XkbVariant", NULL);
from = X_CONFIG;
}
if (s)
{
g_winInfo.xkb.variant = NULL_IF_EMPTY (s);
winMsg (X_CONFIG, "XKB: variant: \"%s\"\n", s);
winMsg (from, "XKB: variant: \"%s\"\n", s);
}
if ((s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL)))
if (g_cmdline.xkbOptions)
{
s=g_cmdline.xkbOptions;
from = X_CMDLINE;
}
else
{
s = winSetStrOption (kbd->inp_option_lst, "XkbOptions", NULL);
from = X_CONFIG;
}
if (s)
{
g_winInfo.xkb.options = NULL_IF_EMPTY (s);
winMsg (X_CONFIG, "XKB: options: \"%s\"\n", s);
winMsg (from, "XKB: options: \"%s\"\n", s);
}
from = X_CMDLINE;
@ -526,6 +581,32 @@ winConfigKeyboard (DeviceIntPtr pDevice)
}
#endif
}
#else
if (g_cmdline.xkbRules)
{
g_winInfo.xkb.rules = g_cmdline.xkbRules;
winMsg (X_CMDLINE, "XKB: rules: \"%s\"\n", g_cmdline.xkbRules);
}
if (g_cmdline.xkbModel)
{
g_winInfo.xkb.model = g_cmdline.xkbModel;
winMsg (X_CMDLINE, "XKB: model: \"%s\"\n", g_cmdline.xkbModel);
}
if (g_cmdline.xkbLayout)
{
g_winInfo.xkb.layout = g_cmdline.xkbLayout;
winMsg (X_CMDLINE, "XKB: layout: \"%s\"\n", g_cmdline.xkbLayout);
}
if (g_cmdline.xkbVariant)
{
g_winInfo.xkb.variant = g_cmdline.xkbVariant;
winMsg (X_CMDLINE, "XKB: variant: \"%s\"\n", g_cmdline.xkbVariant);
}
if (g_cmdline.xkbOptions)
{
g_winInfo.xkb.options = g_cmdline.xkbOptions;
winMsg (X_CMDLINE, "XKB: options: \"%s\"\n", g_cmdline.xkbOptions);
}
#endif
return TRUE;

View file

@ -195,6 +195,12 @@ typedef struct
#ifdef XKB
Bool noXkbExtension;
char *xkbMap;
char *xkbRules;
char *xkbModel;
char *xkbLayout;
char *xkbVariant;
char *xkbOptions;
#endif
/* layout */
char *screenname;

View file

@ -1040,6 +1040,37 @@ ddxProcessArgument (int argc, char *argv[], int i)
g_cmdline.noXkbExtension = TRUE;
return 0; /* Let DIX parse this again */
}
if (IS_OPTION ("-xkbrules"))
{
CHECK_ARGS (1);
g_cmdline.xkbRules = argv[++i];
return 2;
}
if (IS_OPTION ("-xkbmodel"))
{
CHECK_ARGS (1);
g_cmdline.xkbModel = argv[++i];
return 2;
}
if (IS_OPTION ("-xkblayout"))
{
CHECK_ARGS (1);
g_cmdline.xkbLayout = argv[++i];
return 2;
}
if (IS_OPTION ("-xkbvariant"))
{
CHECK_ARGS (1);
g_cmdline.xkbVariant = argv[++i];
return 2;
}
if (IS_OPTION ("-xkboptions"))
{
CHECK_ARGS (1);
g_cmdline.xkbOptions = argv[++i];
return 2;
}
#endif
return 0;