Attempt to add the 'mouse' driver in more situations.

Always add a mouse driver instance configured to send core events, unless
a core pointer already exists using either the mouse or void drivers.  This
handles the laptop case where the config file only specifies, say,
synaptics, which causes the touchpad to work but not the pointing stick.
We don't double-instantiate the mouse driver to avoid the mouse moving twice
as fast, and we skip this logic when the user asked for a void core pointer
since that probably means they want to run with no pointer at all.
This commit is contained in:
Adam Jackson 2006-09-14 19:09:02 -04:00
parent 739224d05e
commit 43d9edd31e

View File

@ -1450,12 +1450,13 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
IDevPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
IDevPtr indp;
IDevPtr indp, i;
IDevRec Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
int count = 0;
MessageType from = X_DEFAULT;
int found = 0;
/*
* First check if a core pointer or core keyboard have been specified
@ -1607,6 +1608,35 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
return FALSE;
}
/*
* always synthesize a 'mouse' section configured to send core
* events, unless a 'void' section is found, in which case the user
* probably wants to run footless.
*/
for (i = servlayoutp->inputs; i->driver; i++) {
if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse")) {
found = 1; break;
}
}
if (!found) {
xf86Msg(X_INFO, "No default mouse found, adding one\n");
bzero(&defPtr, sizeof(defPtr));
defPtr.inp_identifier = "<default pointer>";
defPtr.inp_driver = "mouse";
confInput = &defPtr;
foundPointer = configInput(&Pointer, confInput, from);
if (foundPointer) {
count++;
indp = xnfrealloc(servlayoutp->inputs,
(count + 1) * sizeof(IDevRec));
indp[count - 1] = Pointer;
indp[count - 1].extraOptions =
xf86addNewOption(NULL, "AlwaysCore", NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
}
}
confInput = NULL;
/* 1. Check for the -keyboard command line option. */