On older X servers, button 6 and 7 don't do anything special;
on X server 1.7 and later, they are being translated into left and right
scroll events.  This patch changes letf/right arrow to button 6/7 for
horizontal scroll events.

Signed-off-by: Ping Cheng <[email protected]>
---
 src/wcmTouchFilter.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index ebf7ba7..7a7bbe2 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -35,6 +35,8 @@

 #define WCM_SCROLL_UP                 5        /* vertical up */
 #define WCM_SCROLL_DOWN               4        /* vertical down */
+#define WCM_SCROLL_LEFT               6        /* horizontal left */
+#define WCM_SCROLL_RIGHT              7        /* horizontal right */


 /* Defines for Tap Add-a-Finger to Click */
@@ -263,7 +265,7 @@ static void
xf86WcmSendVerticalScrollEvent(WacomDevicePtr priv,
 }

 static void xf86WcmSendHorizontalScrollEvent(WacomDevicePtr priv,
-                                            int dist, int left, int right)
+       int dist, int left, int right)
 {
        int i = 0;

@@ -272,13 +274,29 @@ static void
xf86WcmSendHorizontalScrollEvent(WacomDevicePtr priv,
        {
                if (dist > 0)
                {
-                       emitKeysym (priv->local->dev, left, 1);
-                       emitKeysym (priv->local->dev, left, 0);
+                       /* button down */
+                       xf86PostButtonEvent(priv->local->dev,
+                                       priv->flags & ABSOLUTE_FLAG,
+                                       left,1,0,priv->naxes, priv->oldX,
+                                       priv->oldY,0,0,0,0);
+                       /* button up */
+                       xf86PostButtonEvent(priv->local->dev,
+                                       priv->flags & ABSOLUTE_FLAG,
+                                       left,0,0,priv->naxes, priv->oldX,
+                                       priv->oldY,0,0,0,0);
                }
                else
                {
-                       emitKeysym (priv->local->dev, right, 1);
-                       emitKeysym (priv->local->dev, right, 0);
+                       /* button down */
+                       xf86PostButtonEvent(priv->local->dev,
+                                       priv->flags & ABSOLUTE_FLAG,
+                                       right,1,0,priv->naxes, priv->oldX,
+                                       priv->oldY,0,0,0,0);
+                       /* button up */
+                       xf86PostButtonEvent(priv->local->dev,
+                                       priv->flags & ABSOLUTE_FLAG,
+                                       right,0,0,priv->naxes, priv->oldX,
+                                       priv->oldY,0,0,0,0);
                }
        }
 }
@@ -348,7 +366,8 @@ static void xf86WcmFingerScroll(WacomDevicePtr priv)
                                if (abs(dist) > WACOM_PARA_MOTION_IN_POINT)
                                {
                                        gesture = 1;
-                                       xf86WcmSendHorizontalScrollEvent(priv, 
dist, XK_Left, XK_Right);
+                                       xf86WcmSendHorizontalScrollEvent(priv, 
dist,
+                                               WCM_SCROLL_LEFT, 
WCM_SCROLL_RIGHT);
                                }
                        }
                }
-- 
1.6.5.2

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to