This patch introduces convenient command-line options -xkbrules, -xkbmodel, -xkblayout, -xkbvariant, and -xkboptions, to set default values for these properties.
These options can be handful in cases where corresponding values can't be taken from devices' udev properties, and compile-time default values don't match user locale. Signed-off-by: Laércio de Sousa <laercioso...@sme-mogidascruzes.sp.gov.br> --- hw/kdrive/src/kdrive.c | 40 ++++++++++++++++++++++++++++++++++++++++ hw/kdrive/src/kinput.c | 16 +++++++++++----- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 40aea9a..5c7243d 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -83,6 +83,11 @@ DDXPointRec kdOrigin; Bool kdHasPointer = FALSE; Bool kdHasKbd = FALSE; Bool kdEnableInputHotplugging = FALSE; +const char *kdGlobalXkbRules = NULL; +const char *kdGlobalXkbModel = NULL; +const char *kdGlobalXkbLayout = NULL; +const char *kdGlobalXkbVariant = NULL; +const char *kdGlobalXkbOptions = NULL; static Bool kdCaughtSignal = FALSE; @@ -451,6 +456,11 @@ KdUseMsg(void) ("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n"); ErrorF ("-keybd driver [,,options] Specify the keyboard driver and its options\n"); + ErrorF("-xkbrules Set default XkbRules value (can be overriden by -keybd options)\n"); + ErrorF("-xkbmodel Set default XkbModel value (can be overriden by -keybd options)\n"); + ErrorF("-xkblayout Set default XkbLayout value (can be overriden by -keybd options)\n"); + ErrorF("-xkbvariant Set default XkbVariant value (can be overriden by -keybd options)\n"); + ErrorF("-xkboptions Set default XkbOptions value (can be overriden by -keybd options)\n"); ErrorF("-zaphod Disable cursor screen switching\n"); ErrorF("-2button Emulate 3 button mouse\n"); ErrorF("-3button Disable 3 button mouse emulation\n"); @@ -563,6 +573,36 @@ KdProcessArgument(int argc, char **argv, int i) kdEnableInputHotplugging = TRUE; return 1; } + if (!strcmp(argv[i], "-xkbrules")) { + if (i + 1 >= argc) + UseMsg(); + kdGlobalXkbRules = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkbmodel")) { + if (i + 1 >= argc) + UseMsg(); + kdGlobalXkbModel = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkblayout")) { + if (i + 1 >= argc) + UseMsg(); + kdGlobalXkbLayout = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkbvariant")) { + if (i + 1 >= argc) + UseMsg(); + kdGlobalXkbVariant = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-xkboptions")) { + if (i + 1 >= argc) + UseMsg(); + kdGlobalXkbOptions = argv[i + 1]; + return 2; + } if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) { if (i + 1 >= argc) UseMsg(); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 4960bc0..c03c9de 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -100,6 +100,12 @@ static int kdNumInputFds; extern Bool kdRawPointerCoordinates; extern Bool kdEnableInputHotplugging; +extern const char *kdGlobalXkbRules; +extern const char *kdGlobalXkbModel; +extern const char *kdGlobalXkbLayout; +extern const char *kdGlobalXkbVariant; +extern const char *kdGlobalXkbOptions; + static void KdSigio(int sig) { @@ -918,11 +924,11 @@ KdNewKeyboard(void) ki->options = NULL; ki->name = strdup("Generic Keyboard"); ki->path = NULL; - ki->xkbRules = strdup(XKB_DFLT_RULES); - ki->xkbModel = strdup(XKB_DFLT_MODEL); - ki->xkbLayout = strdup(XKB_DFLT_LAYOUT); - ki->xkbVariant = strdup(XKB_DFLT_VARIANT); - ki->xkbOptions = strdup(XKB_DFLT_OPTIONS); + ki->xkbRules = strdup(kdGlobalXkbRules ? kdGlobalXkbRules : XKB_DFLT_RULES); + ki->xkbModel = strdup(kdGlobalXkbModel ? kdGlobalXkbModel : XKB_DFLT_MODEL); + ki->xkbLayout = strdup(kdGlobalXkbLayout ? kdGlobalXkbLayout : XKB_DFLT_LAYOUT); + ki->xkbVariant = strdup(kdGlobalXkbVariant ? kdGlobalXkbVariant :XKB_DFLT_VARIANT); + ki->xkbOptions = strdup(kdGlobalXkbOptions ? kdGlobalXkbOptions : XKB_DFLT_OPTIONS); return ki; } -- 2.2.0 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel