xfree86: use NewInputDeviceRequest for xorg.conf devices too

Only use one init path for input devices - through NIDR.

This requires that inp_driver and inp_identifier from the
XF86ConfInputRec are copied over into the options for NIDR to see them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Peter Hutterer 2011-08-05 14:48:02 +10:00
parent 1ecc427a39
commit e4cd24e717
2 changed files with 9 additions and 28 deletions

View File

@ -1196,6 +1196,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
Pointer->options = xf86AddNewOption(Pointer->options,
"CorePointer", "on");
Pointer->options = xf86AddNewOption(Pointer->options,
"driver", confInput->inp_driver);
Pointer->options = xf86AddNewOption(Pointer->options,
"identifier", confInput->inp_identifier);
servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
}
}
@ -1286,6 +1290,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundKeyboard) {
Keyboard->options = xf86AddNewOption(Keyboard->options,
"CoreKeyboard", "on");
Keyboard->options = xf86AddNewOption(Keyboard->options,
"driver", confInput->inp_driver);
Keyboard->options = xf86AddNewOption(Keyboard->options,
"identifier", confInput->inp_identifier);
servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
}
}

View File

@ -811,21 +811,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
NULL);
}
static InputInfoPtr
duplicateDevice(InputInfoPtr pInfo)
{
InputInfoPtr dup = calloc(1, sizeof(InputInfoRec));
if (dup) {
dup->name = strdup(pInfo->name);
dup->driver = strdup(pInfo->driver);
dup->options = xf86OptionListDuplicate(pInfo->options);
/* type_name is a const string */
dup->type_name = pInfo->type_name;
dup->fd = -1;
}
return dup;
}
/**
* Initialize all supported input devices present and referenced in the
* xorg.conf.
@ -842,20 +827,8 @@ InitInput(int argc, char **argv)
/* Initialize all configured input devices */
for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) {
InputInfoPtr dup;
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pInfo)->driver, "keyboard")) {
strcpy((*pInfo)->driver, "kbd");
}
/* Data passed into xf86NewInputDevice will be freed on shutdown.
* Duplicate from xf86ConfigLayout.inputs, otherwise we don't have any
* xorg.conf input devices in the second generation
*/
dup = duplicateDevice(*pInfo);
/* If one fails, the others will too */
if (xf86NewInputDevice(dup, &dev, TRUE) == BadAlloc)
if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc)
break;
}