[PATCH 1/3] fix xf86 backend-specific input initialization

Simon Thum simon.thum at gmx.de
Sun Jul 18 03:31:26 PDT 2010


Instead of shoving it in rather unrelated places,
move acceleration init into xf86NewInputDevice.

Caveat: It's not clear atm how relevant other callers of ActivteDevice
(like OpenDevice) actually are.
---
 hw/xfree86/common/xf86Xinput.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index bd77fe6..5279e28 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -108,6 +108,9 @@
 
 EventListPtr xf86Events = NULL;
 
+static int
+xf86InputDeviceAfterDriverInit(DeviceIntPtr dev);
+
 /**
  * Eval config and modify DeviceVelocityRec accordingly
  */
@@ -730,6 +733,19 @@ IgnoreInputClass(const IDevPtr idev, const InputAttributes *attrs)
     return ignore;
 }
 
+/*
+ * Apply backend-specific initialization. Invoked after ActiveteDevice(),
+ * i.e. after the driver successfully completed DEVICE_INIT and the device
+ * is advertised.
+ * @param dev the device
+ * @return Success or an error code
+ */
+static int
+xf86InputDeviceAfterDriverInit(DeviceIntPtr dev) {
+    ApplyAccelerationSettings(dev);
+    return Success;
+}
+
 /**
  * Create a new input device, activate and enable it.
  *
@@ -804,6 +820,14 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
         goto unwind;
     }
 
+    rval = xf86InputDeviceAfterDriverInit(dev);
+    if (rval != Success)
+    {
+	xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", idev->identifier);
+	RemoveDevice(dev, TRUE);
+	goto unwind;
+    }
+
     /* Enable it if it's properly initialised and we're currently in the VT */
     if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
     {
@@ -1320,9 +1344,6 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
 	dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
         dev->last.valuators[1] = dev->valuator->axisVal[1];
     }
-
-    if(axnum == 0)  /* to prevent double invocation */
-	ApplyAccelerationSettings(dev);
 }
 
 
-- 
1.7.1


--------------070002080801000903070402
Content-Type: text/plain;
 name="0002-refactor-scheme-init.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0002-refactor-scheme-init.patch"



More information about the xorg-devel mailing list