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>
This commit is contained in:
parent
4e4e263bc0
commit
b406886bbf
|
@ -226,11 +226,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
|
||||||
|
|
||||||
to->kbdfeed = classes->kbdfeed;
|
to->kbdfeed = classes->kbdfeed;
|
||||||
if (!to->kbdfeed)
|
if (!to->kbdfeed)
|
||||||
{
|
InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
XkbGetRulesDflts(&rmlvo);
|
|
||||||
InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
k = &to->kbdfeed;
|
k = &to->kbdfeed;
|
||||||
|
@ -473,11 +469,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
|
||||||
UnusedClassesPrivateKey);
|
UnusedClassesPrivateKey);
|
||||||
to->key = classes->key;
|
to->key = classes->key;
|
||||||
if (!to->key)
|
if (!to->key)
|
||||||
{
|
InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
|
||||||
XkbRMLVOSet rmlvo;
|
else
|
||||||
XkbGetRulesDflts(&rmlvo);
|
|
||||||
InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
|
|
||||||
} else
|
|
||||||
classes->key = NULL;
|
classes->key = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -471,12 +471,10 @@ CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
|
||||||
static int
|
static int
|
||||||
CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
||||||
{
|
{
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
|
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case DEVICE_INIT:
|
case DEVICE_INIT:
|
||||||
XkbGetRulesDflts(&rmlvo);
|
if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
|
||||||
if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
|
|
||||||
CoreKeyboardCtl))
|
CoreKeyboardCtl))
|
||||||
{
|
{
|
||||||
ErrorF("Keyboard initialization failed. This could be a missing "
|
ErrorF("Keyboard initialization failed. This could be a missing "
|
||||||
|
|
|
@ -66,13 +66,11 @@ static int
|
||||||
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
|
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
|
||||||
{
|
{
|
||||||
DevicePtr pDev = (DevicePtr)pDevice;
|
DevicePtr pDev = (DevicePtr)pDevice;
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
|
|
||||||
switch (onoff)
|
switch (onoff)
|
||||||
{
|
{
|
||||||
case DEVICE_INIT:
|
case DEVICE_INIT:
|
||||||
XkbGetRulesDflts(&rmlvo);
|
InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
|
||||||
InitKeyboardDeviceStruct(pDevice, &rmlvo, NULL, NULL);
|
|
||||||
break;
|
break;
|
||||||
case DEVICE_ON:
|
case DEVICE_ON:
|
||||||
pDev->on = TRUE;
|
pDev->on = TRUE;
|
||||||
|
|
|
@ -121,7 +121,6 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
|
||||||
int i;
|
int i;
|
||||||
XKeyboardState values;
|
XKeyboardState values;
|
||||||
XkbDescPtr xkb;
|
XkbDescPtr xkb;
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
int op, event, error, major, minor;
|
int op, event, error, major, minor;
|
||||||
|
|
||||||
switch (onoff)
|
switch (onoff)
|
||||||
|
@ -165,13 +164,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
|
||||||
}
|
}
|
||||||
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
|
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
|
||||||
|
|
||||||
rmlvo.rules = XKB_DFLT_RULES;
|
InitKeyboardDeviceStruct(pDev, NULL,
|
||||||
rmlvo.model = XKB_DFLT_MODEL;
|
|
||||||
rmlvo.layout = XKB_DFLT_LAYOUT;
|
|
||||||
rmlvo.variant = XKB_DFLT_VARIANT;
|
|
||||||
rmlvo.options = XKB_DFLT_OPTIONS;
|
|
||||||
|
|
||||||
InitKeyboardDeviceStruct(pDev, &rmlvo,
|
|
||||||
xnestBell, xnestChangeKeyboardControl);
|
xnestBell, xnestChangeKeyboardControl);
|
||||||
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
|
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
|
||||||
XkbFreeKeyboard(xkb, 0, False);
|
XkbFreeKeyboard(xkb, 0, False);
|
||||||
|
|
|
@ -317,7 +317,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
|
||||||
XkbComponentNamesRec names;
|
XkbComponentNamesRec names;
|
||||||
CFIndex value;
|
CFIndex value;
|
||||||
BOOL ok;
|
BOOL ok;
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
|
|
||||||
// Open a shared connection to the HID System.
|
// Open a shared connection to the HID System.
|
||||||
// Note that the Event Status Driver is really just a wrapper
|
// Note that the Event Status Driver is really just a wrapper
|
||||||
|
@ -328,8 +327,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
|
||||||
|
|
||||||
bzero(&names, sizeof(names));
|
bzero(&names, sizeof(names));
|
||||||
|
|
||||||
XkbGetRulesDflts(&rmlvo);
|
InitKeyboardDeviceStruct(pDev, NULL, QuartzBell,
|
||||||
InitKeyboardDeviceStruct(pDev, &rmlvo, QuartzBell,
|
|
||||||
DarwinChangeKeyboardControl);
|
DarwinChangeKeyboardControl);
|
||||||
|
|
||||||
/* Get our key repeat settings from GlobalPreferences */
|
/* Get our key repeat settings from GlobalPreferences */
|
||||||
|
|
|
@ -474,10 +474,18 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
|
||||||
XkbSrvLedInfoPtr sli;
|
XkbSrvLedInfoPtr sli;
|
||||||
XkbChangesRec changes;
|
XkbChangesRec changes;
|
||||||
XkbEventCauseRec cause;
|
XkbEventCauseRec cause;
|
||||||
|
XkbRMLVOSet rmlvo_dflts = { NULL };
|
||||||
|
|
||||||
if (dev->key || dev->kbdfeed || !rmlvo)
|
if (dev->key || dev->kbdfeed)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
if (!rmlvo)
|
||||||
|
{
|
||||||
|
rmlvo = &rmlvo_dflts;
|
||||||
|
XkbGetRulesDflts(rmlvo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
memset(&changes, 0, sizeof(changes));
|
memset(&changes, 0, sizeof(changes));
|
||||||
XkbSetCauseUnknown(&cause);
|
XkbSetCauseUnknown(&cause);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue