summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-14 16:57:29 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-17 10:03:40 +1000
commitb406886bbffadaa52864a99f2a0520999eadc15d (patch)
tree815537f8c64b5de361d9232b537f9e62c2f4b865
parent4e4e263bc073bf452f19c932b937c4881ae71f64 (diff)
input: allow NULL as XkbRMVLOSet in InitKeyboardDeviceStruct.
Virtually all callers use XkbGetRulesDefault(&rmlvo); InitKeyboardDeviceStruct(..., rmlvo); Let's save them the trouble and accept NULL as a hint to take the default RMLVO. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Benjamin Close <Benjamin.Close@clearchain.com> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--Xi/exevents.c13
-rw-r--r--dix/devices.c4
-rw-r--r--hw/vfb/InitInput.c4
-rw-r--r--hw/xnest/Keyboard.c9
-rw-r--r--hw/xquartz/quartzKeyboard.c4
-rw-r--r--xkb/xkbInit.c10
6 files changed, 16 insertions, 28 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 478866553..cfae57de1 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -226,11 +226,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
to->kbdfeed = classes->kbdfeed;
if (!to->kbdfeed)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- }
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
}
k = &to->kbdfeed;
@@ -473,11 +469,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
UnusedClassesPrivateKey);
to->key = classes->key;
if (!to->key)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- } else
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
+ else
classes->key = NULL;
}
diff --git a/dix/devices.c b/dix/devices.c
index b9d1c85a5..d14eddd72 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -471,12 +471,10 @@ CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
static int
CoreKeyboardProc(DeviceIntPtr pDev, int what)
{
- XkbRMLVOSet rmlvo;
switch (what) {
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
+ if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
CoreKeyboardCtl))
{
ErrorF("Keyboard initialization failed. This could be a missing "
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index aa902522a..4c8c99653 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -66,13 +66,11 @@ static int
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
{
DevicePtr pDev = (DevicePtr)pDevice;
- XkbRMLVOSet rmlvo;
switch (onoff)
{
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDevice, &rmlvo, NULL, NULL);
+ InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
break;
case DEVICE_ON:
pDev->on = TRUE;
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 8404c8bfa..f94e26079 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -121,7 +121,6 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
int i;
XKeyboardState values;
XkbDescPtr xkb;
- XkbRMLVOSet rmlvo;
int op, event, error, major, minor;
switch (onoff)
@@ -165,13 +164,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
}
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
- rmlvo.rules = XKB_DFLT_RULES;
- rmlvo.model = XKB_DFLT_MODEL;
- rmlvo.layout = XKB_DFLT_LAYOUT;
- rmlvo.variant = XKB_DFLT_VARIANT;
- rmlvo.options = XKB_DFLT_OPTIONS;
-
- InitKeyboardDeviceStruct(pDev, &rmlvo,
+ InitKeyboardDeviceStruct(pDev, NULL,
xnestBell, xnestChangeKeyboardControl);
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
XkbFreeKeyboard(xkb, 0, False);
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 823c2e67c..2b8cb13f8 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -317,7 +317,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
XkbComponentNamesRec names;
CFIndex value;
BOOL ok;
- XkbRMLVOSet rmlvo;
// Open a shared connection to the HID System.
// Note that the Event Status Driver is really just a wrapper
@@ -328,8 +327,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
bzero(&names, sizeof(names));
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDev, &rmlvo, QuartzBell,
+ InitKeyboardDeviceStruct(pDev, NULL, QuartzBell,
DarwinChangeKeyboardControl);
/* Get our key repeat settings from GlobalPreferences */
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 1f5f8dc49..2e7561294 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -474,10 +474,18 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbSrvLedInfoPtr sli;
XkbChangesRec changes;
XkbEventCauseRec cause;
+ XkbRMLVOSet rmlvo_dflts = { NULL };
- if (dev->key || dev->kbdfeed || !rmlvo)
+ if (dev->key || dev->kbdfeed)
return False;
+ if (!rmlvo)
+ {
+ rmlvo = &rmlvo_dflts;
+ XkbGetRulesDflts(rmlvo);
+ }
+
+
memset(&changes, 0, sizeof(changes));
XkbSetCauseUnknown(&cause);