[PATCH 02/15] Give FingerState enums explicit values

Daniel Stone daniel at fooishbar.org
Thu Jun 9 12:57:23 PDT 2011


Since we depend so heavily on ordering and numbering, just give all the
enum explicit number values.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/synaptics.c    |    2 +-
 src/synapticsstr.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index cf91b9f..68129fe 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2544,7 +2544,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
     }
 
     /* Post events */
-    if (finger > FS_UNTOUCHED) {
+    if (finger >= FS_TOUCHED) {
         if (priv->absolute_events && inside_active_area) {
             xf86PostMotionEvent(pInfo->dev, 1, 0, 2, hw->x, hw->y);
         } else if (dx || dy) {
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index b2fecbe..c69ba09 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -51,10 +51,10 @@ typedef struct _SynapticsMoveHist
     int millis;
 } SynapticsMoveHistRec;
 
-enum FingerState {		/* Note! The order matters. Compared with < operator. */
-    FS_UNTOUCHED,
-    FS_TOUCHED,
-    FS_PRESSED
+enum FingerState {              /* Note! The order matters. Compared with < operator. */
+    FS_UNTOUCHED = 0, /* this is 0 so it's the initialized value. */
+    FS_TOUCHED = 1,
+    FS_PRESSED = 2,
 };
 
 enum MovingState {
-- 
1.7.5.3



More information about the xorg-devel mailing list