Move the mode option handling to the Init stage.

(Sorta ugly placement wise, but the other segfaults.)
This commit is contained in:
Zephaniah E. Hull
2007-06-12 11:59:16 -04:00
parent 2d2c4804f9
commit 9c9a47210a

View File

@@ -726,18 +726,6 @@ EvdevAxisAbsNew1(InputInfoPtr pInfo)
}
}
s = xf86SetStrOption(pInfo->options, "Mode", "Absolute");
if (!strcasecmp(s, "Absolute")) {
pInfo->dev->valuator->mode = Absolute;
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
} else if (!strcasecmp(s, "Relative")) {
pInfo->dev->valuator->mode = Relative;
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
} else {
pInfo->dev->valuator->mode = Absolute;
xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s);
}
return Success;
}
@@ -861,6 +849,7 @@ EvdevAxesInit (DeviceIntPtr device)
evdevAxesRec *axes = state->axes;
AbsoluteClassRec *dev_abs;
int i;
const char *s;
if (!axes || !axes->axes)
return Success;
@@ -874,6 +863,23 @@ EvdevAxesInit (DeviceIntPtr device)
0))
return !Success;
/*
* This has to go in Init, because until now there is no valuator struct
* allocated.
*/
s = xf86SetStrOption(pInfo->options, "Mode", "Absolute");
if (!strcasecmp(s, "Absolute")) {
pInfo->dev->valuator->mode = Absolute;
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
} else if (!strcasecmp(s, "Relative")) {
pInfo->dev->valuator->mode = Relative;
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
} else {
pInfo->dev->valuator->mode = Absolute;
xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s);
}
/*
* Yes, we want to do this for relative devices too.
* Some of the settings are useful for both.