aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86Xinput.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-02-15 08:14:29 +0000
committermarha <marha@users.sourceforge.net>2010-02-15 08:14:29 +0000
commitb40e949511ca8c00cd7d13c622b5247145d44ab3 (patch)
treece21480d852a4748ad12a56f3579acf1cbc09f41 /xorg-server/hw/xfree86/common/xf86Xinput.c
parentfb89fb367b0defb8016ac97af590a6f5873c217f (diff)
parent6f0a8e51f20073ea01ac5dae8e5c4d49076fc65e (diff)
downloadvcxsrv-b40e949511ca8c00cd7d13c622b5247145d44ab3.tar.gz
vcxsrv-b40e949511ca8c00cd7d13c622b5247145d44ab3.tar.bz2
vcxsrv-b40e949511ca8c00cd7d13c622b5247145d44ab3.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Xinput.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index c2d9f49de..e9f7f2fb7 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -586,37 +586,40 @@ InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs)
/*
* Merge in any InputClass configurations. Options in each InputClass
- * section have less priority than the original device configuration as
+ * section have more priority than the original device configuration as
* well as any previous InputClass sections.
*/
static int
MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
{
XF86ConfInputClassPtr cl;
- XF86OptionPtr classopts;
+ XF86OptionPtr classopts, mergedopts = NULL;
+ char *classdriver = NULL;
for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) {
if (!InputClassMatches(cl, attrs))
continue;
+ /* Collect class options and merge over previous classes */
xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n",
idev->identifier, cl->identifier);
- if (cl->driver && !idev->driver) {
- idev->driver = xstrdup(cl->driver);
- if (!idev->driver) {
- xf86Msg(X_ERROR, "Could not allocate memory while merging "
- "InputClass configuration");
- return BadAlloc;
- }
- }
-
+ if (cl->driver)
+ classdriver = cl->driver;
classopts = xf86optionListDup(cl->option_lst);
- if (idev->commonOptions)
- idev->commonOptions = xf86optionListMerge(classopts,
- idev->commonOptions);
- else
- idev->commonOptions = classopts;
+ mergedopts = xf86optionListMerge(mergedopts, classopts);
+ }
+
+ /* Apply options to device with InputClass settings preferred. */
+ if (classdriver) {
+ xfree(idev->driver);
+ idev->driver = xstrdup(classdriver);
+ if (!idev->driver) {
+ xf86Msg(X_ERROR, "Failed to allocate memory while merging "
+ "InputClass configuration");
+ return BadAlloc;
+ }
}
+ idev->commonOptions = xf86optionListMerge(idev->commonOptions, mergedopts);
return Success;
}