The prior patch has gestures use button mapping like buttons et.al.,
but for some reason this results in the cursor being "stuck" at the
top left of the screen when:

1) A gesture is performed
2) The gesture uses a button with an associated action
3) The action presses a button but does not release it

After much testing, I've found that this patch solves the issue and
also works for non-gesture code.

To be honest, I'm not sure why the old code didn't work but this does.
I see only see one difference in execution (the old code executed for
all 256 actions, '0' or not), but that change alone doesn't appear to
fix the bug...

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c |   61 ++++++++++++++++++++----------------------------------
 1 files changed, 23 insertions(+), 38 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 0d3e8d8..ff70d64 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -206,7 +206,7 @@ void sendAction(InputInfoPtr pInfo, int press,
        int i;
 
        /* Actions only trigger on press, not release */
-       for (i = 0; press && i < nkeys; i++)
+       for (i = 0; i < nkeys; i++)
        {
                unsigned int action = keys[i];
 
@@ -219,6 +219,17 @@ void sendAction(InputInfoPtr pInfo, int press,
                                {
                                        int btn_no = (action & AC_CODE);
                                        int is_press = (action & 
AC_KEYBTNPRESS);
+
+                                       if (!press)
+                                       {
+                                               if (!is_press)
+                                                       break;
+                                               if (countPresses(btn_no, 
&keys[i], nkeys - i))
+                                                       is_press = 0;
+                                               else
+                                                       break;
+                                       }
+                                       
                                        xf86PostButtonEventP(pInfo->dev,
                                                            is_absolute(pInfo), 
btn_no,
                                                            is_press, 
first_val, num_val,
@@ -229,6 +240,17 @@ void sendAction(InputInfoPtr pInfo, int press,
                                {
                                        int key_code = (action & AC_CODE);
                                        int is_press = (action & 
AC_KEYBTNPRESS);
+
+                                       if (!press)
+                                       {
+                                               if (!is_press)
+                                                       break;
+                                               if (countPresses(key_code, 
&keys[i], nkeys - i))
+                                                       is_press = 0;
+                                               else
+                                                       break;
+                                       }
+
                                        wcmEmitKeycode(pInfo->dev, key_code, 
is_press);
                                }
                                break;
@@ -239,43 +261,6 @@ void sendAction(InputInfoPtr pInfo, int press,
                                break;
                }
        }
-
-       /* Release all non-released keys for this button. */
-       for (i = 0; !press && i < nkeys; i++)
-       {
-               unsigned int action = keys[i];
-
-               switch ((action & AC_TYPE))
-               {
-                       case AC_BUTTON:
-                               {
-                                       int btn_no = (action & AC_CODE);
-
-                                       /* don't care about releases here */
-                                       if (!(action & AC_KEYBTNPRESS))
-                                               break;
-
-                                       if (countPresses(btn_no, &keys[i], 
nkeys - i))
-                                               xf86PostButtonEvent(pInfo->dev,
-                                                               
is_absolute(pInfo), btn_no,
-                                                               0, first_val, 
num_val,
-                                                               
VCOPY(valuators, num_val));
-                               }
-                               break;
-                       case AC_KEY:
-                               {
-                                       int key_code = (action & AC_CODE);
-
-                                       /* don't care about releases here */
-                                       if (!(action & AC_KEYBTNPRESS))
-                                               break;
-
-                                       if (countPresses(key_code, &keys[i], 
nkeys - i))
-                                               wcmEmitKeycode(pInfo->dev, 
key_code, 0);
-                               }
-               }
-
-       }
 }
 
 /*****************************************************************************
-- 
1.7.4.1


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to