[PATCH synaptics 3/3] Allow soft button areas to overlap on the edge

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 2 19:09:11 PDT 2013


For percent-based configuration in the form of
middle button 33%-66%, right button 66%-0 we'd get an error because of the
one device unit overlap. This was neither documented nor useful, because
leaving a 1% gap leaves an actual gap between the buttons. Allow for an
overlap of one device unit on the edge of the buttons.

What's picked in that case depends on the implementation of
is_inside_softbutton_area but since one device unit is so small, it doesn't
matter.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 man/synaptics.man |  3 ++-
 src/synaptics.c   | 16 ++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/man/synaptics.man b/man/synaptics.man
index 2b7b7b9..079a5f8 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -443,7 +443,8 @@ bottom edge of the middle button, respectively. Any of the values may be
 given as percentage of the touchpad width or height, whichever applies.
 If any edge is set to 0 (not 0%), the button is assumed to extend to
 infinity in the given direction. Setting all values to 0 (not 0%) disables
-soft button areas.
+soft button areas. Button areas may not overlap, however it is permitted for two
+buttons to share an edge value.
 Property: "Synaptics Soft Button Areas"
 .
 
diff --git a/src/synaptics.c b/src/synaptics.c
index 50eb34b..887f962 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -419,13 +419,13 @@ SynapticsIsSoftButtonAreasValid(int *values)
         if ((right_bottom <= middle_bottom && right_bottom >= middle_top) ||
             (right_top <= middle_bottom && right_top >= middle_top)) {
             /* Check for overlapping left edges */
-            if ((right_left < middle_left && right_right >= middle_left) ||
-                (middle_left < right_left && middle_right >= right_left))
+            if ((right_left < middle_left && right_right > middle_left) ||
+                (middle_left < right_left && middle_right > right_left))
                 return FALSE;
 
             /* Check for overlapping right edges */
-            if ((right_right > middle_right && right_left <= middle_right) ||
-                (middle_right > right_right && middle_left <= right_right))
+            if ((right_right > middle_right && right_left < middle_right) ||
+                (middle_right > right_right && middle_left < right_right))
                 return FALSE;
         }
 
@@ -433,13 +433,13 @@ SynapticsIsSoftButtonAreasValid(int *values)
         if ((right_left >= middle_left && right_left <= middle_right) ||
             (right_right >= middle_left && right_right <= middle_right)) {
             /* Check for overlapping top edges */
-            if ((right_top < middle_top && right_bottom >= middle_top) ||
-                (middle_top < right_top && middle_bottom >= right_top))
+            if ((right_top < middle_top && right_bottom > middle_top) ||
+                (middle_top < right_top && middle_bottom > right_top))
                 return FALSE;
 
             /* Check for overlapping bottom edges */
-            if ((right_bottom > middle_bottom && right_top <= middle_bottom) ||
-                (middle_bottom > right_bottom && middle_top <= right_bottom))
+            if ((right_bottom > middle_bottom && right_top < middle_bottom) ||
+                (middle_bottom > right_bottom && middle_top < right_bottom))
                 return FALSE;
         }
     }
-- 
1.8.1.4



More information about the xorg-devel mailing list