xorg-x11-server/U_kdrive-add-options-to-set-default-XKB-properties.patch
Egbert Eich 7aff496244 Accepting request 367497 from home:lbssousa:branches:X11:XOrg
- Backport upstream patches for Xephyr input hot-plugging /
  single-GPU multi-seat support:
    * U_kdrive-fix-up-NewInputDeviceRequest-implementation.patch
    * U_kdrive-set-evdev-driver-for-input-devices-automatica.patch
    * U_ephyr-don-t-load-ephyr-input-driver-if-seat-option-i.patch
    * U_kdrive-don-t-let-evdev-driver-overwrite-existing-dev.patch
    * U_ephyr-ignore-Xorg-multiseat-command-line-options.patch
    * U_ephyr-enable-option-sw-cursor-by-default-in-multi-se.patch
    * U_kdrive-introduce-input-hot-plugging-support-for-udev.patch
    * U_kdrive-add-options-to-set-default-XKB-properties.patch
    * U_kdrive-evdev-update-keyboard-LEDs-22302.patch
    * U_config-udev-distinguish-between-real-keyboards-and-o.patch

OBS-URL: https://build.opensuse.org/request/show/367497
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=616
2016-03-07 11:29:08 +00:00

139 lines
5.3 KiB
Diff

From 40e32e9fc9f3a1bd8287ee03dd399d8161cb98dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?=
<laerciosousa@sme-mogidascruzes.sp.gov.br>
Date: Fri, 12 Feb 2016 14:18:00 -0200
Subject: [PATCH 54/56] kdrive: add options to set default XKB properties
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch introduces convenient command-line options -xkb-rules,
-xkb-model, -xkb-layout, -xkb-variant, and -xkb-options, to set default
values for these properties.
These options can be handful for cases in which compile-time default
values don't match user locale, since kdrive doesn't support InputClass
matching rules yet and not all Linux distros provide default rules to
store these values in udev properties (which by the way is a discouraged
practice).
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
---
hw/kdrive/src/kdrive.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
hw/kdrive/src/kinput.c | 16 +++++++++++-----
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 269b609..52bea5a 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -89,6 +89,11 @@ char *kdSwitchCmd;
DDXPointRec kdOrigin;
Bool kdHasPointer = FALSE;
Bool kdHasKbd = 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;
@@ -455,6 +460,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("-xkb-rules Set default XkbRules value (can be overriden by -keybd options)\n");
+ ErrorF("-xkb-model Set default XkbModel value (can be overriden by -keybd options)\n");
+ ErrorF("-xkb-layout Set default XkbLayout value (can be overriden by -keybd options)\n");
+ ErrorF("-xkb-variant Set default XkbVariant value (can be overriden by -keybd options)\n");
+ ErrorF("-xkb-options 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,46 @@ KdProcessArgument(int argc, char **argv, int i)
sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) {
return 1;
}
+ if (!strcmp(argv[i], "-xkb-rules")) {
+ if (i + 1 >= argc) {
+ UseMsg();
+ FatalError("Missing argument for option -xkb-rules.\n");
+ }
+ kdGlobalXkbRules = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-xkb-model")) {
+ if (i + 1 >= argc) {
+ UseMsg();
+ FatalError("Missing argument for option -xkb-model.\n");
+ }
+ kdGlobalXkbModel = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-xkb-layout")) {
+ if (i + 1 >= argc) {
+ UseMsg();
+ FatalError("Missing argument for option -xkb-layout.\n");
+ }
+ kdGlobalXkbLayout = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-xkb-variant")) {
+ if (i + 1 >= argc) {
+ UseMsg();
+ FatalError("Missing argument for option -xkb-variant.\n");
+ }
+ kdGlobalXkbVariant = argv[i + 1];
+ return 2;
+ }
+ if (!strcmp(argv[i], "-xkb-options")) {
+ if (i + 1 >= argc) {
+ UseMsg();
+ FatalError("Missing argument for option -xkb-options.\n");
+ }
+ 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 fd6a952..836db79 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -102,6 +102,12 @@ static int kdNumInputFds;
extern Bool kdRawPointerCoordinates;
+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)
{
@@ -909,11 +915,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.6.2