[PATCH] evdev: Provide the valuators on Button(Press|Release) events.

oliver.mcfadden at nokia.com oliver.mcfadden at nokia.com
Sun Aug 2 06:24:02 PDT 2009


From: Oliver McFadden <oliver.mcfadden at nokia.com>

This feature is especially useful for touchscreen devices and is only
enabled with an X server which provides the xf86PostButtonEventP helper
function. See X server commit 8da0ff2d51086666d10ca7330d428e8610a4a0e3.
---
 configure.ac |    8 ++++++++
 src/evdev.c  |    8 +++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 46a1c19..ebeb239 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,14 @@ AC_SUBST([sdkdir])
 # Checks for header files.
 AC_HEADER_STDC
 
+# Checks for library functions.
+SAVED_CFLAGS="$CFLAGS"
+CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
+AC_CHECK_DECL([xf86PostButtonEventP], AC_DEFINE(HAVE_XF86POSTBUTTONEVENTP, 1, [Have xf86PostButtonEventP]), [],
+	      [#include <xorg-server.h>
+	       #include <xf86Xinput.h>])
+CFLAGS="$SAVED_CFLAGS"
+
 DRIVER_NAME=evdev
 AC_SUBST([DRIVER_NAME])
 
diff --git a/src/evdev.c b/src/evdev.c
index 9528dbf..7ea2ef7 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -679,11 +679,13 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
                                   pEvdev->queue[i].val);
             break;
         case EV_QUEUE_BTN:
-            /* FIXME: Add xf86PostButtonEventP to the X server so that we may
-             * pass the valuators on ButtonPress/Release events, too.  Currently
-             * only MotionNotify events contain the pointer position. */
+#ifdef HAVE_XF86POSTBUTTONEVENTP
+            xf86PostButtonEventP(pInfo->dev, !pEvdev->rel, pEvdev->queue[i].key,
+                                 pEvdev->queue[i].val, *first_v, *num_v, v);
+#else
             xf86PostButtonEvent(pInfo->dev, 0, pEvdev->queue[i].key,
                                 pEvdev->queue[i].val, 0, 0);
+#endif
             break;
         }
     }
-- 
1.6.1



More information about the xorg-devel mailing list