Moving into a different soft button's area during drag-n-drop would trigger
a click of that button.

We only have the current button state and we mess with it, so the conditions
for a possible clickpad soft-button event are:
- hw->left is down now
- none of left|right|middle were down before. since we change hw->left to
  hw->right/left we need to check all three

If hw->left is down but one of the other buttons was already down, copy that
button state and continue.

http://bugzilla.redhat.com/819348

Signed-off-by: Peter Hutterer <[email protected]>
---
Changes to v1:
- check for all three buttons since we may have changed the hw-state for the
  right/middle button
- if left is down and was already down, copy the previous hardware state to
  maintain the right button state

 src/synaptics.c |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 4f2bf78..6b95850 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2538,14 +2538,23 @@ update_hw_button_state(const InputInfoPtr pInfo, struct 
SynapticsHwState *hw,
 
     /* If this is a clickpad and the user clicks in a soft button area, press
      * the soft button instead. */
-    if (para->clickpad && hw->left && !hw->right && !hw->middle) {
-        if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
-            hw->left = 0;
-            hw->right = 1;
-        }
-        else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
-            hw->left = 0;
-            hw->middle = 1;
+    if (para->clickpad) {
+        /* hw->left is down, but no other buttons were already down */
+        if (!old->left && !old->right && !old->middle &&
+            hw->left && !hw->right && !hw->middle) {
+                if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
+                    hw->left = 0;
+                    hw->right = 1;
+                }
+                else if (is_inside_middlebutton_area(para, hw->x, hw->y)) {
+                    hw->left = 0;
+                    hw->middle = 1;
+                }
+        }
+        else if (hw->left) {
+            hw->left = old->left;
+            hw->right = old->right;
+            hw->middle = old->middle;
         }
     }
 
-- 
1.7.10.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to