[PATCH 07/23] Give FingerState enums explicit values

Daniel Stone daniel at fooishbar.org
Thu Jun 23 15:12:42 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>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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 c685548..d39e100 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2538,7 +2538,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.4



More information about the xorg-devel mailing list