summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-11-12 11:48:08 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-11-12 11:49:48 +1000
commitfa50670c32637faff6bb91f1206a0e3c17a9bada (patch)
tree8305c117fc145ac63898aeea41f3f379608cda44
parentc481dae0dc89d8d50cac23210023d75bfaf6012b (diff)
xfree86: rename allowEmptyInput to forceInputDevices.
This is a more accurate name for the actual functionality than allowEmptyInput. Historically, allowEmptyInput has allowed the server to start with no input devices. Since 1.4 and the introduction of VCP and VCK, there are always two input devices present. allowEmptyInput was changed in behaviour to essentially "ignore xorg.conf devices or not", auto-adding the built-in devices if disabled. Rename to forceInputDevices, because that's essentially what it does. When disabled (i.e. when hotplugging is enabled), it disables all mouse/kbd/vmmouse devices configured in the xorg.conf file. When enabled, it forces the traditional behaviour for input devices: - use input devices configured in the server layout - if none are configured, use the first pointer and the first keyboard device in the xorg.conf - if none are configured, create the default pointer/keyboard devices. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--hw/xfree86/common/xf86Config.c36
-rw-r--r--hw/xfree86/common/xf86Globals.c4
-rw-r--r--hw/xfree86/common/xf86Privstr.h3
3 files changed, 22 insertions, 21 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 568b2d684..a9e827ef6 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -951,12 +951,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
#endif
- /* AllowEmptyInput is automatically true if we're hotplugging */
- xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
+ /* if we're not hotplugging, force some input devices to exist */
+ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
- /* AEI on? Then we're not using kbd, so use the evdev rules set. */
+ /* when forcing input devices, we use kbd. otherwise evdev, so use the
+ * evdev rules set. */
#if defined(linux)
- if (xf86Info.allowEmptyInput)
+ if (!xf86Info.forceInputDevices)
set.rules = "evdev";
#endif
XkbSetRulesDflts(&set);
@@ -1173,7 +1174,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 3. First core pointer device. */
- if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) {
XF86ConfInputPtr p;
for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
@@ -1189,7 +1190,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First pointer with an allowed mouse driver. */
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
const char **driver = mousedrivers;
confInput = xf86findInput(CONF_IMPLICIT_POINTER,
xf86configptr->conf_input_lst);
@@ -1206,7 +1207,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 5. Built-in default. */
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
memset(&defPtr, 0, sizeof(defPtr));
defPtr.inp_identifier = strdup("<default pointer>");
defPtr.inp_driver = strdup("mouse");
@@ -1232,7 +1233,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
}
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
return FALSE;
@@ -1256,7 +1257,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
driver++;
}
}
- if (!found && !xf86Info.allowEmptyInput) {
+ if (!found && xf86Info.forceInputDevices) {
xf86Msg(X_INFO, "No default mouse found, adding one\n");
memset(&defPtr, 0, sizeof(defPtr));
defPtr.inp_identifier = strdup("<default pointer>");
@@ -1315,7 +1316,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 3. First core keyboard device. */
- if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) {
XF86ConfInputPtr p;
for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
@@ -1331,7 +1332,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
xf86configptr->conf_input_lst);
if (!confInput) {
@@ -1346,7 +1347,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 5. Built-in default. */
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
memset(&defKbd, 0, sizeof(defKbd));
defKbd.inp_identifier = strdup("<default keyboard>");
defKbd.inp_driver = strdup("kbd");
@@ -1372,7 +1373,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
}
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
return FALSE;
@@ -1398,7 +1399,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"\tUsing the %s.\n", keyboardMsg);
}
- if (xf86Info.allowEmptyInput && !(foundPointer && foundKeyboard)) {
+ if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV)
const char *config_backend;
#if defined(CONFIG_HAL)
@@ -2311,10 +2312,11 @@ static void
checkInput(serverLayoutPtr layout, Bool implicit_layout) {
checkCoreInputDevices(layout, implicit_layout);
- /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
- * exclusive. Trawl the list for mouse/kbd devices and disable them.
+ /* Unless we're forcing input devices, disable mouse/kbd devices in the
+ * config. Otherwise the same physical device is added multiple times,
+ * leading to duplicate events.
*/
- if (xf86Info.allowEmptyInput && layout->inputs)
+ if (!xf86Info.forceInputDevices && layout->inputs)
{
InputInfoPtr *dev = layout->inputs;
BOOL warned = FALSE;
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index dbe2a1d77..2c10005ca 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -128,11 +128,11 @@ xf86InfoRec xf86Info = {
.disableRandR = FALSE,
.randRFrom = X_DEFAULT,
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV)
- .allowEmptyInput = TRUE,
+ .forceInputDevices = FALSE,
.autoAddDevices = TRUE,
.autoEnableDevices = TRUE
#else
- .allowEmptyInput = FALSE,
+ .forceInputDevices = TRUE,
.autoAddDevices = FALSE,
.autoEnableDevices = FALSE
#endif
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index efe19e271..608f9bd19 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -107,8 +107,7 @@ typedef struct {
MessageType useDefaultFontPathFrom;
Bool ignoreABI;
- Bool allowEmptyInput; /* Allow the server to start with no input
- * devices. */
+ Bool forceInputDevices; /* force xorg.conf or built-in input devices */
Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
Bool autoEnableDevices; /* Whether to enable, or let the client
* control. */