aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86Config.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-15 16:51:22 +0000
committermarha <marha@users.sourceforge.net>2010-11-15 16:51:22 +0000
commitf586b49ae23c573681b939ca44b3f418c83c84b2 (patch)
treeffafe2da4517c5121ab4a8c64966e72829147215 /xorg-server/hw/xfree86/common/xf86Config.c
parent728ff03357b2dfd7048ab093183a239a0ba044c4 (diff)
parent3a82f8a35b2c6d094cf9d0d5a3ccb9dd9b85f626 (diff)
downloadvcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.tar.gz
vcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.tar.bz2
vcxsrv-f586b49ae23c573681b939ca44b3f418c83c84b2.zip
svn merge "^/branches/released" .
Solved mouse motion bug in new version of dix/getevents.c
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Config.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c147
1 files changed, 61 insertions, 86 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index faeda92ee..c0cba2994 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -63,7 +63,6 @@
#include "xf86pciBus.h"
#include "xf86Xinput.h"
-extern DeviceAssocRec mouse_assoc;
#include "xkbsrv.h"
@@ -136,7 +135,7 @@ static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
Bool active);
-static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
+static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input,
MessageType from);
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
@@ -445,8 +444,8 @@ xf86InputDriverlistFromConfig(void)
{
int count = 0;
char **modulearray;
- IDevPtr* idp;
-
+ InputInfoPtr *idp;
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -504,7 +503,6 @@ fixup_video_driver_list(char **drivers)
static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
char **end, **drv;
char *x;
- char **ati, **atimisc;
int i;
/* walk to the end of the list */
@@ -743,8 +741,6 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE },
- { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
- {0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
@@ -955,13 +951,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
#endif
- /* AllowEmptyInput is automatically true if we're hotplugging */
- xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
- xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
+ /* 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);
@@ -1093,12 +1089,12 @@ Bool xf86DRI2Enabled(void)
static Bool
checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
{
- IDevPtr corePointer = NULL, coreKeyboard = NULL;
+ InputInfoPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
- IDevPtr *devs, /* iterator */
+ InputInfoPtr *devs, /* iterator */
indp;
- IDevRec Pointer, Keyboard;
+ InputInfoRec Pointer = {}, Keyboard = {};
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
int count = 0;
@@ -1113,49 +1109,27 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* remove the core attribute from the later ones.
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
- pointer opt1 = NULL, opt2 = NULL;
indp = *devs;
- if (indp->commonOptions &&
- xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
- opt1 = indp->commonOptions;
- }
- if (indp->extraOptions &&
- xf86CheckBoolOption(indp->extraOptions, "CorePointer", FALSE)) {
- opt2 = indp->extraOptions;
- }
- if (opt1 || opt2) {
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
if (!corePointer) {
corePointer = indp;
} else {
- if (opt1)
- xf86ReplaceBoolOption(opt1, "CorePointer", FALSE);
- if (opt2)
- xf86ReplaceBoolOption(opt2, "CorePointer", FALSE);
+ xf86ReplaceBoolOption(indp->options, "CorePointer", FALSE);
xf86Msg(X_WARNING, "Duplicate core pointer devices. "
"Removing core pointer attribute from \"%s\"\n",
- indp->identifier);
+ indp->name);
}
}
- opt1 = opt2 = NULL;
- if (indp->commonOptions &&
- xf86CheckBoolOption(indp->commonOptions, "CoreKeyboard", FALSE)) {
- opt1 = indp->commonOptions;
- }
- if (indp->extraOptions &&
- xf86CheckBoolOption(indp->extraOptions, "CoreKeyboard", FALSE)) {
- opt2 = indp->extraOptions;
- }
- if (opt1 || opt2) {
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
if (!coreKeyboard) {
coreKeyboard = indp;
} else {
- if (opt1)
- xf86ReplaceBoolOption(opt1, "CoreKeyboard", FALSE);
- if (opt2)
- xf86ReplaceBoolOption(opt2, "CoreKeyboard", FALSE);
+ xf86ReplaceBoolOption(indp->options, "CoreKeyboard", FALSE);
xf86Msg(X_WARNING, "Duplicate core keyboard devices. "
"Removing core keyboard attribute from \"%s\"\n",
- indp->identifier);
+ indp->name);
}
}
count++;
@@ -1182,7 +1156,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (*devs == corePointer)
{
free(*devs);
- *devs = (IDevPtr)0x1; /* ensure we dont skip next loop*/
+ *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop*/
break;
}
for (; devs && *devs; devs++)
@@ -1200,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) {
@@ -1216,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);
@@ -1233,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");
@@ -1249,17 +1223,17 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Pointer;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
}
}
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
return FALSE;
@@ -1283,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>");
@@ -1293,10 +1267,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Pointer;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
@@ -1324,7 +1298,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (*devs == coreKeyboard)
{
free(*devs);
- *devs = (IDevPtr)0x1; /* ensure we dont skip next loop */
+ *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop */
break;
}
for (; devs && *devs; devs++)
@@ -1342,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) {
@@ -1358,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) {
@@ -1373,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");
@@ -1389,17 +1363,17 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundKeyboard) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Keyboard;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
}
}
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
return FALSE;
@@ -1425,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)
@@ -1438,8 +1412,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend);
#else
- xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n"
- "\tTry disabling AllowEmptyInput.\n");
+ xf86Msg(X_WARNING, "Hotplugging requested but the server was "
+ "compiled without a config backend. "
+ "No input devices were configured, the server "
+ "will start without any input devices.\n");
#endif
}
@@ -1464,7 +1440,7 @@ static Bool
configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
{
XF86ConfInputrefPtr irp;
- IDevPtr *indp;
+ InputInfoPtr *indp;
int count = 0;
/*
@@ -1477,19 +1453,19 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
}
DebugF("Found %d input devices in the layout section %s\n",
count, layout->lay_identifier);
- indp = xnfcalloc((count + 1), sizeof(IDevPtr));
+ indp = xnfcalloc((count + 1), sizeof(InputInfoPtr));
indp[count] = NULL;
irp = layout->lay_input_lst;
count = 0;
while (irp) {
- indp[count] = xnfalloc(sizeof(IDevRec));
+ indp[count] = xnfalloc(sizeof(InputInfoRec));
if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
while(count--)
free(indp[count]);
free(indp);
return FALSE;
}
- indp[count]->extraOptions = irp->iref_option_lst;
+ indp[count]->options = irp->iref_option_lst;
count++;
irp = (XF86ConfInputrefPtr)irp->list.next;
}
@@ -1712,7 +1688,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
MessageType from;
XF86ConfScreenPtr s;
screenLayoutPtr slp;
- IDevPtr *indp;
+ InputInfoPtr *indp;
XF86ConfLayoutRec layout;
if (!servlayoutp)
@@ -1758,7 +1734,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
from = X_DEFAULT;
} else {
/* Set up an empty input device list, then look for some core devices. */
- indp = xnfalloc(sizeof(IDevPtr));
+ indp = xnfalloc(sizeof(InputInfoPtr));
*indp = NULL;
servlayoutp->inputs = indp;
}
@@ -2211,7 +2187,6 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
static void
configDRI(XF86ConfDRIPtr drip)
{
- int i;
struct group *grp;
xf86ConfigDRI.group = -1;
@@ -2283,13 +2258,12 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
}
static Bool
-configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
+configInput(InputInfoPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
{
xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
- inputp->identifier = conf_input->inp_identifier;
+ inputp->name = conf_input->inp_identifier;
inputp->driver = conf_input->inp_driver;
- inputp->commonOptions = conf_input->inp_option_lst;
- inputp->extraOptions = NULL;
+ inputp->options = conf_input->inp_option_lst;
inputp->attrs = NULL;
return TRUE;
@@ -2338,12 +2312,13 @@ 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)
{
- IDevPtr *dev = layout->inputs;
+ InputInfoPtr *dev = layout->inputs;
BOOL warned = FALSE;
while(*dev)
@@ -2352,15 +2327,15 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
strcmp((*dev)->driver, "mouse") == 0 ||
strcmp((*dev)->driver, "vmmouse") == 0)
{
- IDevPtr *current;
+ InputInfoPtr *current;
if (!warned)
{
- xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using "
+ xf86Msg(X_WARNING, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE;
}
- xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+ xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->name);
current = dev;
free(*dev);