summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-01-07 09:14:42 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-01-08 15:07:03 +1000
commitf2d2b65343a902c5eedaf50b6f6bcb5ba1ef9c4a (patch)
treee7f0c88076dcb91163aeb3b19f8ae186d24bf3aa
parent0d6c6b59c153cb53b53d6860387b4fe40d245628 (diff)
Localise XKB initialization
No need to store this in the evdev struct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c42
-rw-r--r--src/evdev.h3
2 files changed, 21 insertions, 24 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 619bce6..c4d12a3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1171,32 +1171,34 @@ EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
static int
EvdevAddKeyClass(DeviceIntPtr device)
{
+ int rc = Success;
+ XkbRMLVOSet rmlvo = {0};
InputInfoPtr pInfo;
- EvdevPtr pEvdev;
pInfo = device->public.devicePrivate;
- pEvdev = pInfo->private;
/* sorry, no rules change allowed for you */
xf86ReplaceStrOption(pInfo->options, "xkb_rules", "evdev");
- SetXkbOption(pInfo, "xkb_rules", &pEvdev->rmlvo.rules);
- SetXkbOption(pInfo, "xkb_model", &pEvdev->rmlvo.model);
- if (!pEvdev->rmlvo.model)
- SetXkbOption(pInfo, "XkbModel", &pEvdev->rmlvo.model);
- SetXkbOption(pInfo, "xkb_layout", &pEvdev->rmlvo.layout);
- if (!pEvdev->rmlvo.layout)
- SetXkbOption(pInfo, "XkbLayout", &pEvdev->rmlvo.layout);
- SetXkbOption(pInfo, "xkb_variant", &pEvdev->rmlvo.variant);
- if (!pEvdev->rmlvo.variant)
- SetXkbOption(pInfo, "XkbVariant", &pEvdev->rmlvo.variant);
- SetXkbOption(pInfo, "xkb_options", &pEvdev->rmlvo.options);
- if (!pEvdev->rmlvo.options)
- SetXkbOption(pInfo, "XkbOptions", &pEvdev->rmlvo.options);
-
- if (!InitKeyboardDeviceStruct(device, &pEvdev->rmlvo, NULL, EvdevKbdCtrl))
- return !Success;
+ SetXkbOption(pInfo, "xkb_rules", &rmlvo.rules);
+ SetXkbOption(pInfo, "xkb_model", &rmlvo.model);
+ if (!rmlvo.model)
+ SetXkbOption(pInfo, "XkbModel", &rmlvo.model);
+ SetXkbOption(pInfo, "xkb_layout", &rmlvo.layout);
+ if (!rmlvo.layout)
+ SetXkbOption(pInfo, "XkbLayout", &rmlvo.layout);
+ SetXkbOption(pInfo, "xkb_variant", &rmlvo.variant);
+ if (!rmlvo.variant)
+ SetXkbOption(pInfo, "XkbVariant", &rmlvo.variant);
+ SetXkbOption(pInfo, "xkb_options", &rmlvo.options);
+ if (!rmlvo.options)
+ SetXkbOption(pInfo, "XkbOptions", &rmlvo.options);
+
+ if (!InitKeyboardDeviceStruct(device, &rmlvo, NULL, EvdevKbdCtrl))
+ rc = !Success;
+
+ XkbFreeRMLVOSet(&rmlvo, FALSE);
- return Success;
+ return rc;
}
#ifdef MULTITOUCH
@@ -2463,8 +2465,6 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
EvdevPtr pEvdev = pInfo ? pInfo->private : NULL;
if (pEvdev)
{
- /* Release strings allocated in EvdevAddKeyClass. */
- XkbFreeRMLVOSet(&pEvdev->rmlvo, FALSE);
/* Release string allocated in EvdevOpenDevice. */
free(pEvdev->device);
pEvdev->device = NULL;
diff --git a/src/evdev.h b/src/evdev.h
index 2901886..51b7fa0 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -181,9 +181,6 @@ typedef struct {
int delta[REL_CNT];
unsigned int abs_queued, rel_queued, prox_queued;
- /* XKB stuff has to be per-device rather than per-driver */
- XkbRMLVOSet rmlvo;
-
/* Middle mouse button emulation */
struct {
BOOL enabled;