[PATCH] Update synaptics to XInput 7 ABI

Ben Gamari bgamari.foss at gmail.com
Wed Jun 17 22:56:49 PDT 2009


---
 src/synaptics.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index ff66517..f917d8b 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -69,6 +69,11 @@
 #include <xf86Xinput.h>
 #include <exevents.h>
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
+#include <X11/Xatom.h>
+#include <xserver-properties.h>
+#endif
+
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
 #include "mipointer.h"
 #endif
@@ -795,6 +800,20 @@ DeviceInit(DeviceIntPtr dev)
     SynapticsPrivate *priv = (SynapticsPrivate *) (local->private);
     unsigned char map[SYN_MAX_BUTTONS + 1];
     int i;
+    Atom axis_labels[] = {
+	    XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X),
+	    XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y),
+    };
+    Atom btn_labels[] = {
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_LEFT),
+	    XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_RIGHT),
+	    // FIXME: I don't know what the other buttons might be
+    };
 
     DBG(3, ErrorF("Synaptics DeviceInit called\n"));
 
@@ -805,6 +824,9 @@ DeviceInit(DeviceIntPtr dev)
 
     InitPointerDeviceStruct((DevicePtr)dev, map,
 			    SYN_MAX_BUTTONS,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+			    btn_labels,
+#endif
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
 			    miPointerGetMotionEvents,
 #elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
@@ -813,21 +835,40 @@ DeviceInit(DeviceIntPtr dev)
 			    SynapticsCtrl,
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
 			    miPointerGetMotionBufferSize()
-#else
+#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 7
 			    GetMotionHistorySize(), 2
+#else
+			    GetMotionHistorySize(), 2, axis_labels
 #endif
 			    );
     /* X valuator */
     if (priv->minx < priv->maxx)
-	xf86InitValuatorAxisStruct(dev, 0, priv->minx, priv->maxx, 1, 0, 1);
+	xf86InitValuatorAxisStruct(dev, 0, 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+                                   axis_labels[0],
+#endif
+				   priv->minx, priv->maxx, 1, 0, 1);
     else
-	xf86InitValuatorAxisStruct(dev, 0, 0, -1, 1, 0, 1);
+	xf86InitValuatorAxisStruct(dev, 0,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+                                   axis_labels[0],
+#endif
+				   0, -1, 1, 0, 1);
     xf86InitValuatorDefaults(dev, 0);
+    
     /* Y valuator */
     if (priv->miny < priv->maxy)
-	xf86InitValuatorAxisStruct(dev, 1, priv->miny, priv->maxy, 1, 0, 1);
+	xf86InitValuatorAxisStruct(dev, 1,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+                                   axis_labels[1],
+#endif
+				   priv->miny, priv->maxy, 1, 0, 1);
     else
-	xf86InitValuatorAxisStruct(dev, 1, 0, -1, 1, 0, 1);
+	xf86InitValuatorAxisStruct(dev, 1,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+                                   axis_labels[1],
+#endif
+				   0, -1, 1, 0, 1);
     xf86InitValuatorDefaults(dev, 1);
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
-- 
1.6.3.1




More information about the xorg mailing list